Skip to content

Close the backup mutation gate's thirteen survivors - #2102

Merged
stefan-burke merged 1 commit into
mainfrom
claude/backups-admin-panel-display-i33i8w
Aug 18, 2026
Merged

Close the backup mutation gate's thirteen survivors#2102
stefan-burke merged 1 commit into
mainfrom
claude/backups-admin-panel-display-i33i8w

Conversation

@stefan-burke

@stefan-burke stefan-burke commented Aug 18, 2026

Copy link
Copy Markdown
Member

Why

The mutation gate for #2101 finished after that PR merged (the run was interrupted by a container restart and re-run), scoring 97.2% with 13 survivors across the files it changed. Survivors on touched files are ours to close: each is either a real assertion gap or a proven equivalent. This PR does both — no production code changes, only tests and registry entries.

Seven real gaps, now pinned

  • Quote escaping in dumps (escapeSql '' → ""): nothing proved a dumped value's single quotes are doubled — broken escaping would corrupt every restore of real-world text. A settings row seeded with bound args (so nothing escapes the quote on the way in) now asserts 'O''Brien''s Gala' appears in the dumped SQL.
  • Keyset cursor (cursor =+=): a running-sum cursor agrees with the real one for the first two pages and only starts dropping rows from page three. A five-row, page-size-two export (three pages) now pins rowCount 5 and the last row's presence.
  • First-page cursor (tablePageStatement(table, 0, …)1): a cursor starting at 1 silently drops every table's first row from every backup. The listings dump now proves row one is included.
  • BACKUP_PAGE_SIZE env key (name → ""): the default page size is now asserted to actually read that variable.
  • Statement separator (join("\n")join("")): the newline between dumped statements is pinned.
  • storageZoneName ternary arms swapped: unit tests now hold both directions — the zone name under Bunny storage, null under local. (The whole-file mutation re-run for storage.ts was skipped as disproportionate for one two-line function; these two tests fail under any arm swap.)

Six proven equivalents, recorded

  • exportTable's colList initializer and its = → += assignment: the value is written in the rowCount === 0 branch before any read, that branch runs at most once, and "" + x === x.
  • suppliedPage ?? …||: the operand is BackupRow[] | undefined; arrays (even empty) are truthy and undefined is falsy, so both operators agree on every possible value.
  • The four backups-table column keys: the page renders the table without columnKeys, hiddenKeys, or filters, so the keys are never read — the same class as the questions table's recorded keys.

deno task check:equivalents confirms every new entry resolves to a real mutant. A targeted deno task mutation src/shared/db/backup-snapshot.ts … --harness re-run verifying all eight of that file's survivors is running; its score will be confirmed on this PR before merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01A5kRwqm349kpsgkcQLeSpw


Generated by Claude Code

Summary by CodeRabbit

  • Tests

    • Added coverage for backup exports, including quote escaping, pagination, cursor handling, default page sizes, and first-row inclusion.
    • Added tests confirming storage zone detection for hosted and local storage configurations.
  • Mutation Testing

    • Documented known-equivalent mutation cases for backup export logic and table rendering keys.

The gate on the backups PR finished after merge with 13 survivors across
the files it changed. Seven were real test gaps, now pinned:

- A dump did not prove it doubles single quotes, so broken escaping (and
  the corrupt restore it causes) went undetected. A settings row seeded
  with bound args now asserts the doubled quotes in the dumped SQL.
- The keyset cursor could become a running sum of last row ids and only
  misbehave from the third page on, silently dropping rows. A five-row,
  three-page export now pins the exact row count.
- createBackup's batched first pages could start their cursor at 1 and
  drop every table's first row. The listings dump now proves row one is
  included.
- The BACKUP_PAGE_SIZE env key and the newline between dumped statements
  were unasserted; both are now pinned.
- storageZoneName's ternary arms could swap unnoticed; unit tests now
  hold both directions (a zone name under Bunny, null under local).

The other six are proven equivalents, recorded in the registry: two
exportTable intermediates that are overwritten before any read, a
?? → || over an array-or-undefined operand, and the four backups-table
column keys, which the page never reads back (same class as the
questions table's recorded keys).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A5kRwqm349kpsgkcQLeSpw
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c0c51c3d-7569-48fa-82ee-7a96bc568ace

📥 Commits

Reviewing files that changed from the base of the PR and between fc51ab1 and ca9ed18.

📒 Files selected for processing (4)
  • scripts/mutation/equivalent-mutants/shared-db.txt
  • scripts/mutation/equivalent-mutants/ui-templates.txt
  • test/shared/db/backup-snapshot.test.ts
  • test/shared/storage/config.test.ts

Included review availability: 0 reviews are currently available. Based on recent review activity, included reviews refill at 3 per hour.


📝 Walkthrough

Walkthrough

The pull request adds regression tests for backup dump behavior and storage zone reporting. It also records equivalent mutations for backup export logic and backup table column keys.

Changes

Backup validation

Layer / File(s) Summary
Backup dump regression coverage
test/shared/db/backup-snapshot.test.ts
Tests cover quote escaping, paginated output, keyset cursors, default page sizes, and inclusion of each table’s first row.
Backup equivalent-mutant annotations
scripts/mutation/equivalent-mutants/shared-db.txt, scripts/mutation/equivalent-mutants/ui-templates.txt
The mutation catalogs document equivalent changes in exportTable and unused backup table column keys.

Storage zone validation

Layer / File(s) Summary
Storage zone reporting tests
test/shared/storage/config.test.ts
Tests verify the configured Bunny storage zone and null for local storage.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to ca9ed

This PR only adds test coverage and records proven equivalent mutations; it does not change production behavior, and no actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: closing 13 mutation survivors in the backup mutation gate.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/backups-admin-panel-display-i33i8w
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/backups-admin-panel-display-i33i8w

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Member Author

The verification run promised in the description has finished: deno task mutation src/shared/db/backup-snapshot.ts test/shared/db/backup-snapshot.test.ts --harness scores 100.0% — 51/51 mutants detected, 0 survived, with exactly the 3 recorded equivalents suppressed. All eight of that file's survivors from the #2101 gate are closed. deno task precommit (including check:equivalents) also passes on this branch.


Generated by Claude Code

@stefan-burke
stefan-burke added this pull request to the merge queue Aug 18, 2026
Merged via the queue into main with commit 78b30d6 Aug 18, 2026
3 checks passed
@stefan-burke
stefan-burke deleted the claude/backups-admin-panel-display-i33i8w branch August 18, 2026 03:43
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