Eve library

Silent `Math.random()` Annotation Progress (V1-P2-3403)

Guide

Revision 1

On this page

V1-P2-3403 is in progress. This file tracks state so subsequent sessions can resume cleanly.

Tooling (committed)#

  • Classifier: scripts/p2/classify-silent-random.py (V1-P2-3401). Reads scanner output, emits the master sheet at docs/releases/p2/silent-random-classification.md.
  • Phase-1 annotator: scripts/p2/annotate-allow-sites.py (V1-P2-3403 tool). Reads the master sheet, applies // random:legitimate <reason> to HIGH-confidence ALLOW rows only. Idempotent (skips already-annotated lines). Conservative (only edits a line that actually contains Math.random).
  • Phase-2 medium annotator: scripts/p2/annotate-phase2-medium.py (V1-P2-3403 phase-2 tool). Bulk-annotates the 696 MEDIUM-confidence ALLOW sites with rule-coherent rationales (procedural-generation-path, random-pick-from-array, seed-or-fixture-script). Skips files that have any REPLACE row (tainted) — those need explicit per-site review.
  • Phase-2 low annotator: scripts/p2/annotate-phase2-low.py (V1-P2-3403 phase-2 tool). Context-aware classifier for the 1996 default-allow LOW sites. Reads each site with surrounding lines and sub-classifies into 16 ALLOW sub-rules (id-token, id-suffix-template, uuid-nibble, bipolar-jitter, array-pick, char-pick, shuffle-sort, fisher-yates-inner, rng-factory, probability-gate, probability-gate-scaled, angle-jitter, dice-roll, weighted-random, rng-intermediate, min-bounded-pick, small-range-floor, timer-jitter). Flags fake-metric assignments and known fake-data-file paths as REPLACE candidates for §41.2 atomic items.
  • Plan: docs/releases/p2/silent-random-replace-plan.md (V1-P2-3402).
  • Inventory: docs/releases/p2/silent-random-candidates.md (V1-P2-3400).
  • Phase-2 triage outputs: docs/releases/p2/silent-random-low-replace-candidates.txt (45 fake-metric sites flagged) and docs/releases/p2/silent-random-low-uncategorized.txt (516 sites needing manual review or further rule refinement).

What V1-P2-3403 covers#

  • Phase 1 — bulk-annotate HIGH-confidence ALLOW (~3,527 sites): mechanical pass via annotate-allow-sites.py. The 11 HIGH rules are: comment-reference, id-token-toString, token-char-pick, shuffle-sort-key, rng-factory, timer-jitter, probability-gate, test-fixture-file, gaussian-sampling, id-suffix-template, animation-visual-jitter.
  • Phase 2 MEDIUM — bulk-annotate MEDIUM-confidence ALLOW (696 sites): procedural-generation-path (357), random-pick-from-array (266), and seed-or-fixture-script (73). Bulk-annotated via annotate-phase2-medium.py after sampling 30 sites of each rule and confirming coherence (>95% legitimate ALLOW). Files containing REPLACE rows are skipped (76 sites in tainted files).
  • Phase 2 LOW — context-aware annotation of default-allow (1,996 sites): Each site's line is read in context and matched against 16 ALLOW sub-rules; ~1,424 sites annotated across two passes. Remainder either flagged as REPLACE candidate (45), in tainted file (189), line-drifted (~186), or genuinely uncategorized (516, surfaced for next-session manual review).

Progress#

Scanner counts (bash scripts/stub-indicator-scan.sh --mode=random --format=paths | wc -l):

