Repository navigation
Keep published families in their splits with a split lock - #47
Merged
Merged
Conversation
Fixes #35. Without stored state, an assignment that keeps existing families in place when families are added must depend on each family alone, and independent hashing can leave a small project without a test split. Quota slicing avoided that but reshuffled families whenever the project grew, so a rebuild could move held-out families into training. Record assignments instead, like a package lock file: - The first build assigns families by quota (unchanged split sizes) and writes project.splits.lock.json next to the specification. - Later builds pin every locked family, give new families a per-family hash split, and keep removed families in the lock so they return to their original split. - A recipe pin that contradicts the lock is an error; editing the lock is the deliberate way to move a family. - The lock is written only after a successful build. `build --locked-splits` fails instead of creating or changing it; CI uses it for the example, whose lock is committed. - `plan-recipe`, `impact`, and `update` resolve splits the same way, and `update` also carries the previous run's registry into the lock. Split planning moves into a dedicated `splits` module. A shared `Split` type replaces repeated literals, `generate_family` now requires the resolved split instead of silently recomputing an unlocked one, and `_build` computes the plan and engine fingerprint once. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
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.
Closes #35.
Behavior
The bug. When
recipe.family_splitswas empty, families were ranked by hash and sliced into quotas. Adding one family shifted the slice boundaries, so a rebuild withbuildcould move existing families between train, development, and test. A v2 dataset could then train on v1's test families.Why not just a different hash. Without stored state, an assignment that keeps every existing family in place when families are added must, by induction, depend on each family alone. That is independent hashing, and independent hashing can leave a small project without a test split, which is exactly why the quota assignment was introduced. Both properties cannot hold without remembering previous assignments.
The fix: a split lock, like a package lock file.
project.splits.lock.jsonnext to the specbuild --locked-splitsplan-recipe,impact, andupdateresolve splits the same way, so plans and builds agree.updatealso carries the previous run's cumulative registry into the lock.Code cleanup along the way:
generationinto a dedicatedsplitsmodule.Splittype replaces five copies ofLiteral["train", "development", "test"].generate_familynow requires the resolved split. It used to silently fall back to an unlocked assignment._buildcomputes the plan and the engine fingerprint once instead of three times.scenario_fingerprintrequires both arguments explicitly.Docs. Updated
docs/specification.md(new Split lock section),docs/index.md,docs/architecture.md, both READMEs, andCHANGELOG.md.Validation
New
tests/test_splits.py(11 tests):--locked-splitsrejects a missing or stale lock;updatekeeps removed families in the lock.Two existing tests now assert the stronger guarantees. The family-growth test checks that existing families keep their splits. The expansion test checks that the lock refuses the move, and that expansion import still refuses crossing splits after a deliberate lock edit.
Checks:
pytest: 287 passed, 4 skipped (optional extras not installed locally).ruff check,ruff format --check,mypy src(strict), andmkdocs build --strictpass.pre-commitandactionlintpass.decision-forge build examples/customer_support/project.yaml --output … --locked-splitssucceeds.Compatibility and data
update, which seeds the lock from the previous run's registry.plan-recipemade with older versions must be regenerated, because plan fingerprints now include the resolved splits.🤖 Generated with Claude Code