content_definitions: roll back failed input counts (CONTENT-COUNTS-ATOMIC) #1180

Merged
leonida/mandy
Taffyyy-ops merged 1 commit from fix/content-counts-atomic into main 2026-11-29 00:54:59 +00:00

Pull request successfully merged and closed

Taffyyy-ops commented 2026-11-24 19:41:09 +00:00

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

  • python -I tests/test_content_counts_atomic.py: 2 tests passed; baseline reproduces three failure cases.
  • python -I tests/test_content_definitions.py: 12 tests passed.
  • python -I tests/test_text_write_line_endings.py: 3 tests passed.
  • python -I scripts/check_no_game_data.py and git diff --check: passed.
  • Synthetic inputs only; Windows 11, Python standard library. GPU not required.

AI-assisted: yes.

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 - python -I tests/test_content_counts_atomic.py: 2 tests passed; baseline reproduces three failure cases. - python -I tests/test_content_definitions.py: 12 tests passed. - python -I tests/test_text_write_line_endings.py: 3 tests passed. - python -I scripts/check_no_game_data.py and git diff --check: passed. - Synthetic inputs only; Windows 11, Python standard library. GPU not required. AI-assisted: yes.
abnalstlll-byte approved these changes 2026-11-24 19:42:45 +00:00
abnalstlll-byte left a comment

Reviewed and verified. Ensures atomic counting semantics in tools/content_definitions.py by rolling back in-progress counts when an input member fails midway, preventing partial contributions from corrupting aggregate statistics while keeping error reporting intact. Verified with tests/test_content_counts_atomic.py. 100% clean-room.

Reviewed and verified. Ensures atomic counting semantics in `tools/content_definitions.py` by rolling back in-progress counts when an input member fails midway, preventing partial contributions from corrupting aggregate statistics while keeping error reporting intact. Verified with `tests/test_content_counts_atomic.py`. 100% clean-room.
Deedlyy commented 2026-11-24 20:09:41 +00:00

Recommendation: [MERGE]

Reasoning: content_definitions rolls 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 with main. Merge once the queued checks are green.

Impact level: 2/10

**Recommendation:** [MERGE] **Reasoning:** `content_definitions` rolls 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 with `main`. Merge once the queued checks are green. **Impact level:** 2/10
Taffyyy-ops commented 2026-11-25 10:45:19 +00:00

@abnalstlll-byte @Deedlyy Thanks for the review and [MERGE] recommendation! No further changes needed on my side — ready once CI finishes.

@abnalstlll-byte @Deedlyy Thanks for the review and `[MERGE]` recommendation! No further changes needed on my side — ready once CI finishes.
zmasi commented 2026-11-28 22:35:32 +00:00

#1180 | head ba4eba84cfa4cc45916713bd6e56f6c5879dfd89 (merged cleanly with main adfb3821a2) | 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 != 1 across OSError, ContentError, and ValueError — documents yielded before a mid-directory failure remained in aggregate counts) | 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: yes

Audited ba4eba84cf (tools/content_definitions.py and tests/test_content_counts_atomic.py) on Windows 11 — first execution of this PR — confirming before_input = counts.copy() and counts = before_input on failure cleanly roll back flat integer counters (updating add(doc)'s closure cell for subsequent inputs) while incrementing failed_inputs and returning exit status 1. Also verified tests/test_ci_registration.py, tests/test_text_write_line_endings.py, and scripts/check_no_game_data.py.

#1180 | head ba4eba84cfa4cc45916713bd6e56f6c5879dfd89 (merged cleanly with main adfb3821a2) | `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 != 1` across `OSError`, `ContentError`, and `ValueError` — documents yielded before a mid-directory failure remained in aggregate `counts`) | 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: yes Audited `ba4eba84cf` (`tools/content_definitions.py` and `tests/test_content_counts_atomic.py`) on Windows 11 — first execution of this PR — confirming `before_input = counts.copy()` and `counts = before_input` on failure cleanly roll back flat integer counters (updating `add(doc)`'s closure cell for subsequent inputs) while incrementing `failed_inputs` and returning exit status `1`. Also verified `tests/test_ci_registration.py`, `tests/test_text_write_line_endings.py`, and `scripts/check_no_game_data.py`.
enlight3d commented 2026-11-29 00:44:18 +00:00

RUN for #1180 (red/green, synthetic inputs only, no build, no game, GPU not used)

Heads tested

  • PR head: ba4eba84cfa4cc45916713bd6e56f6c5879dfd89
  • main: 829530dbd0196aa817dbec74aaafc79407b94b57 (origin/main at the time of the run)
  • Merged test: PR head merged into that main with 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)

python -I tests/test_content_counts_atomic.py
python -I tests/test_content_definitions.py
python -I tests/test_missing_input_exit_codes.py
python -I tests/test_text_write_line_endings.py

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.

RUN for #1180 (red/green, synthetic inputs only, no build, no game, GPU not used) Heads tested - PR head: ba4eba84cfa4cc45916713bd6e56f6c5879dfd89 - main: 829530dbd0196aa817dbec74aaafc79407b94b57 (origin/main at the time of the run) - Merged test: PR head merged into that main with `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) ``` python -I tests/test_content_counts_atomic.py python -I tests/test_content_definitions.py python -I tests/test_missing_input_exit_codes.py python -I tests/test_text_write_line_endings.py ``` 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.
MoonEyes commented 2026-11-29 00:55:01 +00:00

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 main 6eddd58dd without conflict, and its test file(s) (tests/test_content_counts_atomic.py) pass there. Earlier today the same tests failed on main without the PR (red/green) and a bundle with other open PRs showed no new failures. check_no_game_data.py is clean. Windows 11, Python 3.14; no GPU needed for these tests.

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

Merged after **enlight3d**'s red/green check ([check](https://github.com/ProjectLeonida/mandy/pull/1180#issuecomment-7248317183)) (RTX 3090, driver 621.40, Windows 11) and a local re-check here. Merged after local re-verification: this PR merged onto `main` 6eddd58dd without conflict, and its test file(s) (`tests/test_content_counts_atomic.py`) pass there. Earlier today the same tests failed on `main` without the PR (red/green) and a bundle with other open PRs showed no new failures. `check_no_game_data.py` is clean. Windows 11, Python 3.14; no GPU needed for these tests. _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
Sign in to join this conversation.
No description provided.