Skip to content

Restyle the demo Integrator and widget; render screenshots from fixtures - #11

Merged
sodre merged 10 commits into
mainfrom
t3/restyle-demo-widget-screenshots
Nov 18, 2026
Merged

sodre merged 10 commits into
mainfrom
t3/restyle-demo-widget-screenshots

Conversation

@sodre

@sodre sodre commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Stacked on #10. It restyles the demo Integrator and widget, and replaces hand-captured screenshots with a scripted, fixture-driven capture.

Demo Integrator: "Harbor Ledger"

  • The demo site is now a fictional brand, Harbor Ledger — Client reporting workspace: harbor-blue palette, its own mark and logo, light and dark themes. It uses system fonts only, so the default-src 'self' CSP is unchanged.
  • The page renders every state from the backend's existing /api data: sign-in, workspace home (not paired / paired), pairing code entry, access pending (plus an offline warning when no Companion is connected), access approved (Approved / Ready for handshakes / Upstream accepted mTLS), access ended (denied / expired / revoked / replaced, with Request access again), devices, and a new Job result page.
  • New backend route POST /api/job returns the last Workload result. When you type curl, compose_demo.py now saves curl's output to the Integrator's (read-only mounted) secrets directory. The page shows the fingerprint the site received. You paste the SHA-256 from the Companion and the page compares them, because the Integrator cannot know which certificate you selected.
  • /api/session also returns the Workload, its generation, the host and a title. The Companion manifest is branded Harbor Ledger with a 128 px PNG logo. The static file map moved to site-files.js so the screenshot script serves exactly the same files and CSP.
  • The demo/e2e selectors still work: Demo login secret, Sign in, Code from your Companion, Confirm pairing and #message.

Widget

  • It now has a default Countersign card in the shadow DOM: a purple #2b0548 band with the two-bar mark, a headline slot and a green #224805 primary button. The card is a constructed stylesheet, so it also works under a strict style-src CSP (the old inline <style> was blocked by the demo's own CSP).
  • New parts: card, header, mark, wordmark, body, headline, plus button pair|connect|push and primary. A paired attribute moves the emphasis from Pair Companion to Request access. New --countersign-* colour properties are documented. Colours use light-dark(), so they follow the page's color-scheme and stay light on pages that declare none.
  • Backward compatible: the actions / status / launch parts and --countersign-font / --countersign-accent still apply. One visible change: the host is now display: block (it was inline-block).

Screenshots

  • pnpm screenshots runs scripts/capture_screenshots.mjs and then scripts/annotate_screenshots.py.
  • The Companion shots load the real packages/companion/src renderer in Chromium with a stubbed window.countersign (an init script, so there is no change to packages/companion). The demo shots load the real site with fixture /api responses on https://portal.example.
  • The clock is frozen, with fixed locale and time zone, at deviceScaleFactor: 2. The demo shots are cropped to the page content and come in light and dark variants. The Companion has no dark mode, so its shots are light only. A repeat run is byte-identical.
  • The capture records the boxes of the highlighted elements in raw/boxes.json, and annotate_screenshots.py reads them, scaled to the capture, instead of hard-coded pixel coordinates. The label style is unchanged.
  • The fixture data matches docs/integrate.md: https://portal.example, u-42, close-q3, export-981, ledger.partner.example:443 and code 7B9DF613D8. The alternate brand is a second fictional Integrator, "Lantern Audit".
  • New shots: access-active and access-ended (integrate.md, "Show progress and end access") and job-result (try.md). Dark twins are embedded with #gh-light-mode-only / #gh-dark-mode-only. The screenshot CSS rule no longer sets display, and the built site shows exactly one variant per theme.
  • Alt text and prose that called the shots "real Linux Companion" captures are updated. try.md notes that its shots use the integrate.md example names. docs/develop.md describes the capture workflow. The capture is not added to CI.

