Skip to content

refactor(intent): split seed-calendar.ts under the file-length limit and re-measure the KPI gate (Refs #897) - #904

Merged
alex-mextner merged 2 commits into
mainfrom
seed-calendar-split
Oct 29, 2026
Merged

alex-mextner merged 2 commits into
mainfrom
seed-calendar-split

Conversation

@alex-mextner

@alex-mextner alex-mextner commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Refs #897

seed-calendar.ts (1347 lines) is the last handwritten file over the 1200-line limit of #860. This PR splits it and regenerates the real-history KPI gate of #827, because the engine digest the gate records covers every src/services/intent/*.ts file.

What changed

  • src/services/intent/seed-calendar.ts becomes four files of 153, 363, 443 and 447 lines: seed-calendar-vocab.ts (phrasing building blocks), seed-calendar-read.ts (day, period, next, count, search and when families), seed-calendar-free.ts (free time and holidays) and the assembling seed-calendar.ts (calendar picture and the one calendarFamilies list). The only importer, seed-catalog.ts, is unchanged. The moved bodies are byte-identical apart from export keywords.
  • docs/intents/kpi-gate.json and two appended files docs/intents/benchmarks/20261029T115902Z-real-current.json and 20261029T120052Z-synthetic-current.json were written by the repository tool, not by hand.

The gate re-measurement

  • Policy: a fresh re-measurement with the repository tool, selected under the cleanup authority of the file-size ticket. It is not an owner decision and no owner hold existed.
  • Command: INTENT_BENCH_SHA=a8481969cc9859160fe2b32e4774dac04eca9762 bun --no-env-file scripts/benchmark-intents.ts --gate. Offline and deterministic: committed scrubbed corpus, labels and split only, no network, no model API. It ran on the project server (3 min 6 s, exit 0). The tool, thresholds, corpus, seed, rules and KPI definitions are unchanged. Corpus, labels and split checksums are the same as in the old gate (2f793c24, 19ee899c, 310707bb).
  • Engine digest a73f72ff to de45d590. Every measured number reproduces: real held-out coverage 34/38 (89.5%), precision 100%, strict precision 97.1%, rubric 100%; dev 62/74 (83.8%); pooled 96/112 (85.7%); execution 100% over 18318 matrix cells; synthetic 153/185 (82.7%), precision 100%. The new result files differ from the previous ones only in latency timings, generation time, checksum and source.
  • Caveats: the server ran Bun 1.4.3 and the CI pin is 1.4.2, so hosted CI will reproduce the counts on the pin. source.sha in the result files is the base commit a848196 and dirty is true, because the split was uncommitted when it was measured. It is not rewritten.
  • intent-kpi-gate.test.ts re-runs both benchmarks and passes on the server (16 tests, 0 failed).

Behaviour proof

  • The complete exported seed serialized without key sorting is identical before and after: calendarFamilies sha256 20471407d4da23db97213ca7d8f53e5798beb719475d7b141cdfc0ee8021c836 (12 families in order), the 54-rule seedIntents sha256 b6b7ab91..., seedFingerprint 77224e79..., the ordered exports and the canonical metadata.
  • 395 tests in the 18 test files that load the seed pass before and after with the same per-file counts.
  • Review: three roles (Opus correctness, Sol consistency, Sol quality) found nothing.

Whole Rig aggregate

The branch also carries one cherry-picked commit, 2455a31, from the separate ticket #905 (part of #860). It makes scripts/install-stage-qa-browser.sh, which arrived with #899, pass shellcheck and shfmt, with two test files that pin the generated entry. Without it main fails those two checks, so this PR could not show a clean aggregate on its own. It touches no intent file, and nothing was reinstalled on the Stage QA host.

rig lint run --no-setup --json on this exact tree (b487d260; Bun 1.4.2, rig 0.73.2, server, 2026-10-29T12:15Z): ok true, complete true, 1240 of 1240 files checked, 8 of 8 applicable checks passed (actionlint, ruff check, ruff format, shellcheck, shfmt, tsc, biome, complexity and file length). In the file-length census seed-calendar.ts is gone; only uv.lock (1343 lines, generated) remains as a warning. Before that commit the same run on f3cfc4c failed only shellcheck and shfmt on that installer.

…and re-measure the KPI gate (Refs #897)

seed-calendar.ts (1347 lines, since the intent engine PR) becomes four files of 153, 363, 443 and 447 lines: the phrasing building blocks (seed-calendar-vocab), the day/period/next/count/search/when families (seed-calendar-read), the free-time and holiday families (seed-calendar-free), and the calendar picture plus the one calendarFamilies list the seed catalog reads. The moved bodies are byte-identical apart from export keywords. The complete exported seed serializes to the same sha256 before and after (calendarFamilies 20471407d4da23db97213ca7d8f53e5798beb719475d7b141cdfc0ee8021c836, seedFingerprint 77224e79...d007) and 395 tests in the 18 test files that load the seed pass in both trees.

The engine digest covers every src/services/intent/*.ts file, so the new files change it (a73f72ff to de45d590). The gate is not edited by hand: it is regenerated by bun --no-env-file scripts/benchmark-intents.ts --gate on the split engine with the unchanged tool, committed scrubbed corpus, labels, split and thresholds (a fresh genuine re-measurement selected under the cleanup authority of #860, not an owner decision). Every measured number reproduces: only the engine digest, the two benchmark result paths and the latency timings differ. The two result files are appended; source.sha is the base commit and dirty is true because the split was uncommitted when it was measured. Related: #827
…905)

Format with shfmt; drop the redundant mkdir -m 0700 (umask 077 already makes new directories 0700, existing ones keep their mode); rewrite the apt-get/dpkg-deb check as an explicit if; build the generated SSH_ORIGINAL_COMMAND line without a literal single-quoted expansion. The generated entry is byte identical. Tests pin the entry, new and existing directory modes. Nothing was reinstalled; the installer does not compare file hashes, a later normal run installs this copy. Part of #860
@alex-mextner

Copy link
Copy Markdown
Owner Author

Proof record for the seed-calendar.ts split, written from the saved evidence of the run, with the clock taken from the files.

Policy: a fresh, real re-measurement was selected under the cleanup authority of #860. It is not an owner comment, and no owner hold was imposed.

Re-measurement: the repository tool itself ran bun --no-env-file scripts/benchmark-intents.ts --gate on the split engine, offline, on the committed scrubbed corpus, with the tool and thresholds unchanged. It exited 0 after 3 minutes 6 seconds. It wrote the real result file (18318 matrix cells) and the synthetic result file (3156 cells) and rewrote the gate file. The gate diff is exactly three lines: the engine digest and the two result file names. Every metric is identical to the previous gate: held-out 34 of 38 covered (89.5 percent), precision 100 percent, strict precision 97.1 percent, rubric 100 percent; dev 62 of 74 (83.8 percent); pooled 96 of 112 (85.7 percent); execution 100 percent over 18318 cells; synthetic 153 of 185 (82.7 percent). The server ran Bun 1.4.3 while hosted CI is pinned to 1.4.2, and the hosted test job on the pin passed.

Equality of the split: the serialized exported seed in iteration order, the ordered export list, the family names and the pattern keys have the same sha256 before and after (19fc7ef027a3fa8e508cfe5fee1d953cd62207e725b8b8d08b39ac98ceea3ae6). The 18 test files that import the seed give 395 passes and 0 failures on both the baseline and the split tree, and the gate test file gives 16 passes.

Not covered by this proof: the sizes of the new files on main and the gate test on the merged tree. They are checked after the merge.

Hosted checks on the head 2455a31: the full CI run https://github.com/alex-mextner/HyperCalendarBot/actions/runs/40871715302 and the lint run https://github.com/alex-mextner/HyperCalendarBot/actions/runs/40871715410 succeeded, and the Stage QA run https://github.com/alex-mextner/HyperCalendarBot/actions/runs/40872117870 read passed with 6 cases. The complete Rig aggregate on this tree passed 8 of 8 applicable checks with 1240 of 1240 files covered; its only warning is the generated lockfile at 1343 lines.

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.

1 participant