Skip to content

Save-compat: count files, not directories, in baseline-write and fixture - #26

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/save-compat-count-files
Nov 10, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/save-compat-count-files

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

  • baseline-write and fixture in gates/save_compat.py now require at least one file. Previously both tested bool(digests(...)), and digests() records directories as "dir", so a baseline write that left only an empty slot_1/, or a fixture archive holding only directories, passed with 0 file(s) in the detail. This is the second, smaller case of Gates can pass having checked nothing: every consumer skipped, or saves with no files #21.
  • A file_count() helper replaces the two inline len([v for v ... if v != "dir"]) counts, so the number reported in the detail and the number the check tests are the same value.
  • The module docstring and the README save-compatibility section state the new rule.
  • New tests/test_save_compat_files.py covers file_count() over digests() output (empty slot directory, nothing written, mixed files and directories, an empty file).

Part of #21. The consumers half of #21 (every consumer skipped) is untouched: it needs the owner's choice between a new input and an unconditional control failure, so the issue stays open.

Verification

  • python3 -m unittest tests.test_save_compat_files tests.test_save_compat_migrations tests.test_save_compat_view: 24 tests, OK (Python 3.8, the interpreter this dispatch can run). CI runs the full suite on 3.12.
  • Mutation check: with file_count() changed to len(d) (the old entry-counting behaviour), 2 of the 4 new tests failed; with the file restored, all 4 passed.
  • Local gate run: UNVERIFIED. python3.12 and env-prefixed gate commands require an approval this headless dispatch cannot receive, so no real save_compat.py run against tak was made and no PASS/FAIL assertion lines can be quoted. The unit tests exercise file_count() but not the two result.check(...) call sites themselves.

Test plan

  • py_compile of the changed files; unit tests pass locally
  • CI (Check / compile) green on the PR head
  • Owner: a real save-compat run, e.g. REPOSITORY=Stephenson-Software/tak SHA=<tak main sha> BASELINE_REF=v0.2.0 SCENARIO=scenarios/tak_slots.py DISTRIBUTION=tak WORK=/tmp/prg-work python3.12 gates/save_compat.py, with baseline-write reading PASS ... N file(s) written for N > 0

Merge hold

This changes what an existing assertion (baseline-write, fixture) accepts, which is on the dev loop's do-not-auto-merge list, and the gate-run anchor could not run. The PR is therefore left open for owner review rather than merged. It is stricter only: no run that previously failed can now pass.

Skipped issues

This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

🤖 Generated with Claude Code


drafted by Claude on behalf of Daniel Stephenson

baseline-write and fixture tested bool(digests(...)), and digests() also
records directories, so a write leaving only an empty slot directory, or a
fixture archive of directories alone, passed with "0 file(s)". Both now
require at least one file. Part of #21 (the consumers half needs an owner
decision).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (head c332c81):

  • Scope: PASS — three files, all for Gates can pass having checked nothing: every consumer skipped, or saves with no files #21's save-data half: gates/save_compat.py (helper + two checks + docstring), README.md (one sentence), tests/test_save_compat_files.py (new).
  • Tests-new: PASS — file_count() is exercised by four tests in tests/test_save_compat_files.py.
  • Tests-fix: PASS, with a limit — the old behaviour was reproduced as a mutation (file_count → len(d), i.e. counting directories): 2 of 4 new tests failed; restored, 4/4 passed. The two result.check(...) call sites themselves are not unit-tested; only a real gate run reaches them.
  • Sibling structure: PASS — the new test module follows test_save_compat_migrations.py / test_save_compat_view.py (docstring, sys.path insert, import save_compat, unittest.TestCase).
  • Sibling renames: N/A — nothing renamed.
  • Docs: PASS — Phase 7 rows checked: README assertion list (names and order unchanged), README result.json keys (files / fixture.files keep their meaning, a count of files), module docstring (baseline-write and fixture lines updated), save-compat.yml header (does not describe either assertion; unchanged), CLAUDE.md (no env var or command changed). No row needed a correction beyond the commit itself.
  • Visuals: N/A — no README image.
  • Issue resolution: PASS — the PR says "Part of Gates can pass having checked nothing: every consumer skipped, or saves with no files #21", not Closes; the consumers half remains open for an owner decision.
  • CI + local gate run: UNVERIFIED — CI compile (py_compile + unittest discover on 3.12) is green on the head. The local save-compat run could not be made: python3.12 requires an approval this headless dispatch cannot receive.
  • Gate-run evidence: FAIL — no PASS/FAIL assertion lines can be quoted, for the reason above.
  • Input parity: N/A — no workflow touched.
  • Read-only: PASS — git grep -n "secrets\." .github/workflows is empty; no workflow changed.
  • Stdlib only: PASS — no new import in gates/.
  • No tag moved: PASS — no tag operation was performed.

Merge hold: baseline-write and fixture change what they accept (stricter only), which is on the do-not-auto-merge list, and the gate-run anchor is UNVERIFIED. Left open for the owner, with a real tak save-compat run requested in the test plan.

This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit 6fd5cee into main Nov 10, 2026
1 check passed
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