Keeps the prompt as the handoff artefact it was written to be, since task 2 (all of crdt-sync/tool/ at 100% branch coverage) may outlast a session and the file is what stops the next one redoing finished work. Not deleted, per its own instruction to strike through instead of removing while any task is open. The finished sections are rewritten rather than merely struck through, because the prompt's diagnosis was wrong in two places and a future reader would inherit the error: web-ui-tests was failing on a trailing newline that tsc does not emit (not a stale dist/), masked locally by tsc -b's incremental cache; and README.md still holds the per-stack design-system patterns -- what moved out was the operability and screen-size material. Also records what the ~/utils working tree cannot show: tasks 3 and 4 edited ~/.claude, committed there as e0cf24a. And notes finish.sh at 309 lines as an open finding outside the four tasks -- it blocks nothing today, since the hook gates staged files only. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CFSGeWxHPY5rHUGrPqhcmG
8.6 KiB
This file is a ready-to-use prompt. Open this repo (
~/utils) and say "do post-250-cap-cleanup". It is self-contained -- it needs no context from any other session.Generated 2026-08-22 at the end of the session that finished
refactor_claude_todo.md(the 250-line cap). Everything below was measured in that session; re-verify each figure before trusting it, since the numbers are a snapshot.
⛔ WHEN YOU FINISH THIS PROMPT
Delete this file and commit that deletion together with the work:
git rm prompts/post-250-cap-cleanup.md
A finished prompt left in the repo is indistinguishable from a pending one, and the next session will re-run it. If you complete only some of the four tasks, do not delete it -- strike through the finished ones instead and leave the rest.
Current state: only Task 2 is left. Delete this file once tool/ is
covered and the config flip has landed -- not before.
Context
The 250-line file cap is done and enforced: bash scripts/check_file_length.sh --all exits 0, a pre-commit hook blocks an
over-cap commit, and .github/workflows/file-length.yml runs the same check
on push. Do not undo any of that. Every new file this prompt creates must
also stay at or under 250 lines -- the hook will block your commit otherwise,
which is the point.
Four loose ends were deliberately left. Three are now done (1, 3 and 4 -- see the struck-through sections, which record what was actually found; the prompt's original diagnosis was wrong for both 1 and 4). Only Task 2 remains.
Task 1 -- make web-ui-tests green -- DONE (53f2816)
web-ui-tests greenThe diagnosis above was wrong, so it is replaced rather than struck through.
dist/ had not drifted: all 16 files were byte-identical to a fresh build
except for a trailing newline that tsc does not emit.
At 03bf1ed the subproject config had no exclude, so pre-commit's
end-of-file-fixer appended a newline to each generated file. eaa5683 added
exclude: ^web_ui/dist/ so it would not recur, but never reverted the
newlines already committed -- leaving a dist/ that no pnpm build could
reproduce, and a job that could never pass.
It looked fine locally because tsc -b is incremental: with a warm
tsconfig.tsbuildinfo it skips emit entirely, so pnpm build was a no-op and
showed no diff. CI has no cache, always emits, always failed. To reproduce
locally, delete web_ui/tsconfig.tsbuildinfo first -- otherwise you are
testing nothing.
Fixed by committing the real tsc output. Verified green on CI (run
32578353684), pnpm lint clean, pnpm coverage 84 tests / 100%.
Task 2 -- put crdt-sync/tool/ under test at 100% coverage
Read this scope note before starting; it is bigger than it first looks.
crdt-sync/pyproject.toml measures --cov=crdt_sync with
source = ["crdt_sync"], so the whole tool/ package is currently
unmeasured. The trigger for this task was tool/_oauth_callback.py (105
lines, extracted during the cap work, whose _start_callback_server runtime
path is unexercised) -- but adding tool to the coverage source pulls in
seven modules, ~1350 lines, none of which have tests today:
| lines | file |
|---|---|
| 250 | tool/seed_session.py |
| 243 | tool/link_google.py |
| 233 | tool/google_id_token.py |
| 216 | tool/migrate_github_to_firebase.py |
| 212 | tool/preflight_firebase.py |
| 105 | tool/_oauth_callback.py |
| 89 | tool/interop_seed.py |
| 6 | tool/__init__.py |
The bar in this repo is 100% branch coverage, and omitting packages from
coverage is forbidden (~/.claude/memories/code-quality.md: "NEVER omit
packages from coverage. Write tests for everything." and "even if it takes
hours"). So the honest shape of this task is: test all of tool/, not just
the one file.
Suggested order -- land each as its own commit so partial progress is useful:
_oauth_callback.pyfirst. It is the reason this task exists and the only one with no network dependency:_free_portbinds a real socket,_CallbackHandlercan be driven with a fake request, and_start_callback_servercan be exercised againsthttp.clienton the port it picks. Do this one even if you do nothing else.google_id_token.py--fetch_id_tokenis arequestscall; mock at the session boundary the waycrdt_sync/tests/test_firebase_auth.pyalready does.main()is argparse; test it viamain(["--client-id", ...]).- The rest, largest-payoff first.
Only after every module is covered, flip the config:
addopts = [..., "--cov=crdt_sync", "--cov=tool", ...]
[tool.coverage.run]
source = ["crdt_sync", "tool"]
Flipping it earlier makes the suite fail on the 100% gate for every module you have not reached yet, which blocks unrelated commits -- so it is the last step, not the first.
Traps, all hit during the cap work:
- Tests live in
crdt-sync/crdt_sync/tests/, andtestpathspoints there. Atool/test still belongs under that directory (e.g.crdt_sync/tests/test_tool_oauth_callback.py) unless you also extendtestpaths-- decide once and be consistent. toolis imported as a package from thecrdt-syncroot (python3 -m tool.google_id_token, andseed_session.pydoesfrom tool.google_id_token import ...). Do not "fix" those to relative imports.- Do not add
# noqaor# type: ignoreanywhere; the repo bans them and a pre-commit hook blocks them. If lint fights you, fix the code. - Run the CI-pinned ruff, not whatever
ls | head -1finds. The cache holds three versions and CI pins 0.15.2:/home/kuhy/.cache/pre-commit/repodhz30fnk/py_env-python3/bin/ruff. Confirm with--version; 0.14.5 misses findings that fail CI. - Verify with
bash scripts/check_file_length.sh --allandpre-commit run --config crdt-sync/.pre-commit-config.yaml --all-files(the--all-filesrun catches ruff pruning re-export imports, which brokeimport crdt_syncthree times during the cap work).
Done when: source = ["crdt_sync", "tool"] is in effect and
bash scripts/run_subproject_tests.sh crdt-sync still reports 100% with the
suite green. Baseline before you start: 259 passed, 100%.
Task 3 -- resolve the three dirty working-tree items -- DONE
seed_session.py-- both files its comment cites were re-confirmed present, so the change was committed as-is (9d638fb).firebase-debug.log-- deleted, and the root.gitignorenow covers it plus the sibling logs the Firebase CLI writes (e0eef3d).staged/-- the user chose apply.APPLY.shinstalled the split into~/.claude(committed there as e0cf24a):phone_deploy.sh311 -> 140 lines with three sourced libs, 12/12 function parity, and the unreachable-device path still exiting 30.staged/was then removed; the pre-split original remains recoverable from~/.claudeat80cd45e. Still unverified: the build/install/launch tail, which needs a real APK install on the phone (bash ~/.claude/scripts/phone_deploy.sh ~/todo --release).
Task 4 -- fix the stale skill pointer -- DONE (~/.claude e0cf24a)
The description above was partly wrong: README.md does still hold the
per-stack patterns and the "Do NOT" list. What actually split out during the
cap work was the pointer-free-operability and screen-size material, into
operability.md (rules) and operability-patterns.md (per-stack code);
README's "Pointer-free + small-screen" section is now a stub pointing at them.
~/.claude/skills/unified-design-system/SKILL.md now lists both new files and
tells the reader to read operability.md before building any interactive
widget, since its rules are marked required. All six relative links were
checked to resolve. This edit lives outside ~/utils, so git status here
will never show it.
Verify (all four)
cd ~/utils
bash scripts/check_file_length.sh --all # must exit 0
bash scripts/run_subproject_tests.sh crdt-sync # 100% coverage
pre-commit run --config crdt-sync/.pre-commit-config.yaml --all-files
git status --short # should be empty
gh run list --limit 10 # all workflows green
web-ui-tests was the one red workflow; it went green at 53f2816. Note that
git status here cannot see the Task 3/4 edits under ~/.claude -- those are
committed in that repo (e0cf24a), not this one.
One finding outside the four tasks, left for the user to decide:
~/.claude/scripts/finish.sh is 309 lines, over the cap. It does not
block anything today -- the hook checks staged files only, so it fires only if
a commit stages that file -- but it is the last known over-cap file in that
repo.