Skip to content

SUBMISSION-29: sword - #122

Open
bmaltzan wants to merge 47 commits into
developfrom
SUBMISSION-29-sword
Open

SUBMISSION-29: sword#122
bmaltzan wants to merge 47 commits into
developfrom
SUBMISSION-29-sword

Conversation

@bmaltzan

Copy link
Copy Markdown
Contributor

No description provided.

Both were dropped when this branch was replayed onto the newer develop and
the conflicts resolved in favour of the base:

- factory.py: `backend` is not used here, and dropping it was part of the
  original "adjustments for sword and fastapi" commit. ruff F401.
- local_ui.py: LOCAL_LOGIN was being set twice. develop already sets it, so
  keep that line and drop ours; both values are truthy, so no behaviour change.
Rebasing onto develop put this branch's family-of-versions work next to
develop's cross-list and jref support for the first time, and the two disagree
about what sharing a `doc_paper_id` means. 33 of develop's cross/jref tests
failed as a result; the branch's own tests all passed, so nothing here was
caught before the two met.

Only `new` and `rep` rows are versions of one another. A `jref`, `wdr` or
`cross` row carries the announced paper's id without joining its version
chain -- each is its own domain identity with its own history -- so neither
lookup that resolves "the paper's current state" may be pointed at one:

- `_load` projected `family_head`, i.e. the announced `new` row, and stamped
  the requested id onto it. A cross-list came back as `SubmissionType.NEW` and
  `cross.py`'s type guard bounced every request to `/` with a 303.
- `_original_submission_id` returned the lowest id sharing the paper id, which
  is the announced row. The first event of a save filed correctly under the
  jref, then the follow-on event went looking for a `jref` row under the
  announced id and raised `NoResultFound`.

Both now consult the family only for a version-carrying row, and the
`min(submission_id)` query is restricted to `new`/`rep` for the same reason.
`family_head`'s docstring listed the excluded types but omitted `cross`, which
is part of why this was easy to miss.

The `_original_submission_id` tests passed `SimpleNamespace` stand-ins that
predate the type distinction; they now carry `submission_type`, plus a case
for a jref/wdr/cross keeping its own id.

./test.sh: 1541 passed, 59 skipped.
…guard

Rebasing onto develop put this branch's network guard next to develop's new
`qa` dependency. `qa`'s `IsEnglish` check detects language with ftlangdetect,
which downloads Facebook's 131MB `lid.176.bin` from dl.fbaipublicfiles.com on
first use and caches it under $FTLANG_CACHE. A fresh CI container has no cache,
so the guard failed every test that runs a metadata check -- 27 failures plus
setup errors across sword and ui.

Scoped to `download_model` rather than to the host. The guard hooks
`socket.connect`, which sees addresses after DNS -- ('13.33.67.42', 443) -- so
there is no hostname to match on, and that CDN's addresses rotate anyway. This
is the only code that reaches it, so exempting it and nothing else is what a
host allowlist would have achieved.

Costs one download per machine or CI container; every run after that is a cache
hit that makes no request. The new guard test asserts both halves -- the
download is permitted, and the guard is back afterwards, since an exemption
that stayed lifted would silently re-open the whole suite to the network.

Worth noting separately: develop's CI has been making this download on every
run for want of a cache step, and `IsEnglish` will make it in production too on
a cold Cloud Run container.

Verified with CI's own command against an empty $FTLANG_CACHE:
1539 passed, 59 skipped.
@bmaltzan
bmaltzan force-pushed the SUBMISSION-29-sword branch 2 times, most recently from b51f55b to e3396e0 Compare September 3, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant