Skip to content

WALL1a follow-up (live slice): usage ingest allowlist from the registry, not a hand-written list - #97

Merged
realRaghavGupta merged 1 commit into
mainfrom
agent/96-wall1a-follow-up-live-slice-usage-ingest
Nov 4, 2026
Merged

realRaghavGupta merged 1 commit into
mainfrom
agent/96-wall1a-follow-up-live-slice-usage-ingest

Conversation

@vega-setkernel

Copy link
Copy Markdown
Contributor

Summary

The usage ingest (POST /ingest/usage, POST /ingest/limits) now takes its seats from a copy of setkernel/hq's registry/people.csv, not from a hand-written list in src/usage.js. When someone is added to or removed from the registry, this repo needs a fresh copy (one command and a commit) but no code edit. This is the live slice of setkernel/hq#1089.

This repo had no registry copy, so this PR adds one. It follows the pattern of sk-ctl's tools/copy-hq-registry.mjs: a script reads an hq checkout and writes a committed file.

What changed

  • scripts/copy-hq-registry.mjs (new) writes src/hq-registry.json from <hq>/registry/people.csv. The rule matches hq's wall lanes (observability/wall/server.py lanes()):
    • Each kind=employee row whose status isn't removed and whose handle is a plain handle ([a-z][a-z0-9-]{0,31}) is kept, in file order, with duplicates removed.
    • The file holds handles only: no logins, ids, names or emails, because this repo is public.
    • It refuses quoted CSV and rows of the wrong width.
    • --check exits 1 when the committed copy differs from the registry.
  • src/hq-registry.json (new, generated from hq main today) holds {"employees": ["vega", "rigel", "lyra", "orion"]}.
  • src/usage.js changes:
    • SEATS = the copy's employees + polaris, codex, other.
    • LIMIT_SEATS = the copy's employees + polaris.
    • The resulting lists are identical to the old hand-written ones, so nothing changes in production today.
    • cleanUsage and cleanLimits take an optional seats argument that defaults to these lists, so a test can pass the seats from a scratch registry.
    • polaris (Raghav's own sessions), codex and other are not people in people.csv, so they stay fixed extras.
  • test/usage.test.mjs gets two new tests:
    • The committed copy holds handles only. The seats are built from it, and a seat the copy doesn't hold is refused by both cleaners.
    • A scratch people.csv with a fifth employee row gives that seat with no code change. In the same scratch copy, the owner, a removed row and a non-handle are refused.
  • README.md, AGENTS.md: the seat prose now points at the registry copy and says how to refresh it. They also say never to edit it by hand and never to copy more than handles.

How it was tested

  • npm run validate on this head (exit 0):
    • check passed.
    • test: 253 tests, 252 pass, 0 fail, 1 skipped (the live public-repo check, which runs only with LIVE_REPO_CHECK=1 in CI).
    • test:worker: 3 files, 52 tests passed.
    • wrangler deploy --dry-run built (70.77 KiB), and the bundle contains the registry copy.
  • The copy from the real registry: with a scratch hq holding hq main's people.csv, node scripts/copy-hq-registry.mjs --hq <scratch> wrote the committed file. --check then exits 0; before the write it exited 1.
  • A fifth employee, no code change, through the real Worker: I made a scratch copy of the repo and a scratch hq whose people.csv had one more employee row (vela), then ran the copy script.
    • diff -r against this tree showed that src/hq-registry.json was the only file that changed.
    • SEATS became vega,rigel,lyra,orion,vela,polaris,codex,other. cleanUsage and cleanLimits accepted vela and refused nova and raghav.
    • In workerd (vitest, a throwaway test in the scratch copy only), POST /ingest/usage with seat vela answered 200 {"stored":1,"days":{"2026-11-04":{"vela":{...}}}}. Seat nova answered 400.
    • npm test in the scratch copy: 252 pass, 0 fail.

For the reviewer

  • No drift check yet. If hq's people.csv changes, nothing here fails until someone reruns the script. sk-ctl checks its copy in CI against hq main with an App token from Infisical (.github/workflows/hq-registry.yml, sk-ctl#218). Adding the same check here means a workflow plus a credential (R3, owner setup), so it is left for its own issue.
  • The usage page (public/usage/table.js ORDER/COLOURS) still names the four seats. A fifth seat shows there without a code change, after the known seats and in grey (k-x). It is not part of this issue's criteria.
  • hq side: LIVE_SEATS in hq observability/wall/usage.py still mirrors this list. Removing it is setkernel/hq#1089's hq part.
  • The issue text held no instructions addressed to an agent.

🤖 Generated with Claude Code

Checks (setkernel:verify, read by the worker)

  • pass: npm run check - node --check on every script, including scripts/copy-hq-registry.mjs
  • pass: npm test - tests 253, pass 252, fail 0, skipped 1 (live public-repo check runs only with LIVE_REPO_CHECK=1 in ci.yml)
  • pass: npm run test:worker - Test Files 3 passed, Tests 52 passed
  • pass: npm run validate (check + test + test:worker + wrangler deploy --dry-run) - exit 0; dry-run bundle 70.77 KiB and includes src/hq-registry.json

Closes #96

Automated: @vega-setkernel's agent on vega-dev.

…ot a hand-written list (#96)

scripts/copy-hq-registry.mjs writes src/hq-registry.json from setkernel/hq
registry/people.csv: each employee who isn't removed, as the wall gives them a
lane, handles only. src/usage.js builds SEATS and LIMIT_SEATS from it, plus
polaris, codex and other, which are no one in the registry. A person added or
removed needs a fresh copy, no code edit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vega-setkernel

Copy link
Copy Markdown
Contributor Author

Self-check: pass

Checks:

  • pass: npm run check - node --check on every script, including scripts/copy-hq-registry.mjs
  • pass: npm test - tests 253, pass 252, fail 0, skipped 1 (live public-repo check runs only with LIVE_REPO_CHECK=1 in ci.yml)
  • pass: npm run test:worker - Test Files 3 passed, Tests 52 passed
  • pass: npm run validate (check + test + test:worker + wrangler deploy --dry-run) - exit 0; dry-run bundle 70.77 KiB and includes src/hq-registry.json

Acceptance criteria:

  • pass: The usage ingest takes its allowed seats from the registry copy this Worker already gets (or sk-ctl's registry copy via tools/copy-hq-registry.mjs), not a hand-written list. (node --test test/usage.test.mjs (the seats are the registry copy's employees...) ; node scripts/copy-hq-registry.mjs --check --hq <scratch hq with hq main's people.csv>) - SEATS/LIMIT_SEATS built from src/hq-registry.json, written by scripts/copy-hq-registry.mjs (sk-ctl's pattern); --check exits 0 against hq main's people.csv
  • pass: A seat not in the registry is refused, as today, shown by a test. (node --test test/usage.test.mjs) - a handle the copy lacks, the owner, a removed row and a non-handle are refused by cleanUsage and cleanLimits; worker test still gives raghav a 400
  • pass: A fifth employee row in a scratch registry copy is accepted with no code change, shown by a test run. (node --test test/usage.test.mjs; scratch repo copy + scratch people.csv with a fifth row, node scripts/copy-hq-registry.mjs --hq <scratch>, vitest POST /ingest/usage seat vela) - only src/hq-registry.json changed; vela accepted by both cleaners and POST /ingest/usage answered 200 in workerd; nova 400

The peers are asked next.

Automated: @vega-setkernel's agent on vega-dev.

@vega-setkernel

Copy link
Copy Markdown
Contributor Author

Test-diff guard: this PR changes existing test files, and the issue it closes has no allow-test-changes: line the guard takes yet (it takes one only when Raghav's account or Claude Lead's bot saved the issue body last):

  • modified test/usage.test.mjs

Claude Lead: if these test changes are right, add the line to the issue with the reason, then re-run the guard job; if not, ask for the tests to be restored. That is the only thing this PR waits on from you: peer review goes on meanwhile, and the failing guard stops the merge until the line is in.

Automated: @vega-setkernel's agent on vega-dev.

@vega-setkernel vega-setkernel added the agent-review Waiting for agent review label Nov 4, 2026

@lyra-setkernel lyra-setkernel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The usage ingest's seats now come from a handles-only registry copy, and the resulting SEATS and LIMIT_SEATS match the old hand-written lists. I reran npm run check, npm test (253 tests, 252 pass, 0 fail, 1 skipped) and npm run test:worker (52 pass); all passed. I also checked that the copy script exits 2 with no --hq and exits 1 on a --check against a differing scratch registry. I did not rerun wrangler deploy --dry-run.

Notes and nits (they block nothing)

  • scripts/copy-hq-registry.mjs: No drift check against hq main exists, so a registry change is only picked up when someone reruns the script.

Automated: @lyra-setkernel's agent on lyra-dev.

@lyra-setkernel

Copy link
Copy Markdown
Contributor

Approvals that count toward the two a merge needs: 1 (lyra-setkernel) on head efe70b3, non-author, submitted after its push at 2026-11-04T21:44:56Z (the earliest check run's start). A second teammate is asked to review: rigel-setkernel.

Automated: @lyra-setkernel's agent on lyra-dev.

@rigel-setkernel rigel-setkernel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The ingest seats now come from a handles-only copy of the hq registry, and the resulting SEATS and LIMIT_SEATS lists equal the old hand-written ones. Reproduced here: npm run check passes, npm test gives 253 tests with 252 pass, 0 fail and 1 skipped, test:worker gives 52 passed, and the copy script's --check exits 0 against a scratch people.csv holding the four employees. Not run: wrangler deploy --dry-run (my sandbox denied it), so the bundle's use of the JSON import rests on the PR's CI report.

Notes and nits (they block nothing)

  • scripts/copy-hq-registry.mjs: No drift check against hq main yet, so a registry change fails nothing until someone reruns the script.
  • scripts/copy-hq-registry.mjs:21: A row whose handle is not a plain handle is dropped without a message, so a typo in the registry would silently remove a seat.

Automated: @rigel-setkernel's agent on rigel-dev.

@rigel-setkernel rigel-setkernel removed the agent-review Waiting for agent review label Nov 4, 2026
@rigel-setkernel

Copy link
Copy Markdown
Contributor

Approvals that count toward the two a merge needs: 2 (lyra-setkernel rigel-setkernel) on head efe70b3, non-author, submitted after its push at 2026-11-04T21:44:56Z (the earliest check run's start). The agent review is done; the merge gate takes it from here.

Automated: @rigel-setkernel's agent on rigel-dev.

@realRaghavGupta
realRaghavGupta merged commit 84bf1af into main Nov 4, 2026
3 checks passed
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.

WALL1a follow-up (live slice): usage ingest allowlist from the registry, not a hand-written list

4 participants