mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 20:54:00 +01:00
search.ts held three separable concerns. Extracted two:
searchGroups.ts (109) the vocabulary -- InventoryEntry, DiceGroup,
Selection -- plus groupInventory, countCandidates
and expand
searchStrategies.ts (232) Leaderboard and both strategies: exhaustive
enumerateAll, and hillClimb with its greedy and
random seeds
search.ts (100) keeps findBestSet, which picks between the strategies.
Import sites were rewritten to name the owning module rather than leaving a
re-export barrel in search.ts, so two test files changed -- import paths only,
no assertion touched. DiceGroup and Selection had to become exported to cross
the module boundary.
Function bodies moved verbatim: 288 tests still pass and coverage totals are
identical at 863/375/181/810, not merely still 100%.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
22 lines
2.9 KiB
JSON
22 lines
2.9 KiB
JSON
{
|
|
"title": "Split kcd2_dice_solver src/core/search.ts under the 250-line cap",
|
|
"objective": "Bring kcd2_dice_solver/src/core/search.ts (417 lines) under the repo-wide 250-line file cap by extracting its shared vocabulary (SET_SIZE, InventoryEntry, DiceGroup, Selection, expand, groupInventory, countCandidates) and its two search strategies (Leaderboard, enumerateAll, hillClimb, greedySeed, randomSeed) into sibling modules, with every importer's import path rewritten to name the module that now owns each symbol rather than left pointing at a re-export barrel, and with behaviour proven unchanged by the project's own 288-test suite at 100% coverage.",
|
|
"acceptance_criteria": [
|
|
"search.ts and both new sibling modules are each at most 250 lines, and check_file_length.sh --all no longer lists src/core/search.ts.",
|
|
"npx vitest run still reports 24 files and 288 tests, all passing -- no test was added, deleted, or had an assertion weakened.",
|
|
"npx vitest run --coverage still reports 100% statements, 100% branches, 100% functions and 100% lines, with the same 863/375/181/810 totals, since no statement was added or removed.",
|
|
"npm run lint (tsc --noEmit && eslint src) still exits 0 with no output.",
|
|
"Every importer of a moved symbol imports it from the module that now defines it: no re-export barrel is left in search.ts. Import sites in App.tsx, badgeValue.ts, solve.ts, search.test.ts and badgeValue.test.ts are rewritten to the owning module.",
|
|
"Zero suppressions added: no eslint-disable, no @ts-ignore, no @ts-expect-error, and vite.config.ts is byte-identical (thresholds and exclude untouched)."
|
|
],
|
|
"out_of_scope": [
|
|
"Any behaviour change to the search itself -- the exhaustive/hillClimb cutoff, the steepest-ascent swap loop, the leaderboard dedup rule and the greedy/random seeds all keep their current semantics exactly.",
|
|
"Renaming any exported symbol; only the module a symbol lives in changes.",
|
|
"Modifying vite.config.ts, including adding any new file to the coverage exclude list.",
|
|
"Splitting scoring.ts, badgeValue.ts or App.tsx -- each is its own separate commit.",
|
|
"Wiring the file-length pre-commit hook -- it must land last, once check_file_length.sh --all exits 0.",
|
|
"The pre-existing single failure in test_security_hardening.sh, which belongs to block_compulsive_opening.sh and fails identically at HEAD."
|
|
],
|
|
"verifier": "npx vitest run (expect 24 files / 288 tests passed); npx vitest run --coverage (expect 100% on statements, branches, functions and lines, totals 863/375/181/810); npm run lint (expect exit 0, no output); bash ~/utils/scripts/check_file_length.sh --all (expect src/core/search.ts absent from the listing); git diff --stat vite.config.ts (expect empty); grep -rn 'eslint-disable\\|ts-ignore\\|ts-expect-error' src/ (expect no new hits); pre-commit run --files on every touched file. All four commands captured at HEAD as the baseline and re-run after the split."
|
|
}
|