Snapshot Sites
Initial (before V1-P2-3403) 6,883
After V1-P2-3403 phase-1 bulk pass ~4,160
After 2026-05-04 phase-1 cleanup pass 3,945
After 2026-05-04 phase-2 medium pass ~3,400
After 2026-05-04 phase-2 low (round 1) ~2,750
After 2026-05-04 phase-2 low (round 2) 2,624
After 2026-05-04 phase-2 low (round 3) 2,614
After 2026-05-05 §41.2 small-domain work 2,538
After 2026-05-05 phase-2 low (round 4) 2,396
After 2026-05-05 V1-P2-3411 + V1-P2-3416 2,201
After 2026-05-05 phase-2 low (round 5) 2,175
After 2026-05-05 phase-2 low (round 6) 2,158
After 2026-05-05 phase-2 low (round 7) 2,083
After 2026-05-05 phase-2 low (round 8) 2,078
After 2026-05-05 phase-2 round 9 1,965
After 2026-05-05 phase-2 round 10 1,965
After 2026-05-05 phase-2 round 11 1,974
After 2026-05-05 phase-2 round 12 1,347
After 2026-05-05 phase-2 round 13 1,343
After 2026-05-05 round-13 manual pass 1,329
After 2026-05-05 round 14 (no-op) 1,329
Round 15 baseline (after main merges) 1,066
After 2026-05-05 round 15 1,062
After 2026-05-05 round 16 1,060
After 2026-05-05 round 17 1,059
After 2026-05-05 round 18 1,057
After 2026-05-05 round 18 manual pass 1,048

