Repository navigation
feat: ship the typed solver with exact optimization and a shared-build test matrix - #3
Draft
Marcus-Rise wants to merge 7 commits into
Draft
Marcus-Rise wants to merge 7 commits into
Marcus-Rise wants to merge 7 commits into
Conversation
…CLI (#2) The minimum-action solver becomes a reusable TypeScript package with a small public contract, shared library/CLI core and verified browser/Node distribution. This revision addresses readability across every source file and the GitHub delivery tooling. Search orchestration, matrix row operations, predecessor storage, input validation and publication steps now have named responsibilities. Domain bounds, storage units and sentinels are explicit; deeply nested operations are split into short functions without changing search order or adding dependencies. Oxlint limits nesting to three levels in `src/` and `.github/scripts/`. - Keep ten flat `src/*.ts` files and two build entries: `index.ts` and `cli.ts`. - Export `solveLock(state, links, config?)` and `createSolverConfig(overrides?)`; preserve readonly tuple typing, immutable defaults and CLI `--config`. - Build four self-contained browser/library files and one standalone CLI with Vite; keep strict TypeScript 7 and the coverage gate. - Keep tests under `tests/` and maintained documentation under `wiki/`. Generate reports, snapshots, coverage and traces only as artifacts. - Use one `release.yml` workflow with three jobs: readonly verification, npm delivery and GitHub release. Main verification/build runs once. The same tested archive passes between jobs; publication uses trusted main tooling and separate permissions. - Preserve actual PR-base / preceding-release comparisons, source and file identity checks, explicit performance acceptance, canaries and recovery from partial publication. Local tests and the full benchmark completed before workflow YAML changes. An independent reviewer examined all ten source files, all seven delivery scripts and the workflow data flow; findings were resolved without adding reviewer reports to the repository. | Local verification | Result | | --- | --- | | Node source tests | 277 passed on Node 24 and Node 26 | | Distribution / real-browser tests | 13 / 528 passed | | Static / installed browser consumers | 24 / 24 passed | | Same installed archive | Node 22.23.2, 24.19.0 and 26.8.1; CLI exits 0/1/2, exports and types | | Coverage: statements / branches / functions / lines | 96.44% / 92.72% / 100% / 96.26% | | All 45 exact command paths | Unchanged from the pre-refactor implementation | | 45-input quality vs PR target | 483 actions, 245 distinct-plate totals, 1,723 unit shifts, 438 switches; unchanged | | Local timing / memory | Inconclusive / inconclusive; raw calibration and bounded repeats retained | Reproduce from the repository root: ```sh pnpm install --frozen-lockfile pnpm exec playwright install --with-deps chromium firefox webkit pnpm test pnpm verify:package --node /path/to/node22 --node /path/to/node26 git worktree add --detach ../gothic-lock-solver-base 3cbbeed pnpm benchmark --baseline-module ../gothic-lock-solver-base/src/index.mjs --baseline-format legacy --output-dir artifacts/benchmark ``` The benchmark compares the separately checked-out target source, not a candidate-owned expected snapshot. Inconclusive performance does not certify the absence of a regression and is not silently accepted for publication. [Hosted CI on b66d3d8](https://github.com/Marcus-Rise/gothic-lock-solver/actions/runs/34130127903) passed on its first attempt. Verification completed; the npm/GitHub publication jobs were skipped for this PR. [Verification artifacts](https://github.com/Marcus-Rise/gothic-lock-solver/actions/runs/34130127903/artifacts/10021794594) contain the five builds, one archive tested in Node 22/24/26, coverage, real-browser reports, the baseline snapshot and the complete 45-input benchmark with calibration and bounded repeats. The downloaded artifact, report hashes, module hashes, source SHA and archive SHA were checked. Hosted quality remains A/U/C/switches = **483/245/1723/438**. Timing and memory both remain **inconclusive**. Sums of per-lock medians were **60.685 ms** for the candidate and **55.259 ms** for the target; these descriptive sums are not whole-workload latency or proof of a speedup. The report identifies candidate `b66d3d8d371b2d7f17d85bf6bed9186006eab87c` and separately checked-out target `3cbbeedbb409a2d8ffa5b00c778cfcb0b07c0ec6`. This PR remains a draft. The reference branch and history are preserved. No package publication, GitHub release or merge is part of this revision.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The restored library branch is ready for review against
main. This PR makes the solver minimize grouped actions first, then unit shifts among equal-action solutions, and separates verification from release delivery.src/index.tsandsrc/cli.ts. The public contract remainssolveLock(state, links, config?)with a documentedcreateSolverConfig(overrides?)factory.tests/, and maintained documentation underwiki/. Generated reports, snapshots, coverage, traces and builds are CI artifacts..github/scriptsand its wrapper-only tests.pnpm buildinvokes Vite and TypeScript directly; CI and publication commands stay in two flat YAML workflows.npm pack,npm publishandgh release createcommands. Release notes include npm/CDN links and the benchmark report.The A* queue and relaxation now compare both costs. The matrix certificate and dense/sparse BFS fallback honor the same ordering. An equal-action route with fewer shifts can improve the predecessor before the result is finalized. Domain validation, intermediate-position bounds and search budgets remain enforced. The proof, complexity and limits are documented in the algorithm Wiki.
The reported regression is fixed:
These before/after values compare the saved pre-fix solver with the final built module. No lock increased its actions, shifts, distinct plates or switches. All 45 final
(actions, shifts)pairs were also checked against an independently implemented exhaustive solver. Focused regression tests and an independent exhaustive oracle for small state spaces are maintained in the test suite. Minimum distinct-plate count is not an API guarantee.CI passed on the exact head,
c6662611494f2b2181329b16dc212f5e9b84be7f:The current main SHA
a87e739a22ccc4215d6d9b14fa06b0738171cb60has no saved report matching the new artifact contract, so this CI run skipped historical comparison. That skip is not evidence of equivalence; the regression result above comes from the separate pre-fix and independent-oracle checks. Future runs compare with available exact-SHA reports. Historical timing/RSS ratios remain informational because machines and runtime conditions may differ.The benchmark artifact contains the complete JSON report, commands, raw samples, environment and Markdown table. The build artifact contains the tested package (including all five runtime files) and the same JSON/Markdown evidence. Downloaded artifact digests, report source identity and packaged file hashes were verified. All six matrix rows verified the same npm archive SHA256:
b1517f701ee7cdf221fe284014b1c9b501007721715e488a1795ab494788a8dd.All 45 locks from the final CI report
Node 24.19.0, Linux x64, AMD EPYC 7763; two warmups and seven measured solves per lock. Timings cover the solver call only, excluding cloning and independent validation.
Totals: 483 actions, 1713 unit shifts, 438 switches, and 245 distinct plates summed per lock. Whole-catalog process peak RSS: median 120,549,376 bytes across three fresh processes. This includes Node, loading and validation; it is not solver-only allocation or browser memory.
Reproduce with Node 24.19.0:
To compare a downloaded report for a known exact target SHA:
Release setup and the manual stable command are documented in the release Wiki. The PR remains a draft targeting
main; no merge or npm publication has been performed.