Verification

  • pnpm test (widget 6/6, companion 4/4) and pnpm lint. ESLint now also covers scripts/*.mjs.
  • mkdocs build --strict passes with requirements-docs.txt.
  • Every generated PNG was viewed. A Playwright smoke check covered sign-in, the offline-pending variant and the devices page under the real CSP, with no CSP violations.
  • The full Docker Compose demo and e2e.py were not run (they need the desktop keyring/SoftHSM stack).

Decisions worth a look

  • The approved page has no countdown. The Broker's status API exposes no expiry, certificate or fingerprint, so the page says the Companion shows them.
  • Revoked is shown when this page revoked the approval. A cancelled status from elsewhere reads as "withdrawn".
  • playwright is pinned to 1.65.1 at the workspace root (matching the Python fixture's 1.65 line). CHROMIUM_PATH / --browser can point it at another Chromium.

Design reference

🤖 Generated with Claude Code

sodre and others added 7 commits November 18, 2026 01:44
Sequence diagrams: Mermaid measured text with its default font while
drawing DejaVu, so labels overflowed and lifelines struck through them.
Match the measuring font, halo message labels, group steps into labelled
phase bands, drop mirrored actors and trim margins so both diagrams fit
the content column at 1:1.

All diagram colours now come from docs/assets/diagrams/palette.json.
Hand-drawn SVGs use var(--token) only, carry an in-image legend, and
scripts/render_diagrams.py writes a -dark variant of every diagram.
Pages embed both with #gh-light-mode-only/#gh-dark-mode-only, which
GitHub and the Material theme toggle both honour; the handbook CSS no
longer stretches diagrams or paints them white.

Screenshots: raw captures move to screenshots/raw/ (excluded from the
build) and scripts/annotate_screenshots.py draws callouts on the copies
the pages embed. The branding reference gets its own annotated copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The widget now draws a card with the purple Countersign band, a headline
slot and green primary button, using a constructed stylesheet so it also
applies under a strict style-src CSP. Buttons expose button/pair/connect/
push/primary parts, a paired attribute moves the primary emphasis to
Request access, and colours follow the page's color-scheme. The existing
actions/status/launch parts and --countersign-font/--countersign-accent
keep working.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The demo site becomes a fictional 'Harbor Ledger' workspace with its own
harbor-blue palette, light and dark themes and system fonts only (the CSP
stays default-src 'self'). It shows sign-in, pairing, pending (with an
offline warning), approved, ended and device pages from the backend's
existing /api data, beside the Countersign widget.

The backend serves the static map from site-files.js (shared with the
screenshot script), brands its Companion manifest as Harbor Ledger with a
logo, returns the Context details in /api/session, and adds /api/job,
which reads the last curl result that compose_demo.py now records so the
/job page can compare the fingerprint the site received.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scripts/capture_screenshots.mjs drives the real Companion renderer (with a
stubbed preload API) and the demo Integrator page (with fixture /api
responses) in Chromium at 2x with a frozen clock, writes raw captures plus
light/dark variants of the demo shots, and records the boxes of the
elements to highlight in raw/boxes.json. annotate_screenshots.py reads
those boxes instead of hard-coded coordinates. 'pnpm screenshots' runs
both.

Adds access-active, access-ended and job-result shots, embeds dark
variants with the gh-light/dark-mode-only suffixes, drops display from the
screenshot CSS rule so Material can hide the off-theme copy, and updates
alt text, the widget styling reference and the develop guide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After the user approved in the Companion, the demo page switched to
Access approved but the widget kept its Open Companion link and the
status 'Review this request in your Companion.' until a reload. Reset
the widget through its documented adapter replacement when the page
leaves the pending view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--verify approved the request and compared the Workload's fingerprint,
but never recorded job.json, so the new /api/job route, the result file
mount and the /job page went untested against the real stack. Record the
result as the interactive launcher does and confirm the page shows and
matches the fingerprint the site received.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ended view had its own "Request access again" button next to the
widget's "Request access", and both called the same connect flow. Drop
the page's copy, point the explanation at the widget, and move the
handbook callout to the widget button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same account can pair several computers with one Integrator, so a
paired widget keeps pairing available but demotes it to a secondary
link (part `link`) after Request access. Update the widget docs, test
and the screenshots that show a paired widget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sodre
sodre changed the base branch from t3/handbook-visual-review to main November 18, 2026 08:00
sodre and others added 2 commits November 18, 2026 03:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/assets/screenshots/approval-branding.png
#	docs/assets/screenshots/approval-selected.png
#	docs/assets/screenshots/approval-unselected.png
#	docs/assets/screenshots/branding-alternate.png
#	docs/assets/screenshots/pairing-browser.png
#	docs/assets/screenshots/pairing-companion.png
#	docs/assets/screenshots/raw/approval-selected.png
#	docs/assets/screenshots/raw/approval-unselected.png
#	docs/assets/screenshots/raw/branding-alternate.png
#	docs/assets/screenshots/raw/pairing-browser.png
#	docs/assets/screenshots/raw/pairing-companion.png
#	docs/assets/screenshots/raw/scope-wildcard.png
#	docs/assets/screenshots/raw/widget.png
#	docs/assets/screenshots/scope-wildcard.png
#	docs/assets/screenshots/widget.png
#	docs/develop.md
#	docs/reference/widget.md
#	scripts/annotate_screenshots.py
The Companion mockup the owner approved shows Harbor Ledger in teal
(#0f6b6b on #eef6f4; #5cc8bd on #0f1f1e in dark), but the demo site,
its logo and its branding manifest were still harbor blue. Switch all
three and recapture the screenshots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sodre added a commit that referenced this pull request Nov 18, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sodre
sodre merged commit 78c32b5 into main Nov 18, 2026
32 checks passed
sodre added a commit that referenced this pull request Nov 18, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	README.md
#	docs/assets/screenshots/approval-branding.png
#	docs/assets/screenshots/approval-selected.png
#	docs/assets/screenshots/approval-unselected.png
#	docs/assets/screenshots/branding-alternate.png
#	docs/assets/screenshots/pairing-companion.png
#	docs/assets/screenshots/raw/approval-selected.png
#	docs/assets/screenshots/raw/approval-unselected.png
#	docs/assets/screenshots/raw/boxes.json
#	docs/assets/screenshots/raw/branding-alternate.png
#	docs/assets/screenshots/raw/pairing-companion.png
#	docs/assets/screenshots/raw/scope-wildcard.png
#	docs/assets/screenshots/scope-wildcard.png
#	docs/companion.md
#	docs/develop.md
#	docs/reference/widget.md
#	docs/try.md
#	examples/demo-integrator/site-files.js
#	scripts/annotate_screenshots.py
#	scripts/capture_screenshots.mjs
sodre added a commit that referenced this pull request Nov 21, 2026
…ificate was approved (#39)

Closes #12

## Summary

An Integrator's backend can now read, from the approval status call, when a grant's approved access ends (`expires_at_ms`) and which client certificate the user approved (`certificate`: its `sha256`, the fingerprint the Companion shows, plus its subject, issuer and expiry). A new `approvals/current` call finds a Workload's current approval without creating one, and the demo Integrator uses both to count down to the deadline and check the fingerprint itself.

```diff
 POST /v1/backend/status
 {
   "id": "…", "state": "approved", "ready": true,
+  "expires_at_ms": 1795470000000,
+  "certificate": { "sha256": "c64a4b8b…f00b",
+                   "subject": "CN=Demo user", "issuer": "CN=Countersign demo client-ca",
+                   "not_after_ms": 1826000000000 },
   "upstream_mtls_accepted": true, "ingress_closed_count": 0, "egress_closed_count": 0
 }
+POST /v1/backend/approvals/current   { binding, host }  -> the same view, or 404; never creates
```

```text
status(approval)
  LEFT JOIN approved_grant            # the row outlives the approval's end
  grant row present  -> expires_at_ms, certificate {sha256[, subject, issuer, not_after_ms]}
  no grant row       -> both omitted  # pending, denied, expired/cancelled before approval,
                                      # or the grant record removed by audit retention

demo Integrator
  job.json changes (watchFile, 1 s)  -> pin approvals/current's id for that result
  GET /api/job                       -> { result, approval: status(pinned id) }
  Job page                           -> match if approval.certificate.sha256 == result.fingerprint
```

Choices the ticket left open, decided here:

- **Which states carry the fields.** Approved and replaced approvals carry them, as the ticket asks. So do `expired` and `cancelled` ones that had a grant, because the same grant row describes them.
- **`expires_at_ms` is the approved deadline**, not the effective lease deadline. `docs/reference/api.md` says that a revocation, a renewal or a Gateway lease can end access sooner, and that `state` says whether the grant is still in force.
- **The leaf's names are kept with the grant.** `approved_grant` gains `subject`, `issuer` and `not_after`, added in place on open without bumping `user_version`, so an older Broker can still open the store. A grant recorded before this change reports `{sha256}` only.
- **The names are in encoding order** (`C=US, O=…, CN=…`), as x509-parser prints them, joined with ", ". `api.md` says so.
- **`approvals/current` answers 404 for an unknown host or another Integrator's binding.** It matches the authenticated Integrator, and returns the same view `status` does.
- **CI installs Playwright's Chromium** before `pnpm test`, for the demo's new page tests.

### Extras for the owner

- **The demo Integrator follow-up: a countdown, an automatic fingerprint check, and screenshot fixtures with the new fields.** The ticket's sixth criterion, "Follow-up in the demo Integrator (#11 or later)".
  - [x] Widen #12
  - [ ] A new ticket (recommended: the ticket itself calls it a follow-up, and it is separate demo and screenshot work on top of this API)
  - [ ] Record only
  - Applied: built here after all (criterion 4 was already on #12, so nothing was added to it), reviewed in round 3
- **The optional `certificate.subject`, `issuer` and `not_after_ms`.** The ticket marks them optional: "If keeping them means persisting the chain, ship `sha256` alone first."
  - [x] Widen #12
  - [ ] A new ticket
  - [ ] Record only (recommended: the ticket makes them optional and conditional, and no consumer asks for them yet)
  - Applied: criteria added to #12, reviewed in round 3
- **The Job page compares against the approval the job ran under (round 3, Correctness #13).** The page compared against the approval the browser tab remembered, which the job's own request never gives it. No source settles it.
  - [x] Widen #12
  - [ ] A new ticket
  - [ ] Record only (recommended: the demo's main flow starts its approval from the job's own request)
  - Applied: the owner chose it in the session; criterion 5 added to #12 (`approvals/current`), reviewed in round 4
- **The approval is pinned when the job's result lands (round 4, Correctness #20).** The page looked up the current approval when it opened, not when the job ran, so a renewal in between changed what it compared. No source settles it.
  - [x] Widen #12
  - [ ] A new ticket
  - [ ] Record only (recommended: criterion 5 says "the approval the job ran under")
  - Applied: the owner chose it in the session; criterion 5's wording covers it, reviewed in round 5
- **A job result identical to the last one is not pinned again (round 5, Correctness #28 and #35).** The pin is keyed on `job.json`'s text. A mismatch run under one approval, then a renewal approving the job's certificate and a rerun, writes the same text, so the page keeps comparing against the first approval and still says the fingerprints differ. Criterion 5: "compares against the approval the job ran under". Pinning on the file's mtime as well fixes it, with a unit test for an identical rerun, plus a review round.
  - [x] Widen #12 (recommended: it is a criterion's own words, and the fix is a few lines)
  - [ ] A new ticket
  - [ ] Record only
  - Applied: built here after all (criterion 5 already covers it, so nothing was added to #12): the pin is keyed on the text and the file's mtime, reviewed in round 6

## Evidence

| Criterion | Ticked | Shown by |
|---|---|---|
| The Broker returns `expires_at_ms` and `certificate.sha256` for approvals that have a grant, and omits them for approvals that don't | yes | `status_reports_grant_expiry_and_certificate_once_a_grant_exists`; `authenticated_consent_signing_reconnect_and_revocation` (cancelled) |
| Broker tests cover approved, expired, replaced and pending approvals | yes | `status_reports_grant_expiry_and_certificate_once_a_grant_exists` |
| `docs/reference/api.md` documents the fields | yes | `docs/reference/api.md`, "Read approval status", read by the Spec reviewer in rounds 1, 3 and 4 |
| `certificate` also carries `subject`, `issuer` and `not_after_ms`, kept with the grant | yes | `status_reports_grant_expiry_and_certificate_once_a_grant_exists`; `opening_an_older_store_adds_the_leaf_columns_to_existing_grants` |
| The backend can read the current approval without creating one, so the Job page compares against the approval the job ran under | yes | `examples/demo-integrator/compose_demo.py --verify` (the wiring, live); the four `job-approval.test.js` tests (the pinning); `status_reports_grant_expiry_and_certificate_once_a_grant_exists` (the lookup) |
| Follow-up in the demo Integrator: countdown, automatic compare without the paste box, screenshot fixtures | yes | `the Access approved page counts down to the grant deadline`; `the Job result page compares the fingerprints without a paste box`; `node scripts/capture_screenshots.mjs` |

All six boxes are ticked with `tick-criteria.py`, after the ticket's section heading was renamed from `## Acceptance` to `## Acceptance criteria`.

| Test | Red | Green |
|---|---|---|
| `status_reports_grant_expiry_and_certificate_once_a_grant_exists`: pending omits the fields; approved carries them | With the handler change reverted: `service.rs:707 left: Null right: Object {"sha256": …}` | ok |
| Same test: a denied renewal carries no grant fields | Handler forced to add `certificate` for `denied`: panicked at `service.rs:786` | ok |
| Same test: an approval that expired before anyone approved it carries no grant fields | Handler forced to add `certificate` for a grant-less `expired`: panicked at `service.rs:814` | ok |
| Same test: approved deadline equals the Companion's activation deadline, in whole seconds | Handler adding 1000 ms: panicked at `service.rs:723` | ok |
| Same test: `certificate` names the leaf's subject, issuer and expiry | Before the leaf was persisted: `service.rs:732 left: {"sha256": …} right: {"issuer": "CN=Broker integration test CA", "not_after_ms": 4070908800000, "sha256": …, "subject": "CN=Broker integration test user"}` | ok |
| Same test: a grant recorded before the change reports `{sha256}` only | Handler adding `subject` for it: `service.rs:850 left: {"sha256": …, "subject": Null}` | ok |
| Same test: `approvals/current` finds the approval, and 404s without creating one | With the route removed: panicked at `service.rs:654` | ok |
| Same test: `approvals/current` refuses another Integrator's binding | With the guard removed, the query on the authenticated Integrator alone: `service.rs:803 left: 200 right: 404` | ok |
| `authenticated_consent_signing_reconnect_and_revocation`: a cancelled approval keeps its grant's values | With the handler change reverted: panicked at `service.rs:467` | ok |
| `opening_an_older_store_adds_the_leaf_columns_to_existing_grants` | Before the in-place `ALTER`: panicked at `approvals.rs:489` | ok |
| `the Access approved page counts down to the grant deadline` | Before the countdown: `waiting for locator('#access-ends').getByText('14:30 left')`, timeout | ok |
| `the Job result page compares the fingerprints without a paste box` | Before the automatic compare: `waiting for locator('#match') to be visible`, timeout | ok |
| `the Job result page says when the job has no approved certificate to compare` | Before `#no-compare` existed: failed with a timeout | ok |
| `a job keeps the approval that was current when its result landed`; `a job read before anything noticed it pins the approval current at that read` | With pinning disabled (every read looks up the current approval): `actual: 'B'` | ok |
| `no job, or a Broker that could not answer, leaves nothing pinned for good` | Red only as `ERR_MODULE_NOT_FOUND` before `job-approval.js` existed | ok |
| `a rerun that writes the same result again pins the approval current then` | With the pin keyed on the text alone: `actual: 'A', expected: 'B'` | ok |
| `the image copies every local module the servers import` | Against the Dockerfile before 17a55a6: `+ actual: ['job-approval.js']`; the live run had exited with the integrator container `exited (1)`, and `node -e "import('./job-approval.js')"` in that image printed `ERR_MODULE_NOT_FOUND` | ok |

On 81c52af (17a55a6 changes only the demo's Dockerfile and a test): `cargo test -p countersign-broker`: lib 6, approvals 8, service 4 passed; 0 skipped, 0 failed. `cargo clippy -p countersign-broker --all-targets -- -D warnings` and `cargo fmt --all --check` are clean. `pnpm test` in `examples/demo-integrator` on 17a55a6: 8 passed, 0 skipped, 0 failed; `pnpm lint` is clean. `node scripts/capture_screenshots.mjs` re-rendered `access-active` (light and dark) and `job-result`: the first shows "59:30 left · until …" under the grant row, the second the job's fingerprint beside the approved certificate's, with "Same SHA-256" shown. The Companion formats the fingerprint as lowercase hex (`packages/companion/src/main.js:120`), so the docs' "without its spaces" holds.

`xvfb-run -a .venv/bin/python examples/demo-integrator/compose_demo.py --app packages/companion/dist/linux-arm64-unpacked/countersign-companion --verify` on 17a55a6, with a Companion built from this branch: exit 0, printing `Compose mTLS accepted selected SHA-256 99f4b3e3…5c09` and `Job page matched the fingerprint the site received with the approval`. It paired, approved, ran the job's `curl` through the Gateway (the job's own request started the approval), and opened `/job`, which showed `#job-approved` with the fingerprint and `#match`.

Not run: the Gateway runtime test and the Companion and widget suites, because nothing they cover changed.

## Merge Danger

**Door:** two-way. A revert removes the response fields, the `approvals/current` route and the demo changes. The three `approved_grant` columns stay in any store this Broker opened; the older Broker ignores them.

**Blast Radius:** Integrator backends that read approval status; the demo Integrator.

The merge ships a Broker whose status response has more fields, a new backend route, and an in-place column migration on open (no `user_version` bump). CI gains a Playwright Chromium install step. No flag.

## Reviews

<details>
<summary>Correctness, Standards, Spec and Security, seven rounds: 36 findings, each with its outcome</summary>

**Correctness, round 1**

1. The retention purge deletes `approved_grant` while the approval row can survive, so the fields vanish against the docs' promise. Fixed: `docs/reference/api.md` says the fields are absent once audit retention removes an ended approval's grant record.
2. The docs said every `expired` or `cancelled` approval keeps the fields, but one that ended before a grant has none. Fixed: the docs list those cases as absent.
3. "Access ends then unless a renewal replaces the grant first" was wrong for revocation and certificate revocation. Fixed: the docs say a revocation, a renewal or a Gateway lease can end access sooner, and `state` says whether the grant is still in force.
4. `expires_at_ms` is not the effective lease deadline. Fixed: the docs call it the deadline the user approved; the value stays the grant's deadline, as the ticket asks.
5. The test tolerated 999 ms between the status deadline and the activation deadline. Fixed: it asserts exact equality.
6. No test covered an approval that expired with no grant. Fixed: the test lets a renewal's offer lapse and checks that both fields are absent.
7. The new `approve`/`status` helpers repeat the older revocation test's inline flow. Pushed back: that test fetches by the admit body and runs lease and sign steps between those calls, so moving it onto the helpers is churn outside this ticket.

**Standards, round 1**

8. The test repeats the post-and-decode chain and the renew call. Pushed back: it matches the inline style of every other test in `service.rs`.
9. The query row is a positional 7-tuple. Pushed back: it extends the handler's existing tuple; a struct for one call site adds nothing.
10. The `certificate` binding holds a digest. Fixed: renamed to `certificate_sha256`.
11. The `approve` helper takes a bare `renewal: bool`. Pushed back: two call sites, and the doc comment says what it does.
12. The local `ended` holds seconds, while another test's `ended` holds a state. Fixed: renamed to `expired_at_s`.

**Spec, round 1:** no findings. **Security, round 1:** no findings.

**Correctness, Standards, Spec and Security, round 2** (fixes since f28a87e, pinned df4be77): no findings.

**Correctness, round 3** (the two widenings, df4be77..9eb4f81)

13. The Job page compares against the approval the tab remembers, which the job's own request never gives it, so it shows nothing to compare, or the wrong approval after a renewal. Fixed: widened #12 on the owner's choice; `approvals/current` finds the job's approval (criterion 5), reviewed in round 4. The same round found `compose_demo.py --verify` still filling the removed paste box; fixed to expect `#job-approved` and `#match`.
14. The wording when no approval is tracked. Fixed: `#no-compare` says to approve the request in the Companion and run the job again.
15. The countdown trusts the browser's clock. Pushed back: it is advisory, and the page re-reads the Broker's state every 5 s.
16. A local variable shadows `show`. Fixed: renamed.
17. The page test duplicates the screenshot script's page server. Pushed back: sharing it would tie the test to a docs script CI does not run.
18. Two copies of one fingerprint comparison. Fixed: one `same` computed once.
19. The docs implied RFC 4514 order for `subject` and `issuer`. Fixed: `api.md` says encoding order, joined with ", ".

**Standards, Spec and Security, round 3:** no findings; Spec judged both added criteria met.

**Correctness, round 4** (9eb4f81..d515e6c)

20. The page looks up the current approval when it opens, not when the job ran, so a renewal in between changes what it compares. Fixed: widened #12 on the owner's choice; the Integrator pins the approval when the job's result lands (`job-approval.js`), reviewed in round 5.
21. `approvals/current` checks no permit, and answers 404 where `status` might answer 403. Pushed back: the endpoint takes the backend bearer token like `status`, and 404 for "no current approval" is what the demo and docs rely on.
22. `/api/job` fails outright when the Broker errors. Fixed: a failed lookup gives `approval: null`.
23. An unknown host answers 404 rather than an error naming the host. Pushed back: the host comes from the Integrator's own configuration, and 404 tells the caller no approval exists, which is true.
24. The lookup repeats the approval view's query. Pushed back: both call one `view`; the lookup's own query selects only the ID.
25. The lookup filtered on the caller's Integrator rather than the authenticated one. Fixed: it binds `a.integrator` and refuses a binding for another Integrator (red: `service.rs:803 left: 200 right: 404`).
26. `/api/job` awaits the job file and then the Broker, one after the other. Pushed back: the second needs the first's result to decide whether to pin.
27. The interval's updater is named `tick` like the field that holds it. Pushed back: `page.tick` holds the handle of `tick`, and the pair reads as one thing.

**Standards, Spec and Security, round 4:** no findings; Spec judged criterion 5 met.

**Correctness, round 5** (d515e6c..99dabc2, pinned 99dabc2)

28. A job result whose text equals the last one is never pinned again, so a rerun under a renewal keeps the earlier approval. Fixed: widened #12 on the owner's tick; the pin is keyed on the text and the file's mtime, reviewed in round 6.
29. A failed or absent pin falls back to the approval current at the next read, and a restart loses every pin. Pushed back: the fallback is the documented, tested behaviour (`no job, or a Broker that could not answer, leaves nothing pinned for good`), and the demo keeps all its state in memory by design.
30. The file watcher polls every second, so a read can race the pin. Pushed back: it takes a renewal approved within a second of the job's result landing; `forJob` pins at that read in any case.
31. Two concurrent `pin()` calls are not serialised. Pushed back: both store the same text with the ID the Broker returned milliseconds apart; the last write wins with the same answer.
32. No negative caching while the pinned ID is null. Pushed back: retrying the lookup on the next read is the intended behaviour, and its test asserts it.
33. No test for the Integrator-mismatch guard. Pushed back: the stranger binding in `status_reports_grant_expiry_and_certificate_once_a_grant_exists` (`service.rs:801`) covers it, and it was red with the guard removed.
34. The Integrator is enforced twice, by the guard and the query. Pushed back: the query alone answered 200 for a stranger binding (finding 25's red); the guard is what refuses it.
35. No test for an identical rerun after a renewal. Fixed: `a rerun that writes the same result again pins the approval current then`.
36. No tests for a lookup failure followed by a renewal, or for a restart. Pushed back: both are finding 29's documented fallback.

**Standards, Spec and Security, round 5:** no findings; Spec judged criterion 5 met, wanting evidence from `compose_demo.py --verify`.

**Correctness, Standards, Spec and Security, round 6** (the fix for 28 and 35, 99dabc2..81c52af, pinned 81c52af): no findings. Spec wants evidence from `compose_demo.py --verify`.

**Correctness, Standards, Spec and Security, round 7** (81c52af..17a55a6: the image left out `job-approval.js`, found by the compose run, not by a review): no findings. Spec judged criterion 5 shown by the passing compose run. Security was read in the session: the diff copies one module into the image and adds a test.

</details>

## Tracking

Epic: none
Spec: none
Ticket: #12 Return grant expiry and approved certificate in the approval status response
Flag: none

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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