Commit Graph
3 Commits
Author SHA1 Message Date
CatoandClaude Opus 5.5 06cf743de9 feat(browser): fill forms on the phone too — Loki for Firefox and one /fill page (#1156)
* wip(browser): Loki for Firefox + /fill page (validation in progress)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BWXjqiHm8jFta4FXuc7Tck

* fix(fill): long values wrap under their label on a 320px phone

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BWXjqiHm8jFta4FXuc7Tck

* style: prettier on the extension test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BWXjqiHm8jFta4FXuc7Tck

* fix(demo): /api/browser-task is denied in the demo sandbox — it reaches the owner's machine

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BWXjqiHm8jFta4FXuc7Tck

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-11 16:32:05 -07:00
CatoandClaude 0096d86a4c feat(ship): done means seen — ship reports, and Loki records how Build next is used (#1150)
"Build next" (#1141) was reported to the operator as a merge notice: merged
at 21:14, "should go live on its own", "I haven't confirmed that, or tried
the screen in a browser myself", open /loki and tap a chip. Read on a phone.
No link, no picture, no statement of what was checked — every rule this
repo already states ("confirm the commit is LIVE, not just merged"; the
fleet brief's "done means merged, deployed and checked live") skipped,
because checking took tooling nobody had wired together.

Ship report (`pnpm run ship:report -- /route --focus '<selector>'`):
- confirms the running site's build commit contains the shipped one
  (/api/health `commit`, with `--wait` to sit out the deploy), never a guess
  from a timestamp
- screenshots the real deployed page at 390 and 1440, crops the built
  section, counts console errors and 5xx during load
- writes REPORT.md: live URL first, screenshots, what was and was NOT
  checked; exits non-zero while the build is not live or the section is
  missing
- session auth shared with the responsive audit in
  scripts/test/lib/session-cookie.mjs (extracted, not duplicated)

The contract — docs/development/ship-report.md — keeps the message it
replaces, and the fleet brief now tells every dispatched agent to report
the live URL first, a screenshot, and what was verified.

After it ships, Loki watches whether it is used: operator_usage_events
records each show, tap and rotate of Build next (surfaces and actions SSOT
in src/config/usage-surfaces.ts; /api/usage refuses anything else; target
is an id, never prose). A pure summariser turns the rows into one line per
surface — shown, tapped, kinds offered and never taken — and a `usage`
retrieval source hands it to Loki: "how am I using Build next?" leads with
it, and every "what should I build?" reads it before recommending, with a
prompt line to say when a surface is shown and never used and propose the
one change.

Tests: scripts/test/usage-summary.ts (registry refuses unlisted pairs,
never-shown surface reported, window honoured, planner leads with usage
when asked about use); retrieval-plan, telemetry-freshness, fleet-brief and
account-deletion gates extended or passing as-is.


Claude-Session: https://claude.ai/code/session_016T1Vm7uYyhpgUxbD3xXro9

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-11 15:21:48 -07:00
0ffe305a62 fix(api): a second route shipped the user's credential hashes — and the gate that ends the class (#309)
* fix(api): a second route was shipping the user's credential hashes

POST /api/onboarding returned the whole users row — `{ ok: true, user }` —
so passwordHash and privateZonePinHash went to the browser on every
onboarding finish, exactly as GET /api/me did before #306. The client never
read that object; it checks `res.ok` and nothing else.

It survived the grep that found #306 only because it was nested one level
deeper (`json({ ok: true, user })`, not `json(user)`). That is the second
instance of one class, so this stops being something to grep for:

- scripts/test/no-raw-user-response.ts scans every route handler and server
  action, taints identifiers bound to a whole users row, and fails if one
  reaches a response call unprojected. Negative-tested against the real
  pre-fix source — it flags both branches — plus 13 fixtures covering the
  nested, shorthand and spread forms.

And the export had grown a second answer to the same question:

- src/lib/account-export.ts kept its own REDACTED_USER_FIELDS deny-list, so
  a secret column added later would be withheld by /api/me (allow-list) and
  shipped by /api/me/export (deny-list that never heard of it). Both now
  project through user-client-view.ts, which is exhaustive over the schema.
  The export additionally omits Stripe ids — a policy narrowing of the
  allow-list, not a second notion of what is secret.
- buildExportManifest generates its `excluded` lines from those same lists,
  so the document describing what was withheld cannot drift from what was,
  and the test asserts the linkage rather than a copy of the wording.

Verified: tsc clean, eslint 0 errors, 88/88 unit files, design-system ok.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(ci): the deploy-ref fixtures inherited a handle to the real repo

The husky pre-push hook exports GIT_DIR — for a worktree push that is
.git/worktrees/<name>, the real repository. scripts/test/deploy-ref-gate.sh
runs from that hook, so every git call in the fixture suite inherited it.

An explicit GIT_DIR is not a search path, so GIT_CEILING_DIRECTORIES (guard 1)
did not constrain it, and the g() assertion (guard 2) could not see it either:
with GIT_DIR set and no work tree, `git -C <fixture> rev-parse --show-toplevel`
answers `<fixture>` — matching exactly, while objects and refs land in the real
repo. The suite this file was written to make safe was, from a hook, pointed
back at the thing it must never touch.

Guard 5 ($TMP must not be inside a repo) is what actually held the line, and it
held it by failing closed: with GIT_DIR set, an empty mktemp dir reads as a repo
root, so every push from a worktree died with "temp dir is inside a git repo" —
a true refusal with a misleading reason, and no way to push at all.

Now the ambient git environment is cleared first, from `git rev-parse
--local-env-vars` so it cannot fall behind a new variable. Test 9 re-runs the
whole suite with GIT_DIR pointing at a decoy repo and asserts both that it
passes and that the decoy is unchanged.

Verified to bite: with the unset removed, test 9 fails and the child run dies at
guard 5 exactly as the real push did.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* refactor(ci): one definition of an isolated git fixture

not-behind-gate.sh has the same inherited-GIT_DIR hole the previous commit
fixed in deploy-ref-gate.sh — and found it itself: run from the pre-push hook,
its own isolation probe reported "g() accepted a non-repo dir nested in a repo
— it would have mutated the ENCLOSING repo". Correct, and it was right.

Fixing it in place would have been the third copy of the same paragraph. The
copies are the hazard: both suites carry scars from 2026-08-15, each was
hardened against what its own incident taught it, and neither against the
other's — deploy-ref-gate knew $TMP must not sit inside a repo, not-behind-gate
knew a fixture must never write git config. A third suite would have copied
whichever file it sat next to.

So the four properties that must hold before a fixture touches git now live in
scripts/test/lib/git-fixture-env.sh, sourced by both. Each suite keeps its own
g() — the per-command assertion that the directory about to be mutated is the
fixture — because their fixture shapes genuinely differ.

Verified under the real hook environment (GIT_DIR=.git/worktrees/<name>):
deploy-ref-gate 9 passed, not-behind-gate 15 passed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: t <t@t.t>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 09:41:51 +00:00