Skip to content

simplify(tests): use the shared user:// teardown guard in the dock-side backup suite - #539

Merged
joryirving merged 1 commit into
mainfrom
simplify/shared-teardown-guard
Nov 21, 2026
Merged

joryirving merged 1 commit into
mainfrom
simplify/shared-teardown-guard

Conversation

@itsmiso-ai

Copy link
Copy Markdown
Collaborator

Motivation

Behavior-preserving simplify pass. test_startup_dock_side_backup.gd predates the shared user:// teardown guard (issue #522) and still carries its own private copy of the machinery that guard was lifted from (PR #518 review pattern, per the suite headers of both files): a save+backups capture, the tri-state file reader, a backup-file lister, the snapshot re-application, and the settings restore.

Changes

  • Suite-start capture, both mid-run round-trip captures (_captured_user_data_restores_verbatim, _zero_byte_user_files_restore_verbatim), and teardown now call the existing harness helpers capture_user_data() / restore_user_data() from tests/test_case.gd.
  • Deleted the five superseded local helpers: _capture_save_and_backups, _user_backup_file_names, _capture_file_text, _restore_save_and_backups, _restore_user_data (14 insertions, 96 deletions).
  • The suite's own fixture read/write helpers (_read_text/_write_text) stay — no existing harness helper matches their contract.

Behavior notes (why this is safe)

The shared guard is a strict superset of the local copy: identical tri-state contract (string restored verbatim, absent-at-capture authorizes deletion, failed-read null never touches the file), plus settings-file, undo-slot, and crash-recovery-journal coverage the local copy lacked. No assertion in the suite observes settings/undo state mid-run, so the extra coverage is unobservable to the tests and strictly safer for developer data. Production code untouched.

Validation

  • Red state: suite passed 41/41 before the edit (Godot 4.7.1-stable, binary sha256-identical to prior runs).
  • Green: test_startup_dock_side_backup 41 passed / 0 failed, exit 0, no SCRIPT ERROR.
  • Full canonical matrix (every tests/test_*.gd suite, same loop as just validate / CI): 40/40 suites pass, exit 0.

Non-goals

No production changes, no fixture-value changes, no consolidation of the other suites' small _read_text/_write_text duplicates (different contract than the harness's tri-state helpers — switching them would not be behavior-preserving).

…de backup suite

test_startup_dock_side_backup.gd still carries its own pre-#522 copy of
the capture/restore teardown machinery (capture of save + backups,
tri-state file reader, backup listing, restore application, settings
restore). The shared harness guard in tests/test_case.gd was lifted from
exactly this pattern (issue #522) and is a strict superset: it also owns
the settings file, the restore-undo slot, and crash-recovery journaling.

Switch the suite's suite-start, mid-run round-trip, and teardown calls
to capture_user_data()/restore_user_data() and delete the five local
helpers (-82 net lines). No assertion changes; the suite's own fixture
writes (_read_text/_write_text) stay.

@its-saffron its-saffron Bot 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.

{"schema":"review-handoff/v1","review_id":"23e7474cc17349da","head_sha":"4e22e247839fbd4689c9e191d75663d1a165bce8","verdict":"approve","review_result":"clean","required_checks":"none","items":[],"items_total":0,"items_truncated":false,"unresolved_requirement_ids":[],"unresolved_requirement_ids_total":0,"unresolved_requirement_ids_truncated":false,"unresolved_requirement_ids_source_total":0,"unresolved_required_checks":[],"unresolved_required_checks_total":0,"unresolved_required_checks_truncated":false,"unresolved_required_checks_source_total":0,"unresolved_review_obligations":[],"unresolved_review_obligations_total":0,"unresolved_review_obligations_truncated":false,"derived_obligation_state":null}

AI Automated Review

✅ Automated recommendation: APPROVE

Full PR review.

Analysis engine: MiniMax-M3.1-Flash (anthropic) — primary route · pr-reviewer-action v3.10.0

Approve — the shared guard is a behavior-preserving replacement for the suite-local implementation.

  • Claim 1 held: capture_user_data()/restore_user_data() preserve the save, settings, undo slot, and backup-prefixed files using the same tri-state semantics, while adding crash-journal recovery.
  • Claim 2 unverified: “Validation” is a heading rather than an independently testable invariant.
  • Claim 3 unverified: the reported pre-edit 41/41 red-state run cannot be reconstructed from current-head evidence.
  • Claim 4 held: current-head Linux and Windows script-suite jobs succeeded through the full test-suite action; the exact author-reported local 40/40 count was not independently replayed.
  • Claim 5 held (4/4 items): the outer capture is the first executable operation in run_tests(), teardown restore is the final statement, and both nested capture/restore paths use the shared guard.

Tool Harness Findings

The harness read confirmed the shared helper’s tri-state capture and restore implementation, existing callers, and removal of the five superseded local helpers. The investigation was interrupted by the wall-clock reserve, but it found no concrete defect in the replacement.

Unknowns or Needs Verification

The pre-edit 41/41 execution and the author’s exact local 40/40 output are unavailable; current-head CI provides successful suite evidence.

Sources: PR diff, tests/test_case.gd, tests/test_startup_dock_side_backup.gd, tests/test_user_data_guard.gd, current-head CI results, and repository history.

@joryirving
joryirving merged commit bde0d07 into main Nov 21, 2026
14 checks passed
@joryirving
joryirving deleted the simplify/shared-teardown-guard branch November 21, 2026 18:45
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.

2 participants