content_definitions: roll back failed input counts (CONTENT-COUNTS-ATOMIC) #1180
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1180"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by Taffyyy-ops on 2026-11-24T19:41:09Z.
Claimed in the coordination issue as: CONTENT-COUNTS-ATOMIC
What and why
When a directory yields valid documents and then fails, its partial counts are currently included despite the input being marked failed. Restore the pre-input counters on failure while preserving completed inputs and the existing error status.
Tested
AI-assisted: yes.
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T19:42:45Z.
Review: APPROVED
Reviewed and verified. Ensures atomic counting semantics in
tools/content_definitions.pyby rolling back in-progress counts when an input member fails midway, preventing partial contributions from corrupting aggregate statistics while keeping error reporting intact. Verified withtests/test_content_counts_atomic.py. 100% clean-room.Imported from ubiquitarianism/leonida. Originally posted by Deedlyy on 2026-11-24T20:09:41Z.
Recommendation: [MERGE]
Reasoning:
content_definitionsrolls back an input's partial counts when that input later fails, so failed inputs no longer inflate the totals. Tiny tool fix (+4) with tests that reproduce the three failure cases. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict withmain. Merge once the queued checks are green.Impact level: 2/10
Imported from ubiquitarianism/leonida. Originally posted by Taffyyy-ops on 2026-11-25T10:45:19Z.
@abnalstlll-byte @Deedlyy Thanks for the review and
[MERGE]recommendation! No further changes needed on my side — ready once CI finishes.Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:35:32Z.
#1180 | head
ba4eba84cf(merged cleanly with mainadfb3821a2) |python -I tests/test_content_counts_atomic.py -v+python -I tests/test_content_definitions.py -v| red on main:FAILED (failures=3)(AssertionError: 2 != 1acrossOSError,ContentError, andValueError— documents yielded before a mid-directory failure remained in aggregatecounts) | green on PR+main:2 ran, OK(test_content_counts_atomic.py) +12 ran, OK(test_content_definitions.py) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yesAudited
ba4eba84cf(tools/content_definitions.pyandtests/test_content_counts_atomic.py) on Windows 11 — first execution of this PR — confirmingbefore_input = counts.copy()andcounts = before_inputon failure cleanly roll back flat integer counters (updatingadd(doc)'s closure cell for subsequent inputs) while incrementingfailed_inputsand returning exit status1. Also verifiedtests/test_ci_registration.py,tests/test_text_write_line_endings.py, andscripts/check_no_game_data.py.Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T00:44:18Z.
RUN for #1180 (red/green, synthetic inputs only, no build, no game, GPU not used)
Heads tested
ba4eba84cf829530dbd0(origin/main at the time of the run)git merge --no-edit --no-ff(local only, merge was clean, nothing pushed)Commands (one process per file, from the repo root, CPython 3.13.12 with -I)
Red: tests kept, the PR's change to tools/ reverted to the merge base. behavioural: with tools/content_definitions.py reverted, 3 sub-failures (failures=3, for OSError, ContentError and ValueError inputs): AssertionError 2 != 1, i.e. the failed directory keeps its partial counts.
Green at PR head: yes (tests/test_content_counts_atomic.py: 2 passed; test_content_definitions.py: 12 passed; test_missing_input_exit_codes.py: 2 passed; test_text_write_line_endings.py: 3 passed)
Green merged into main: yes, same files all pass on the merged tree (counts as above)
Plain main (other covering tests, without the PR): pass, so nothing pre-existing fails and nothing breaks once merged.
Kind of red: behavioural (test fails for the reason the PR fixes).
Machine: Windows 11 Pro 10.0.26300, CPython 3.13.12; GPU not used.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T00:55:01Z.
Merged after enlight3d's red/green check (check) (RTX 3090, driver 621.40, Windows 11) and a local re-check here. Merged after local re-verification: this PR merged onto
main6eddd58ddwithout conflict, and its test file(s) (tests/test_content_counts_atomic.py) pass there. Earlier today the same tests failed onmainwithout the PR (red/green) and a bundle with other open PRs showed no new failures.check_no_game_data.pyis clean. Windows 11, Python 3.14; no GPU needed for these tests.AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.