Repository navigation
simplify(tests): use the shared user:// teardown guard in the dock-side backup suite - #539
Conversation
…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.
There was a problem hiding this comment.
{"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.
Motivation
Behavior-preserving simplify pass.
test_startup_dock_side_backup.gdpredates 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
_captured_user_data_restores_verbatim,_zero_byte_user_files_restore_verbatim), and teardown now call the existing harness helperscapture_user_data()/restore_user_data()fromtests/test_case.gd._capture_save_and_backups,_user_backup_file_names,_capture_file_text,_restore_save_and_backups,_restore_user_data(14 insertions, 96 deletions)._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
test_startup_dock_side_backup41 passed / 0 failed, exit 0, no SCRIPT ERROR.tests/test_*.gdsuite, same loop asjust 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_textduplicates (different contract than the harness's tri-state helpers — switching them would not be behavior-preserving).