chore: repository cleanup — line endings, dangling doc references, module split, hygiene - #11
Conversation
Golden fixtures are stored as LF blobs, but Git for Windows sets core.autocrlf=true system-wide and the repo had no .gitattributes, so a fresh Windows clone smudged them to CRLF on checkout while the transforms emit LF. crates/tokenfold-core/tests/golden.rs compares raw bytes with no normalization, so a clean clone failed 3 of 7 golden tests (golden_log_compaction_no_duplicates, golden_log_compaction_adjacent_duplicates, golden_diff_compaction_small_diff). The working tree passed only by accident of how those files were materialized. Pinning eol=lf makes the checkout byte-identical to the stored blobs on every platform. git add --renormalize stages no content changes: all 224 tracked text blobs were already LF in the index.
…product The deferred-baseline entries in the eval harness docstring and the v04 fixture README named a specific competing product and referenced an ML checkpoint. Neither is needed to describe what the baseline would measure: an achieved-token sweep of a third-party content-aware compressor. No behavior change -- both edits are prose. The fidelity gate still passes (smoke-first-consumer) and run_baselines.py is unchanged apart from its module docstring.
… prose Tracked source cited two things no clone can resolve: filenames under docs/solution-design/ (the whole directory is gitignored, so `git ls-files docs` returns nothing) and opaque F-/D-/R- identifiers defined only inside those documents. Anyone cloning the repo hit ~290 dead pointers, two of which escaped the repo entirely: a `tokenfold compress --help` line and a published rustdoc paragraph on docs.rs. Each citation is replaced with the behaviour or contract it pointed at, read off the code rather than the spec. Where a tracked artifact enforces the same thing, the comment now points there instead -- golden fixtures, the test that pins exit codes, README sections -- so the reference stays resolvable in a fresh clone. Comments, doc comments and docstrings only, plus five prose strings that carried dangling ids into user-facing output: the MCP tools/list store_originals description, two test assertion messages, and the two runtime Err() messages from vector::embed and ocr_summarize. Nothing asserts on any of them (verified repo-wide; no should_panic exists). Also corrects two stale claims found along the way: transforms/diff.rs said the module was not wired into the crate (lib.rs:13 has `pub mod transforms;`) and tokenfold-admin claimed a `tokenfold update` subcommand wires its primitives (no such subcommand exists). cargo fmt/clippy -D warnings clean; full workspace suite green; fidelity gate smoke-first-consumer passes; ci.yml and release.yml still parse with all 8 and 9 jobs intact.
Adds the regression gate for the reference sweep. Without it the class returns the first time someone pastes a design-doc pointer into a comment. Verified both directions: it passes on the current tree and fires on an introduced `ROADMAP.md F-999` probe. CHANGELOG.md is exempt as released history, and eval/tasks/*.json are exempt because those byte-exact fixtures contain synthetic id-shaped strings as test data. README's four repo-relative links (LICENSE x2, CHANGELOG.md, THRESHOLDS.toml) resolved on GitHub but were dead on PyPI: crates/tokenfold-py/pyproject.toml points readme at ../../README.md, so this file ships as the package long_description and PyPI does not resolve repo-relative paths. Now absolute github.com/blob/main URLs, which work in both places.
Pure rename, no content change, so git records it at 100% similarity and blame follows cleanly. Split out as its own commit because combining it with the test extraction makes git pair the rename with tests.rs instead: at 1293/2301 lines the test module clears the 50% similarity threshold while the 1008-line implementation does not, which would hand the implementation's entire history to the test file.
Splits the 2301-line module into 1011 lines of implementation and 1290 of tests. Behaviour, public API and report schema are unchanged: lib.rs is byte-identical, and pipeline/mod.rs still exposes exactly compress and compress_with_estimator. The test module is declared `mod tests;` -- not `pub mod` -- inside pipeline/mod.rs. Both details matter. Declaring it in lib.rs instead fails with 52 name-resolution errors, because the tests reach parent-private imports (Value, SkippedReason, TransformStatus, WarningCode, TokenEstimator, ByteHeuristicEstimator) through `use super::*`, and none of those are re-exported at the crate root. Writing `pub mod` would add tokenfold_core::pipeline::tests to a published crate's API. Three test lines are rejoined by rustfmt: dedenting by one level frees four columns, so expressions that previously had to wrap now fit. Formatting only.
.gitignore covered only some of what this tree generates. node_modules/ and dist/ were ignored solely by packages/tokenfold/.gitignore, .pytest_cache/ only by pytest's own generated file, and .env was a bare literal so .env.local and .env.production were not ignored at all. Adds those plus .venv/, venv/, *.egg-info/ and /data/, and moves the .codex/ and CLAUDE.local.md rules out of machine-local .git/info/exclude so they are portable. Verified no currently-tracked file becomes ignored. Adds gitleaks to the security job. The repo publishes to four registries, so a leaked token is a four-registry problem, and there was no scanning of any kind. Full history is scanned (fetch-depth: 0) since a tip-only scan would miss exactly the case that matters. .gitleaks.toml allowlists the secret-shaped strings this repo contains on purpose -- the redaction transform's tests must feed it realistic credentials -- scoped to specific literals and paths so a real credential in those files is still caught. eval/tasks/v04/README.md described its corpus as tier 'A | B | C' with 'Training + evaluation' use. These are held-out evaluation fixtures and nothing is trained from them; the tier table read as a training-data governance record for a corpus that is not training data. Replaced with a provenance statement: project-owned synthetic material only, stated as a precondition for adding fixtures rather than an observation.
The five @tokenfold/cli-* optionalDependencies were recorded in the lock file with no version, while package.json requires 0.4.0 -- a leftover from the v0.4.0 bump, when those platform packages were not yet published so npm could not resolve them. npm tolerated the mismatch until Node 24's bundled npm tightened `npm ci`'s sync check, which now rejects it outright: npm error Invalid: lock file's @tokenfold/cli-darwin-arm64@ does not satisfy @tokenfold/cli-darwin-arm64@0.4.0 This is pre-existing and not caused by any other change on this branch, which does not touch packages/. Confirmed by re-running the node-api job from main's own last green run: it fails today on unmodified main. Regenerated with `npm install --package-lock-only`, which now resolves all five from the registry with integrity hashes. `npm ci` succeeds and `npm test` passes 12/12.
|
Added The five Confirmed pre-existing rather than assumed: this branch does not touch Regenerated with |
Repository cleanup: no behaviour change, no public API change, no shipped capability removed. All ten workspace crates still build and test.
Each commit is self-contained and reviewable on its own; they are ordered so the tree is green at every point.
Why this starts with
.gitattributesThe test suite was red in any fresh Windows clone before this branch — and had been silently. Git for Windows sets
core.autocrlf=truesystem-wide, the repo had no.gitattributes, and the golden fixtures are stored as LF blobs. A clean checkout smudged them to CRLF while the transforms emit LF, andtests/golden.rscompares raw bytes with no normalization, so 3 of 7 golden tests failed. The working tree passed only by accident of how those files happened to be materialized.18d1869pins* text=auto eol=lf. Verified by cloning the resulting commit: 7/7 golden, 0 CR bytes across all tracked files.git add --renormalizestages zero content changes, because all 224 tracked text blobs were already LF in the index.Nothing downstream in this branch was verifiable until that landed.
Dangling documentation references
docs/has no tracked files — the wholedocs/solution-design/tree is gitignored — yet tracked source cited it 288 times across 50 files, along with opaqueF-/D-/R-identifiers defined only inside those documents. Every one of those was a dead pointer for anyone but the author.Two escaped the repository entirely:
crates/tokenfold-cli/src/main.rs— shipped verbatim intokenfold compress --helpcrates/tokenfold-core/src/budget.rs— published rustdoc on docs.rs for tokenfold-core 0.4.0Each citation is replaced with the behaviour or contract it pointed at, read off the code rather than the spec. Where a tracked artifact enforces the same thing, the comment now points there instead — golden fixtures, the test that pins exit codes, README sections.
2ae4d5cadds a CI gate so the class cannot come back. It is tested in both directions: it passes on this tree, and it fires on an introducedROADMAP.md F-999probe.CHANGELOG.mdis exempt as released history, andeval/tasks/*.jsonare exempt because those byte-exact fixtures contain synthetic id-shaped strings as test data.Scope note: an initial pass matching only
docs/solution-designand[FDR]-[0-9]{3}missed ~48 further references written asINTERFACES.md,ENGINEERING.md,ROADMAP.md,PLAN.md. The gate matches both spellings plus every lowercase bare form.Splitting
pipeline.rs2301 lines becomes 1011 of implementation and 1290 of tests, as two commits on purpose.
A single-commit split silently reassigns the file's history to the test file: at 1293/2301 = 56% similarity git pairs the rename with
tests.rs, whilemod.rsat 43.8% falls below the threshold. The implementation would lose its blame lineage to the tests. Doing thegit mvalone first (rename ... (100%), zero content hunks) and extracting second avoids that.Result:
git log --follow pipeline/mod.rsreturns 9 commits,tests.rsreturns 1.The test module is declared
mod tests;— notpub mod— insidepipeline/mod.rs. Both details are load-bearing. Declaring it inlib.rsinstead fails with 52 name-resolution errors, because the tests reach parent-private imports throughuse super::*.pub modwould have addedtokenfold_core::pipeline::teststo a published crate's API.lib.rsis byte-identical.pipeline/mod.rsstill exposes exactlycompressandcompress_with_estimator.Three test lines are rejoined by rustfmt: dedenting by one level frees four columns, so expressions that had to wrap now fit. Formatting only.
Hygiene
.gitignorecovered only part of what this tree generates.node_modules/anddist/were ignored solely bypackages/tokenfold/.gitignore;.pytest_cache/only by pytest's own generated file; and.envwas a bare literal, so.env.localand.env.productionwere not ignored at all. Adds those plus.venv/,venv/,*.egg-info/,/data/, and moves the.codex/andCLAUDE.local.mdrules out of machine-local.git/info/excludeso they are portable. Verified that no currently-tracked file becomes ignored.Secret scanning did not exist, in a repo that publishes to four registries — a leaked token is a four-registry problem. Adds gitleaks to the
securityjob, scanning full history (fetch-depth: 0), since a tip-only scan would miss exactly the case that matters..gitleaks.tomlallowlists the secret-shaped strings this repo contains deliberately — the redaction transform's tests must feed it realistic credentials — scoped to specific literals and paths so a real credential in those files is still caught.Fixture provenance.
eval/tasks/v04/README.mddescribed its corpus as tierA | B | CwithTraining + evaluationuse. These are held-out evaluation fixtures; nothing is trained from them, so the tier table read as a training-data governance record for something that is not training data. Replaced with a provenance statement — project-owned synthetic material only — written as a precondition for adding fixtures rather than an observation about the current contents.Also corrected
Two stale comments found along the way, both asserting the opposite of the code:
transforms/diff.rsclaimed the module was not wired into the crate.lib.rs:13haspub mod transforms;.tokenfold-adminclaimed atokenfold updatesubcommand wires its primitives. No such subcommand exists in the shipped binary.Verification
Run against a fresh clone of this branch, not the working tree:
cargo test --workspace --locked— 409 passed, 0 failedcargo fmt --all --check— cleancargo clippy --workspace --all-targets -- -D warnings— cleanpython eval/run_fidelity.py --gate --profile smoke-first-consumer— passci.ymlandrelease.ymlparse with all 8 and 9 jobs intactReviewer notes
tools/liststore_originalsdescription text changed. Nothing in the workspace asserts on it (verified repo-wide, and by running the server and parsing the response), but an external MCP client string-matching that description would notice.tokenfold mcp --helpandtokenfold filters verify --helpprint different text. No help-text assertions exist anywhere in the workspace.Err()messages fromvector::embedandocr_summarize, all of which carried dead identifiers into user-facing output. Nothing asserts on any of them; noshould_panicexists in the repo.CHANGELOG.mdis untouched, as is everyeval/tasks/**/*.jsonfixture.