Skip to content

feat(console): durable addresses for records and filters, keyboard-operable rows - #128

Open
DMontgomery40 wants to merge 8 commits into
mainfrom
fleet-20261029/faxbot-issue-54
Open

DMontgomery40 wants to merge 8 commits into
mainfrom
fleet-20261029/faxbot-issue-54

Conversation

@DMontgomery40

Copy link
Copy Markdown
Owner

Durable addresses for records and filters, and keyboard-operable rows

Every sent fax, received document, expected fax and recipient now opens from its own address, and the list's filter rides in the same address: #/faxes/sent?status=failed&fax=…, #/faxes/received?show=waiting&item=…, #/faxes/expected?show=overdue&q=PO&expected=… and #/recipients/list?recipient=…. A copied link, a reload or Back reopens the same record over the same filtered list. Changing a filter closes the open record. Typing in Expected's reference search updates the address without adding history entries. Opening a record or changing a filter keeps the scroll position, and moving to another page scrolls to the top.

Rows in Sent, Received, Expected and Recipients used to open only on a mouse click. Each one now opens from a real link (RecordLink) that has the record's address as its href and a visible focus outline. That makes copy link, new tab and keyboard use work. The rows themselves no longer have click handlers. Moving to another page puts the keyboard focus on that page's heading.

What this PR adds on top of the first commit

Verifying the first commit (Give every fax, document, expected fax and recipient its own address) turned up the defects below. Each fix is its own commit:

  • Focus on the page heading failed on five pages. The first commit tried once to focus the heading, right after the page mounted:

    • Overview shows a spinner first, so it had no heading yet.
    • Number moves, Logs, Blocked senders and NPI record had no h1 at all.

    The shell now waits a bounded time for the heading and focuses it when it appears. The wait stops early if the person moves focus into the page themselves or leaves the page. Those four pages now render their existing title as the h1, with the same look. The Terminal page focuses its heading first and then hands focus to its shell once that opens, so typing goes there. This is deliberate and the test allows it.

  • Received did not handle some copied links. Someone without the owners list who opened a copied ?item= link saw nothing at all; they now get the same short not-found line as for any document they may not see. A document beyond the loaded list is read on its own. That answer was dropped whenever the page re-rendered before it arrived (the shell hands the page a fresh callback on each render), and nothing opened. The answer is now kept while the address still names that document.

  • "Open it" inside Sent's details bypassed the address. These buttons open the continuing fax, the fax being continued, and an uncertain fax's linked fax. They opened the other fax in place, so the address still named the first fax. They now go through the address like a row link.

  • README named commands that do not exist. It listed faxbot faxes sent get and faxbot faxes received get, which belong to the removed jobs/inbound groups. It now names faxes sent show and faxes received show, plus the list filters that match the address: faxes sent list --status/--hours/--held and faxes expected list --show/--search. The README also says what a record you may not see shows: Received says it could not be found, and Sent, Expected and Recipients show only why the details could not be loaded. The received-history roadmap entry had the same wrong received get name and is fixed too.

  • Unused state removed. Opening a fax now goes through the address, so the shell's jobToOpen state and the Sent page's openJobId/onOpened wiring did nothing. They are removed. JobsList keeps the openJobId prop for callers outside the shell.

The command line already opened and filtered the same records. No CLI command or help text changed, so docs/reference/cli.md is unchanged.

Rebased onto main after #122

#122 merged into main while this was being verified, so this branch is rebased onto main. The only conflict was the first cell of a Sent row in api/admin_ui/src/components/JobsList.tsx: #122 added the recipient's name above the number. I resolved it by putting the record link around both the name and the number:

<TableRow key={job.id} hover>
  <TableCell>
    <RecordLink href={recordHref?.(job.id)} onOpen={() => openRecord(job.id)}
      ariaLabel={`Details for the fax to ${job.recipient ? `${job.recipient}, ` : ''}${job.to_number}`}>
      {job.recipient && <Typography component="span" display="block" variant="body2" data-testid="job-recipient"
        sx={{ fontSize: { xs: '0.7rem', sm: '0.875rem' } }}>{job.recipient}</Typography>}
      <Typography component="span" display="block" variant={job.recipient ? 'caption' : 'body2'} fontFamily="monospace"
        color={job.recipient ? 'text.secondary' : undefined}
        sx={{ fontSize: { xs: '0.7rem', sm: job.recipient ? '0.75rem' : '0.875rem' } }}>
        {job.to_number}
      </Typography>
    </RecordLink>

What remains

  • Scroll position after a reload, checked in a real browser. Open a record from a long, scrolled list, reload, then press Back; the list should be at the same scroll position. Opening a record or changing a filter no longer scrolls to the top, and Back within the session is covered by tests. Restoring the position after a reload is left to the browser, which jsdom cannot exercise.

Checks on this head

All checks below ran on the rebased head. The console tests ran against the final code, with no source changes afterwards.

  • npx vitest run --maxWorkers=2 --minWorkers=1 <42 files> covers every test that imports App, navigation, JobsList, Received, DeliveryRoutes, Destinations, ExpectedFaxes, RecordLink, focusHeading, BlockedSenders, Logs, NpiRecord or NumberMoves, plus sendFax, sentRoute and attentionLinks, which fix: readiness item 2, the remaining console defects D23–D27 (combines #118, #120, #121) #122 touched. Result: 42 files, 702 tests passed.
  • npx tsc --noEmit (api/admin_ui): exit 0.
  • make test-local PYTEST_ARGS='tests/test_console_cli_parity.py tests/test_settings_coverage.py': 27 passed, 4 skipped.
  • secret-scan.sh origin/main: no suspicious added lines.
  • No lint target is defined: the Makefile and .github/workflows/ci.yml on main have none.

Proof that the new tests fail on the old code. Each time I restored the earlier files with git checkout <commit> -- <files> (or git stash for the last one), ran only the named tests, and then put the fixed files back:

  • With App.tsx, focusHeading.ts and the four page components restored to the first commit, the every-page navigation test reports #/delivery/moves, #/delivery/blocked, #/admin/npi and #/admin/logs as unfocused. The new Overview test fails because focus stays on <body>.
  • With Received.tsx restored, both new Received tests fail: the missing owners list case and the re-render during loading.
  • With JobsList.tsx restored, the related-fax test fails, because the address is never told.

The first run of the covering set, before my fixes and under heavy machine load, had five tests time out in inboxDelivery.test.tsx and navigation.test.tsx. I reran those two files alone on the same code and all 67 tests passed. Load was the cause, not the code. Because the every-page test now waits for focus on each page, its timeout went from 60 s to 120 s.

Not checked

  • No live service was used: no fax provider, telephony, email or production system. All tests use synthetic data and mocks.
  • No real browser was used, so focus order, the focus outline and scroll restoration were checked only in jsdom.
  • Jev unavailable: wording was checked by reading it.
  • The Expected page's other tabs (What is missing, Import, Outages) are views, not list filters, and do not have their own address.

Part of #54

🤖 Generated with Claude Code

DMontgomery40 and others added 8 commits October 30, 2026 20:23
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>
@DMontgomery40
DMontgomery40 marked this pull request as ready for review October 30, 2026 20:44
DMontgomery40 added a commit that referenced this pull request Oct 30, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T20:45:28.214053Z 357ee6f Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 357ee6ffbd

ℹ️ 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".

Comment on lines +352 to +356
const found = (work ?? []).find((candidate) => candidate.id === itemId);
if (found) {
setRecordMissing(false);
setSelected((current) => (current?.id === found.id ? current : found));
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Invalidate pending lookups when opening a listed document

If a copied address starts loading document A outside the loaded work list, and Back/Forward changes the address to document B already in that list before A's request completes, this branch selects B without changing recordAsked.current. A's pending response therefore still passes the guard in the getWork callback and replaces B's details with A's, leaving the displayed document and download target inconsistent with the address. Invalidate the pending lookup on every item-address change, including this cached-list branch.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
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