Annotation site count (lines containing // random:legitimate or # random:legitimate): 6,122 (up from 6,109 after round 17).

The 2026-05-05 round 12 picked up where round 11 left off (1,974 fresh on a new session). Standard resume recipe — re-ran all three annotators (phase-1: 498 sites; phase-2-medium: 67 sites; phase-2-low: 271 sites). Filtered 265 files blocked on pre-existing stub vocabulary, leaving 77 annotated files. Eslint preflight against staged-style errors (with NODE_OPTIONS=--max-old-space-size per top-level dir to dodge OOM) found 69 files with pre-existing no-duplicate-imports / no-case-declarations / no-unused-vars errors — concentrated in libs/yemaya/ui (./types.js duplicate imports), apps/lilith (varied), libs/yemaya/organizations services, yaa/packages/nlp/ghana-nlp, and others. Reverted the eslint-bad files; committed the remaining 8 in 4 domain-grouped commits (lilith ×4, hathor ×1, aphrodite ×2, tests ×1) plus a 1-file fix for the annotator. Net scanner drop: 1,974 → 1,347 (a large drop because the working-tree had picked up many already-annotated files via prior sessions' partial commits — the scanner runs against HEAD, so the fresh count reflects all merged work since round 11). Annotator fix: phase-2-medium was missing the // prettier-ignore-above-brace-ending-lines logic that phase-1 and phase-2-low have. Without it, MEDIUM-rule annotations on lines like if (Math.random() < 0.3) { were getting moved off the line by prettier on commit, causing duplicate-comment churn over multiple rounds (visible as 3-line stale // random:legitimate ... blocks below the brace in apps/hathor world-gen.ts, libs/aphrodite scare.ts, environmental-effects.ts, and tests/integration test-event-bus.ts). Commit 980ff554f4 adds the same prettier-ignore protection to phase-2-medium, matching the phase-1 implementation.

The 2026-05-05 round 13 immediately followed round 12 within the same session: the prettier-ignore-fixed phase-2-medium annotator surfaced 338 modified files on its first re-run, mostly because the post-edit pass was now retroactively adding // prettier-ignore directives above brace-ending annotated lines that were committed in earlier rounds without protection. Filtered 265 stub-blocked

  • 69 eslint-blocked files; committed the 4 remaining lilith files (svc-ai/{rpg-map-generation,rpg-quest-generation}, svc-metaverse/ai/{Personality Engine,ambient-life-system}). Net scanner drop: 1,347 → 1,343 (4 sites). Practical-limit observation: the remaining ~1,343 sites are concentrated in (a) stub-blocked files (≈265) blocked on §14..§32 domain stub cleanup, (b) eslint-blocked files (≈69) blocked on unrelated cleanup, (c) 735 REPLACE-classified sites handled by §41.2 atomic items not V1-P2-3403, and (d) tainted/line-drifted/uncategorized sites needing manual per-site review. Further bulk-annotator yield is gated on those upstream tasks completing first.

A follow-up manual pass tackled the 21 phase-2-low uncategorized sites documented in silent-random-low-uncategorized.txt. Annotated 14 ALLOW sites across 13 files (5 JSDoc prose mentions in hathor simulation managers + aphrodite neuro-design + yemaya agents testing.d.ts; 3 multi-line template-literal refactors in isis annotation-tools, neith social-features, oshun ritual-completion-events; 1 multi-line refactor in aphrodite scene-goddess ocean.ts; 5 free-form algorithmic sites in aphrodite literary-engine, metis ab-testing, nyx orbital n-body, oya airsim-integration, psyche mesh-to-gaussian, yemaya agents constraints — each annotated with a domain-specific rationale). Skipped 5 genuine REPLACE candidates (yemaya/auth password.ts:314 password position; aphrodite/crypto-payments index.ts:1404 crypto value gen; veritas/agents-qa qa-agent.ts:756 fake QA result; oya/core gnn-swarm-intelligence.ts:3925 fake death tally; veritas/automated-content fuel-generator.ts:367 fake price) — these belong to §41.2 REPLACE work, not V1-P2-3403. Encountered a prettier-rewrite issue: prettier reformatted a single-line Math.random().toString(36).slice(...) chain back into a multi-line form, which moved the random:legitimate annotation off the Math.random line. Fixed by adding // prettier-ignore above the line. Net scanner drop: 1,343 → 1,329 (14 sites). Two psyche/yemaya files (mesh-to-gaussian, agents constraints/index.ts) that contained pre-existing stub vocabulary were reverted because the pre-commit stub scanner blocked them — they remain unannotated for this round, blocked on §14..§32 domain stub cleanup.

The 2026-05-05 round 14 ran the standard resume recipe (phase-1 / phase-2-medium / phase-2-low annotators, then stub filter). Annotators surfaced 335 modified files; filtered 265 stub-blocked, leaving 69 candidate files. ESLint preflight (npx eslint --no-warn-ignored) confirmed every one of those 69 files has at least one pre-existing eslint error (no-unused-vars, no-duplicate-imports, no-case-declarations, no-inner-declarations) that fails the lint-staged gate. Per-file commit attempts yielded 1 commit before the eslint-blocked carve-out prevented the rest. The 1 commit was reverted along with the rest of the batch to keep the round's output coherent — it would have been an isolated drop in a single lilith file, not worth the doc complexity. Net scanner drop: 0 (1,329 → 1,329). This confirms the round-13 practical-limit observation: bulk annotation has fully extracted its yield; further sites are gated entirely on (a) §14..§32 stub cleanup releasing ~265 stub-blocked files, (b) unrelated eslint cleanup releasing ~69 eslint-blocked files, (c) §41.2 REPLACE work (V1-P2-3416..3429) absorbing the 735 REPLACE-classified sites, and (d) per-site manual review for the 7 remaining phase-2-low uncategorized sites already catalogued as REPLACE candidates in phase2-low-uncategorized.txt. V1-P2-3403 remains unchecked; future progress requires upstream tasks to land.

The 2026-05-05 round 16 ran on a baseline of 1,062 sites (no main-merge diff vs round 15's tail except a single feat(lakshmi) project.json fan-out that introduced no Math.random sites). Standard resume recipe: phase-1 (312 sites edited across 2,161 candidate files; 2,855 already-annotated; ~16 line-drift warns), phase-2-medium (55 sites edited across 185 candidate files; 76 tainted skipped, 140 line-drift skipped, 425 already-annotated), phase-2-low (195 sites edited across 747 candidate files; 189 tainted skipped, 374 line-drift skipped, 1,157 already-annotated, 73 REPLACE candidates surfaced, 7 uncategorized). Annotators surfaced 250 modified files. Stub-indicator filter removed 181 files. ESLint preflight (8-file batches with NODE_OPTIONS=--max-old-space-size=6144) flagged 68 files with pre-existing no-unused-vars/no-duplicate-imports/no-case-declarations/ no-inner-declarations errors. Both groups reverted, leaving exactly 1 clean file: apps/lilith/svc-teacher-blessing/src/app.ts (2 JSDoc-prose mentions of Math.random annotated with // random:legitimate comment reference, not executable). Committed in c1bb78fdeb. Net scanner drop: 1,062 → 1,060 (2 sites). The 7 phase-2-low uncategorized sites were manually reviewed: 4 are §41.2 REPLACE candidates already catalogued (crypto-payments crypto value gen, oya gnn-swarm fake death tally, veritas qa-agent simulated result, veritas fuel-generator fake price, plus yemaya/auth password.ts:314 which uses Math.random() for required-char insertion position into a generated password — security issue, must use randomInt from crypto); 2 are legitimate ALLOW (psyche mesh-to-gaussian.ts:375 interpolation t, yemaya agents constraints genetic-algorithm crossover alpha) but blocked on stub vocabulary in the file. Round 16 confirms the round-13/14 practical-limit observation continues to hold: bulk yield is exhausted; further progress requires upstream §14..§32 stub cleanup, unrelated eslint cleanup, and §41.2 REPLACE work to land first. V1-P2-3403 remains unchecked.

The 2026-05-05 round 18 ran on a baseline of 1,059 sites with the post-merge working tree picking up a fresh 0e2e6a3469 fix(lilith): repair blockchain verification and a lakshmi/scheduler slice. Standard resume recipe: phase-1 (305 sites edited across 2,161 candidate files; 2,854 already-annotated; ~16 line-drift warns), phase-2-medium (55 sites edited across 185 candidate files; 76 tainted skipped, 140 line-drift skipped, 425 already-annotated), phase-2-low (195 sites edited across 747 candidate files; 189 tainted skipped, 374 line-drift skipped, 1,157 already-annotated, 73 REPLACE candidates surfaced, 7 uncategorized). Annotators surfaced 247 modified files. The stub-indicator filter removed 179 of them. ESLint preflight (8-file batches with NODE_OPTIONS=--max-old-space-size=6144, per-file invocations within each batch to identify the culprit) flagged 67 of the remaining 68 files with pre-existing no-unused-vars/no-duplicate-imports/no-case-declarations/ no-inner-declarations/prefer-nullish-coalescing errors. Both groups reverted, leaving exactly 1 clean file: apps/lilith/svc-blockchain/src/crypto-random.ts (2 JSDoc-prose mentions of Math.random annotated with // random:legitimate comment reference, not executable). Committed in 4f1aa74dab. Net scanner drop: 1,059 → 1,057 (2 sites).

Round 18 then ran a manual-pass attack on the 7 documented phase-2-low-uncategorized sites tracked in docs/releases/p2/silent-random-low-uncategorized.txt. Of the 7: 5 are §41.2 REPLACE candidates already catalogued (crypto-payments crypto value gen, oya gnn-swarm fake death tally, veritas qa-agent simulated result, veritas fuel-generator fake price, yemaya/auth password.ts:314 must use crypto.randomInt); 1 is blocked on a real tracked stub (psyche mesh-to-gaussian.ts:375 parseMeshData placeholder still has stub vocabulary placeholder/would, awaiting genuine glb/gltf/fbx/obj parser implementation — must not be stub:legitimate-bypassed per the "false positives only" rule); 1 is genuinely a false-positive in libs/yemaya/agents/src/constraints/index.ts where the BLX crossover alpha = Math.random() was blocked because three resolution-option strings literally contain 'Timeline would need to increase' / 'Budget would need to increase'. Those strings are user-facing impact prose, not implementation-gap stubs, so they were annotated // stub:legitimate user-facing impact prose, not implementation gap, which unblocked the file. Re-ran phase-2-low to pick up the 5 sites the classifier categorises (population-init, crossover-rate gate, mutation-rate gates ×2, mutation-variable pick) and manually annotated the 3 it did not (tournament-select random index pick ×2, Gaussian-mutation centred jitter ×1) plus the BLX alpha itself. 9 net new random:legitimate annotations in libs/yemaya/agents/src/constraints/index.ts, committed in 0be5a98481. Combined round-18 net scanner drop: 1,059 → 1,048 (11 sites, both commits). Round 18 confirms the practical-limit observation holds for bulk passes but shows targeted manual review of the phase-2-low-uncategorized list still releases small additional yield. The remaining ~1,048 sites are concentrated in (a) ~178 stub-blocked files awaiting §14..§32 domain-stub cleanup, (b) ~25 eslint-blocked files awaiting unrelated eslint cleanup, (c) 735 REPLACE-classified sites scheduled for §41.2 atomic items (V1-P2-3416..3429), (d) tainted/line-drifted sites needing per-site review, and (e) 6 phase-2-low-uncategorized sites that are all genuine REPLACE candidates or stub-bypass candidates and therefore not in V1-P2-3403's annotation scope. V1-P2-3403 remains unchecked.

The 2026-05-05 round 15 ran on a baseline of 1,066 sites — 263 lower than the round-14 floor because intervening merges from origin/main (other worktrees landing §14..§32 stub cleanup and §41.2 REPLACE work) released previously gated files. Standard resume recipe: phase-1 (315 sites edited across 188 files), phase-2-medium (55 sites edited across 185 candidate files; 76 tainted skipped, 140 line-drift skipped), phase-2-low (197 sites edited across 747 candidate files; 189 tainted skipped, 372 line-drift skipped, 73 REPLACE candidates surfaced, 7 uncategorized). Annotators surfaced 254 modified files total. Stub-indicator filter removed 182 files (still concentrated in domains where §14..§32 cleanup hasn't landed); ESLint preflight (with NODE_OPTIONS=--max-old-space-size=6144 and 8-file batches to avoid OOM — running the full 72-file list as a single eslint invocation OOMed silently at ~38s, falsely returning 0 errors) flagged 68 files with pre-existing no-case-declarations/no-non-null-assertion/prefer-nullish-coalescing errors. Both groups were reverted, leaving 4 clean files to commit: 3 hathor (svc-veilborn-core/{asset-gen,character-creation,data-access}.ts, single commit) and 1 tara (web/e2e/fixtures/test-data.ts). Net scanner drop: 1,066 → 1,062 (4 sites). Round 15 confirms the round-14 practical-limit observation holds across main merges: each new round pulls in a fresh main snapshot and finds a small handful of newly-unblocked files, but the bulk of remaining sites stays gated on (a) §14..§32 stub cleanup, (b) unrelated eslint cleanup, and (c) §41.2 REPLACE work. V1-P2-3403 remains unchecked.

The 2026-05-05 round 9 + round 10 ran the standard resume recipe: re-execute all three annotators, filter out 264 stub-blocked files (still gated by pre-existing stub indicators), then commit per-file. Round 9 landed 34 commits across 18 top-level dirs (libs/{shared,seshat,psyche,nyx,nous,nisaba,neith,…} and apps/{lilith,oshun,…}); round 10 landed 8 additional commits after a fresh git merge origin/main brought ~50 new files into the working tree. Net scanner drop for the session: 33 sites (1,998 → 1,965). The remaining 69-of-77 round-10 attempts that failed are concentrated in five yaa/packages/* files where lint-staged enforces stricter rules than eslint --fix --no-warn-ignored surfaces (no-case-declarations, no-duplicate-imports, no-unused-vars on type-only imports). They are blocked on a yaa-domain cleanup pass that is outside V1-P2-3403's scope.

The 2026-05-05 round 11 extended annotate-phase2-low.py with 25 new ALLOW sub-rules to absorb the long-tail uncategorized cluster (commit 14f91d9192): ml-seed-init, ml-seed-return, ternary-rng-fallback, compound-additive-random, assignment-probability-gate, function-return-random, return-mult-jitter, log-uniform-sample, ident-mult-jitter, random-past-timestamp, uniform-date-range, date-plus-random-hours, function-arg-random, color-channel-random, indexed-add-normalised, param-default-random, bipolar-jitter-leading, triangular-noise, ceiled-uniform-pick, power-bounded-integer, rpg-variance-pick, clamp-additive-jitter, mult-jitter-on-base, paren-floor-bitor, quantised-index-pick, nullish-rng-callable-fallback, ceiled-uniform-bounded, ternary-rng-callable, string-literal-reference. Drops phase-2-low uncategorized from 76 to 21 and edits 320 sites (vs 263 in round 10). Commit-side: 31 net commits; scanner went from 1,965 → 1,974 because the round-11 git merge origin/main pulled in ~40 new files including new Math.random sites that exceeded round-11's commit yield.

The 21 remaining phase-2-low uncategorized sites are documented in docs/releases/p2/silent-random-low-uncategorized.txt and split into: (1) doc-comment / JSDoc references that mention Math.random in prose (5 sites in hathor simulation, aphrodite reward-system); (2) multi-line template-literal continuations where the ${Math.random() runs onto a new line (3 sites in isis/neith/oshun); (3) genuine REPLACE candidates (OTP code in asase/supply-chain delivery-proof.ts:334, password position in yemaya/auth password.ts:314); (4) free-form algorithmic uses requiring per-site review (~10 sites in oya/airsim, nyx/orbital, veritas/qa-agent).

The 2026-05-05 round 8 added 14 new ALLOW sub-rules to the LOW classifier (var-additive-jitter, var-additive-ident-jitter, leading-base-additive, leading-ident-additive, leading-subtractive, rounded-additive, string-wrap-random, tostring-random, arrow-rng-factory, nullish-rng-fallback, array-map-random, fill-map-random, sinusoidal-additive-or-subtractive, uniform-range-prop, floored-uniform-range, scaled-by-identifier) — drops a fresh-run phase-2-low uncategorized count from 172 to 76. Round 8's net commit-side progress was small (2,083 → 2,078) because most of the 334 newly-classified sites land in files already gated by pre-commit stub-indicator hits or pre-existing eslint errors; those are blocked on their respective domain cleanup tasks rather than on the classifier.

The 2026-05-05 round 7 fixed a long-standing regression in annotate-allow-sites.py and annotate-phase2-low.py (commit 1b91575458): the inline // random:legitimate <reason> marker was being appended to lines that already terminate with { (e.g. if (Math.random() < x) {), and the workspace prettier pass — running inside the lint-staged pre-commit hook — moved the trailing comment to a new line below the brace, breaking the random:legitimate-on-the-same-line-as-Math.random contract that the silent-random scanner enforces. Round 7 fixes this by inserting a // prettier-ignore directive above any annotated line whose pre-comment content ends with {. The fix runs as a post-edit pass in both phase-1 and phase-2-low annotators. Of the 1,995 phase-2-low ALLOW sites, 61 are brace-ending; the others were already preserved correctly. Round 7 added 75 net new annotations (2,158 → 2,083).

The 2026-05-05 round 4 added 11 new sub-rules to the LOW classifier: expanded rng-intermediate (more variable-name aliases plus a \w+(Roll|Chance|Random|Probability|Score|Variance)$ suffix match), broader uniform-range (allow property access in (max - min)), jsx-attribute (Math.random inside JSX ={...}), unit-random-value (name: Math.random(),), visual-jitter-literal (scale/rotation/opacity/drag/etc. animation params), rounded-integer (Math.round bound), coord-jitter (x/y/z/cx/cy/etc. position jitter), small-decimal-jitter (additive [0, 0.<n>) variance). The round annotated 461 additional default-allow sites and dropped UNCATEGORIZED from 445 → 249.

Of the remaining 2,396 unannotated sites:

  • 735 are REPLACE-classified by the master classifier — they will be removed by the §41.2 atomic items (V1-P2-3410..3429) when each domain replaces its silent-fake metric computations. Until those land, they remain unannotated by design.
  • ~518 are HIGH-confidence ALLOW sites in files that the phase-1 bulk-annotation pass had to skip because the file independently fails one of the pre-commit gates. The two carve-out lists are below.
  • 189 are MEDIUM/LOW sites in tainted files (files with at least one REPLACE row) — bulk annotation is unsafe; they need per-site review alongside the §41.2 atomic items.
  • ~249 are LOW default-allow sites that the phase-2 low classifier could not place under any of its 27 ALLOW sub-rules. Captured in docs/releases/p2/silent-random-low-uncategorized.txt.
  • 45 are LOW default-allow sites flagged as REPLACE candidates by the phase-2 low classifier (fake-metric field assignments). Captured in docs/releases/p2/silent-random-low-replace-candidates.txt. Concentrated in apps/demeter/api/src/routes/weather.ts (13), libs/veritas/realtime-data/src/weather.ts (11), and the demeter sensor visualization page (3).
  • ~186 are line-drifted: appendix line numbers no longer point at a Math.random call in the file (file changed since classification was generated). These need re-classification.
  • 76 are MEDIUM ALLOW sites in tainted files (skipped by the phase-2 medium annotator).

Carve-outs from the phase-1 bulk pass#

The annotator wrote // random:legitimate ... to ~3,527 HIGH-confidence ALLOW sites across the working tree. ~3,009 landed in commits over the multi-session phase-1 work; the rest sit in files that the pre-commit hooks reject for unrelated reasons. Those files were reverted to HEAD and are tracked here so the cleanup tasks know what's blocking them.

The 2026-05-04 cleanup pass added 53 commits across 17 top-level dirs (apps/aja, apps/lilith, apps/oshun, apps/psyche, apps/tara, apps/yemaya, docs/training, libs/aja, libs/aphrodite, libs/hathor, libs/lakshmi, libs/lilith, libs/nous, libs/psyche, libs/shared, libs/yemaya, scripts/lilith) using a per-file commit loop with auto-bisect on pre-commit failures. 50 files were reverted as blocked (eslint errors). Failed-file list in /tmp/failed-files.txt after the run.

Blocked on pre-existing stub-indicator hits#

196 files. Each contains stub vocabulary (would, placeholder, TODO:, In production, etc.) that pre-commit's --mode=stubs scan flags. The underlying stub is a real cleanup item belonging to the domain's audit stub sites task (§14..§32 in master TODO); annotating math.random in these files has to wait for the stub to be cleaned, deleted, or marked // stub:legitimate <reason>.

The full list is captured in the working-tree path filter /tmp/blocked-stubs.txt during the resume recipe; reproduce it by running:

bash
bash scripts/stub-indicator-scan.sh --mode=stubs $(git ls-files --modified) \
  | grep -E '^\S+:[0-9]+:' | awk -F: '{print $1}' | sort -u

against the working tree after running the annotator.

Blocked on pre-existing ESLint errors#

25 files. Each fails eslint --fix --no-warn-ignored for an unrelated reason — usually one of: unused imports (@typescript-eslint/no-unused-vars), no-case-declarations, no-duplicate-imports, no-inner-declarations, or a Parsing error: file was not found by the project service for files outside any tsconfig project (e.g. apps/tara/web/e2e/fixtures/test-data.ts).

The eslint errors are real cleanup items but lie outside V1-P2-3403's scope. Reproduce the list with:

bash
xargs -a /tmp/all-modified.txt npx eslint --fix --no-warn-ignored 2>&1 \
  | awk '/^\/.+/{f=$0;next} /\s+0:0\s+error|\s+[0-9]+:[0-9]+\s+error/{if(f){print f;f=""}}' \
  | sort -u

Resume recipe (next session — phase 1 cleanup)#

bash
# 1) Regenerate working-tree edits
python3 scripts/p2/annotate-allow-sites.py docs/releases/p2/silent-random-classification.md

# 2) Filter out files with pre-existing stub indicators (kept in HEAD)
git status --short | awk '{print $2}' > /tmp/all-modified.txt
xargs -a /tmp/all-modified.txt bash scripts/stub-indicator-scan.sh --mode=stubs 2>&1 \
  | grep -E '^\S+:[0-9]+:' | awk -F: '{print $1}' | sort -u > /tmp/has-stubs.txt
xargs git checkout HEAD -- < /tmp/has-stubs.txt

# 3) Filter out files with pre-existing ESLint errors
git status --short | awk '{print $2}' > /tmp/all-modified.txt
# Run eslint preflight in batches of ~80 files; collect error files; revert them.
# (See scripts/p2/annotate-allow-sites.py docstring for full preflight script.)

# 4) Commit in 50-file batches per top-level dir; push to branch and main per CLAUDE.md
for dir in libs/aphrodite libs/iris libs/psyche libs/yemaya libs/nous libs/isis ...
do
  while git ls-files --modified | grep -q "^$dir/"; do
    git ls-files --modified | grep "^$dir/" | head -50 > /tmp/batch.txt
    xargs git add < /tmp/batch.txt
    git commit -m "chore(<scope>): annotate allow math.random sites (v1-p2-3403)" \
      || { xargs git checkout HEAD -- < /tmp/batch.txt; break; }
    git push origin oshun-lt-2-hetzner
    git push origin oshun-lt-2-hetzner:main \
      || { git fetch origin main; git merge origin/main --no-edit; \
           git push origin oshun-lt-2-hetzner; \
           git push origin oshun-lt-2-hetzner:main; }
  done
done

Pre-commit gotchas that bit this session:

  1. --no-warn-ignored lint-staged exit-code is non-zero on any error, so any pre-existing ESLint error in a file in the staged batch fails the entire commit. Filter those files out (above) before staging.
  2. stub-indicator-scan runs on staged files: any pre-existing stub vocabulary in a file that is otherwise clean for ESLint will still trip the commit. Filter those files out too.
  3. Pre-commit also reverts staged changes on failure: if git commit fails, lint-staged restores the working tree to the pre-commit snapshot, but the index still has those files staged. Always git reset HEAD <files> before retrying or moving to the next batch — otherwise the next commit attempt re-includes the bad files.
  4. Loop fault tolerance: if a commit fails, revert the failed batch (xargs git checkout HEAD -- < /tmp/batch.txt) and proceed to the next directory rather than retrying — the file in the batch that failed will never succeed without the underlying fix, and retrying just delays the loop.
  5. Network divergence: origin/main advances during long runs (other worktrees push to it). Always be ready to git fetch origin main && git merge origin/main --no-edit and re-push to both refs.

Phase 2 — per-line MEDIUM/LOW review#

After phase 1 is fully cleaned up (i.e. all 3,527 HIGH ALLOW sites are annotated or known-blocked), the next phase opens the 2,692 MEDIUM/LOW sites one at a time, decides ALLOW/REPLACE/DELETE in context, and either adds a precise // random:legitimate <reason> or re-classifies the row. That is not bulk-applicable.

V1-P2-3403 stays unchecked in the master TODO until both phases land.