Skip to content

feat(auth): tokens live in state.db on both daemon kinds - #784

Merged
V3RON merged 10 commits into
task/757from
task/758
Oct 20, 2026
Merged

V3RON merged 10 commits into
task/757from
task/758

Conversation

@V3RON

@V3RON V3RON commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Closes #758

Status

Implement: done (5/5, audit probed 22/22) Review: round 2 passed Hardware: n/a Gate: waiting for the stack
Next: stack sync onto #783 once #775's CI fix lands

Done when

  • pnpm test:changed passes.
  • pnpm test:e2e e2e/token-route.test.ts e2e/http-api.test.ts passes.
  • rg -n "tokens\.json" src docs --glob '!docs/internal/adr/**' finds only the old-file lists, their tests and the docs/CLI.md upgrade section.

Assumptions

  • Assumption: the transaction helper F13 names was not in src/ports/sqlite.ts — I moved inTransaction there from src/state/open.ts (state imports it back), the smallest way for src/auth to use it without importing state.
  • Assumption: a worker with only a tokens.json gets the worker's existing upgrade step word for word, as the spec says — I added no token-specific step to it.

Review

Spec review: 0 blocking, 0 fixed, 0 notes. Code review: 1 blocking, 1 fixed, 0 notes. Claims review: 1 blocking, 1 fixed, 0 notes.
Rounds: 2. Tokens: 17.5M.
Runs: 9. Cost USD: 3.8042. Agent seconds: 2546.
Assessment: complete

Written by an agent.

@V3RON

V3RON commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

Review ledger

Runs: 9. Cost USD: 3.8042. Agent seconds: 2546.
Tokens input 370, output 81775, cache read 10753357, cache write 530836.
- build implementer: claude-sonnet-5-5 1170 s $1.3027
- audit implementer: claude-sonnet-5-5 451 s $0.3906
- fix implementer: claude-sonnet-5-5 73 s $0.0913
- review 1 reviewer: claude-sonnet-5-5 306 s $0.1394
- review 1 spec: claude-sonnet-5-5 44 s $0.257
- review 1 code both: claude-opus-5-5 243 s $1.1664
- review 1 claims: claude-sonnet-5-5 77 s $0.229
- fix 1 implementer: claude-sonnet-5-5 89 s $0.1181
- review 2 reviewer: claude-sonnet-5-5 93 s $0.1097
Finding outcomes: {"fixed":2}. Classes: {"stale claim in module manual":1,"testing 1, 10":1}.
{"findings":[
{"id":"R1","role":"code","class":"testing 1, 10","outcome":"fixed","path":"src/daemon/main.test.ts","fix":"83c8002399daf50601c3c9f6a2e1049e335542b3"},
{"id":"R2","role":"claims","class":"stale claim in module manual","outcome":"fixed","path":"src/daemon/AGENTS.md","fix":"83c8002399daf50601c3c9f6a2e1049e335542b3"}
]}

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review October 20, 2026 16:51
@V3RON
V3RON changed the base branch from task/761 to task/757 October 20, 2026 16:51
@V3RON
V3RON added this pull request to stack #782 October 20, 2026 16:51
@V3RON
V3RON merged commit fb86b85 into main Oct 20, 2026
35 of 37 checks passed
@V3RON
V3RON deleted the task/758 branch October 20, 2026 18:19
V3RON added a commit that referenced this pull request Oct 20, 2026
…art (#785)

Closes #760

### Status
Implement: done (7/7, audit probed 7/7) Review: round 2 passed Hardware:
n/a Gate: waiting for the stack
Next: stack sync onto #784

## Done when

- [x] `pnpm test:changed` passes.
- [x] `pnpm test:e2e e2e/start-refusal.test.ts` passes.
- [x] `docs/CLI.md:148`'s row says the daemon's start error is shown
when it exits during start.

## Assumptions

none

## Review

Spec review: 0 blocking, 0 fixed, 0 notes. Code review: 2 blocking, 2
fixed, 1 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 2. Tokens: 19.9M.
Runs: 10. Cost USD: 3.2391. Agent seconds: 2318.
Assessment: complete

*Written by an agent.*
V3RON added a commit that referenced this pull request Oct 20, 2026
Closes #759

### Status

Implement: done (4/4, audit probed 4/4) Review: round 1 + fix-check
passed Hardware: n/a Gate: waiting for the stack
Next: gate the stack (#755 → #775 → #783 → #784 → #785 → #786)

## Done when

- [x] `pnpm test:changed` passes.
- [x] `rg -n "workers\.json" src docs --glob '!docs/internal/adr/**'`
finds only the gateway's old-file list, its test and the `docs/CLI.md`
upgrade section.

## Feature completion (#754)

- [x] A worker restarted with fake drivers keeps devices, leases,
requests, components and tokens: restart tests in #775
(`src/daemon/main.test.ts`), real tables in #783, tokens in #784.
- [x] A gateway restarted keeps tokens and drains: #784 (join token
across restart) and the e2e restart test here.
- [x] A renew changes one row with 1,000 requests stored: test in #775.
- [x] Refusals for each old file, a damaged or newer `state.db`, printed
by `simlock status` at once with exit 1: #775, #784, this PR, and #785's
e2e (`e2e/start-refusal.test.ts`).
- [x] `docs/CLI.md` upgrade and downgrade steps, no live JSON file
named: #775's section plus each PR's `rg` Done when line.

## Assumptions

none

## Review

Spec review: 0 blocking, 0 fixed, 0 notes. Code review: 2 blocking, 2
fixed, 0 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 1. Tokens: 20.4M.
Runs: 9. Cost USD: 2.3576. Agent seconds: 1557.
Assessment: complete

*Written by an agent.*
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.

Tokens live in state.db on both daemon kinds

1 participant