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

Merged
Taffyyy-ops merged 1 commit from upstream-pr/1180 into main 2026-11-29 00:54:59 +00:00
Taffyyy-ops commented 2026-11-24 19:41:09 +00:00 (Migrated from github.com)

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

  • 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.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5479078216 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1180). Originally posted by [Taffyyy-ops](https://github.com/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 - 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 commented 2026-11-24 19:42:45 +00:00 (Migrated from github.com)

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.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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6046148284 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1180#pullrequestreview-6046148284). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T19:42:45Z. **Review:** APPROVED --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Deedlyy on 2026-11-24T20:09:41Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7143126026 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1180#issuecomment-7143126026). Originally posted by [Deedlyy](https://github.com/Deedlyy) on 2026-11-24T20:09:41Z. --- **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 (Migrated from github.com)

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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7160128214 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1180#issuecomment-7160128214). Originally posted by [Taffyyy-ops](https://github.com/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.
zmasi commented 2026-11-28 22:35:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:35:32Z.


#1180 | head ba4eba84cf (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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246843964 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1180#issuecomment-7246843964). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T22:35:32Z. --- #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 (Migrated from github.com)

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

  • PR head: ba4eba84cf
  • main: 829530dbd0 (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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248317183 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1180#issuecomment-7248317183). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-11-29T00:44:18Z. --- 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 (Migrated from github.com)

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 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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248439692 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1180#issuecomment-7248439692). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T00:55:01Z. --- 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 reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1180
No description provided.