Skip to content

shader_carve: restore previous payloads if index publication fails - #6031

Open
kacper-serewis wants to merge 2 commits into
ItsNotRexed:mainfrom
kacper-serewis:fix/shader-carve-publish
Open

kacper-serewis wants to merge 2 commits into
ItsNotRexed:mainfrom
kacper-serewis:fix/shader-carve-publish

Conversation

@kacper-serewis

Copy link
Copy Markdown
Contributor

Claim SHADER-CARVE-PUBLISH in coordination #5934.

Depends on: #5211

Stages the payloads and index on the destination volume. Cooperating writers publish one at a time under an exclusive directory guard. If a payload install or index replacement fails, the publisher restores overwritten files and removes newly installed names. Successful reruns keep the original filenames and index format. The first commit carries #5211 on current main. The second implements this follow-up.

Readers must coordinate with a publisher for a consistent snapshot during replacement. A process crash or a second filesystem failure during rollback can require manual recovery. A cleanup failure after the index commit leaves the new output published.

AI-assisted with Codex. Tested on Windows, CPU only, no GPU or graphics driver involved.

@SirKingg SirKingg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted independent review of 4ce1aa0, Windows (build 26300), Python 3.11.3; CPU only, no GPU or game data.

  • python -I tests\test_shader_carve.py: 34 passed, including the real Windows locked-index rollback and retry.
  • python -I tests\test_text_write_line_endings.py: 3 passed; git diff --check passed.
  • Independent synthetic fault injection: each of the five payload replace steps and the final index replace restored two old payloads and removed a new name. A second injected rollback failure preserved the guard and original backup; an injected post-commit guard-move failure left the new payload and index published.

Reviewed both commits, including the carried #5211 fix and its existing discussion. Readers still need coordination during publication; process crashes and actual hardware/filesystem failures during rollback were not tested. No blocking issue found.

@Koro4e

Koro4e commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

claiming: independent Windows review of PR #6031 at head 4ce1aa0040473bee6df35b1d4cd09b585a60daad (merge-base 561b65a83, 2 commits - the first carries #5211's OSError handling as the body says).

Verdict: pass.

  • python -m pytest tests/ -q -k "carve" at the head: 196 passed, 1 skipped (a pre-existing 8.3-short-name skip), 109 subtests; tests/test_shader_carve.py alone 34 passed, matching the body.
  • Negative control: the three new tests copied onto the merge-base all fail there and pass at the head - genuine regression tests.
  • Independent probes: the body's exact claim reproduces (locked index.json -> rc 1, old index and payloads byte-identical, nothing new installed, no guard left, immediate retry succeeds); a partial publication after row 1 installed restores row 1 in reverse order and leaves the blocking directory alone; a reader holding a payload gives a clean one-line failure; a second failure during the rollback leaves the guard with the remaining originals, exactly as the docstring says.
  • Body vs code: no overclaiming - the body is honest about the non-atomic window and crash recovery.

Three non-blocking notes from the probes:

  1. A cleanup failure after commit (the os.rename(backup, staging/previous) at tools/shader_carve.py:130) publishes everything but returns 1 and leaves .shader-publish behind, which wedges every rerun until manual removal; the docstring documents the published state but not the wedge.
  2. tools/shader_carve.py:103-105 reports every publication-phase OSError as ERROR: cannot write {out}: {e}, including guard conflicts and post-commit renames where the write actually succeeded - wording only, exit codes are consistent.
  3. Staged payloads are not fsync'd before the commit point (only index.json is) - pre-existing at the merge-base, noted for completeness.

Windows 11, Python 3.12.10, CPU only. No game files. AI-assisted.

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.

4 participants