Repository navigation
test(request-identity): cover upload hashing edges and every send option in both fingerprint versions - #129
DMontgomery40 wants to merge 11 commits into
Conversation
Sent, Received, Expected and Recipients records now open from an address that keeps the list filter with the record (?fax=, ?item=, ?expected=, ?recipient= plus status/show/q), so a copied link, a reload or Back restores the same record over the same filtered list. A record this person may not see opens nothing: Received shows a safe not-found line and the detail dialogs keep their server-checked errors. Rows in the four lists were click-only; each now opens from a real link with a visible focus outline (copy link, new tab and keyboard included), and moving to another page puts the focus on its heading. Query-only moves keep the scroll position, so Back lands where the list was left. The fax Send queues, Dashboard and Received follow into Sent through the record address. The command line already named the same records (faxes sent get, faxes received get, faxes expected show, recipients show), so no CLI change was needed; the console/CLI parity and settings coverage checks pass unchanged. These lists have no paging controls, so there is no page number to keep in the address yet. Issue #54 (spec #48, after #49 and #51).
The focus move to a new page's heading tried once, right after the page mounted, and gave up when no heading was there yet. Overview shows a spinner until its data lands, so moving there left focus on the panel; Number moves, Logs, Blocked senders and NPI record had no page heading (h1) at all, so focus never moved on those either. The shell now waits a bounded time for the page heading to appear and focuses it then. It stops waiting when the person moves focus into the page themselves, or when they leave the page. The four pages without an h1 now render their existing title as the page heading, with the same look. The every-page navigation test now checks, for each page it opens, that focus lands on that page's heading inside main (the Terminal hands it to its shell once that opens), so a page without a heading fails the test. Its timeout grows to 120 s for the extra waits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overview shows a spinner before its heading. Opening it from another page must still end with the keyboard focus on its heading. On the code before the previous commit this test fails (focus stays on the body), alongside the every-page check that lists Number moves, Blocked senders, NPI record and Logs as pages without a heading to focus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two gaps in opening the received document a copied link names (#/faxes/received?item=...): - Someone without the owners list saw nothing at all: the page waited for a list it never loads. They now see the same short not-found line as for any document they may not see, and nothing opens. - A document beyond the loaded list is read on its own. That answer was dropped whenever the page re-rendered before it arrived (the console shell hands the page a fresh callback on each of its renders), and it was never asked for again, so the link opened nothing. The answer now counts for as long as the address still names that document. Both tests fail on the previous commit's Received.tsx. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README said the command line opens a sent and a received fax with `faxbot faxes sent get` and `faxbot faxes received get`. Those names belong to the removed `jobs` and `inbound` groups; the commands are `faxes sent show` and `faxes received show`. The record and roadmap lines now give the right names (also in the received-history entry), add the list filters the console's addresses match (`faxes sent list --status/--hours/--held`, `faxes expected list --show/--search`), and say what a record you may not see shows: Received says it could not be found, the other lists show only why it could not be loaded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ound trip Opening a fax in Sent now travels in the address (?fax=), so the shell's jobToOpen state was never set and the Sent page's openJobId/onOpened wiring did nothing. Both are removed from the shell and PageContext; JobsList keeps its openJobId prop for callers outside the shell. A shell-level test signs in at a filtered Sent list, opens a fax from its row link, checks the address carries the filter and the fax, then goes Back (details close over the same filtered list) and Forward (the same fax opens again). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The "Open it" buttons in a sent fax's details (the fax that carries its remaining pages, the fax it continues, an uncertain fax's linked fax) opened the other fax in place, so the address still named the first fax: a copied link or a reload showed the wrong fax, and Back skipped the first one. They now open the other fax through its address, like a row link, so Back returns to the fax they were opened from. The test fails on the previous JobsList.tsx (the address is never told). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds the useful parts of the unverified request-identity work salvaged on fleet/mac-request-identity-tests: - A table test that stores an accepted request under the canonical (version 2) fingerprint and, separately, under the version-1 fingerprint, then replays the same Idempotency-Key with one changed send option (real call, urgent, send-by time, mailbox, workflow, labels, engine, cover-in-header, court digest, patient details). find_replay must refuse every one with IdempotencyConflict and store nothing. The version-1 rows are new coverage: other suites only check that an option changes the version-2 fingerprint, so an option dropped from the earlier-version fingerprint would replay an old record for a different request unnoticed. The patient value uses the JSON text that Patient.canonical() returns. - Routing order and label order do not change a request's identity. - Two different send-by times are different requests, not only "with" and "without" a send-by time. - Upload hashing starts from the beginning even when the spool was moved, reads in bounded chunks and rewinds afterwards. make venv now also installs the Python SDK in editable mode, as the CI test-api job and the full suite workflow do (pip install -e ../sdks/python); the API tests import it. CONTRIBUTING.md says so. The salvaged empty-upload and read-failure tests are left out: the previous commit covers both more strictly (cancellation too, the same error object, the spool left open and unchanged). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t (merge train: #128 lands first)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ad9fd4ce15
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (found) { | ||
| setRecordMissing(false); | ||
| setSelected((current) => (current?.id === found.id ? current : found)); | ||
| return; |
There was a problem hiding this comment.
Invalidate pending document reads when selecting a listed item
If an older document A is loading through getWork(A) and the administrator uses Back or Forward to select document B already present in work, this branch selects B without changing recordAsked.current from A. When A's request finishes, its stale-response guard still passes and replaces B's details with A's, even though the address names B. Update the request-selection token on every address change, including this branch, so an outstanding read cannot reopen the wrong document.
Useful? React with 👍 / 👎.
Request identity: upload hashing edge cases and every send option in both fingerprint versions
This PR adds tests only, plus a one-line
make venvfix. It does not changeapi/app/request_identity.pyor any other application code.First commit (from this branch, rebased onto main 80bc4b6): upload hashing is tested for two more cases:
Second commit (salvaged from
fleet/mac-request-identity-tests, d11c42d): the uncommitted, unverified work on that branch, checked and trimmed.Kept:
IdempotencyConflictinfind_replay, and nothing new may be stored. The version-1 rows are new coverage. Other suites (test_routing_local,test_capacity,test_schedule) only check that an option changes the version-2 fingerprint, and the HTTP tests always store version 2. If an option were left out of the version-1 fingerprint, a replay would match an old record for a different request, and no existing test would notice. I changed the salvaged patient value from a dict to the JSON text thatPatient.canonical()actually returns.make venvnow installs the Python SDK in editable mode. CI'stest-apijob and the full suite workflow both do this (pip install -e ../sdks/python), andtests/test_api.pyimports the SDK. The CONTRIBUTING.md row says so.Dropped:
test_empty_upload_is_rejected_and_rewoundandtest_upload_read_failure_propagates_and_rewinds. They duplicate the first commit's tests, which check more: cancellation as well as OS errors, that the error raised is the same object, and that the spool is open and unchanged.Nothing else from that branch is needed, so it can be deleted once this merges.
No README or roadmap change is needed, because no capability changed.
Checks on this head
make test-local PYTEST_ARGS='tests/test_request_identity.py'(SQLite): 33 passed.make test-localontest_request_identity, plus every test file that importsrequest_identity(test_access_outbound,test_api,test_batching,test_batching_index_page,test_capacity,test_outbound_idempotency,test_routing_local,test_schedule): 202 passed, 92 skipped in 5 min 10 s. The 92 skipped are exactly the 92 collected PostgreSQL variants, which skip when no PostgreSQL URL is set. This PR has no schema change; the full suite runs them.python -m py_compile api/tests/test_request_identity.py: compiles.The repository has no linter or Python type checker (CONTRIBUTING.md, "What CI runs"), so there is none to run.
Each new test exercises real behaviour. I mutated
api/app/request_identity.pyone change at a time, rantests/test_request_identity.pyagainst each mutation, then restored the file:Exceptiononly, not on cancellationcancelledcase onlyread-errorandcancelled) and the existing oversize testlegacytable cases and the send-by-value testcanonicaltable cases and the send-by-value testThe secret scan against origin/main found no suspicious added lines.
Not checked
make venvwas not run, because uv is not installed on the machine where these checks ran. The added-e sdks/pythonfollows uv'spip install -eform and matches what CI installs.No failures in the tests run, so none are pre-existing.
No open issue matches this work.
🤖 Generated with Claude Code