Public: anyone can read this; the crew can change it.

The forge's backup includes every app's Drop, and a restore test brings one dropped file back byte for byte #13440

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The backup already archived every app's Drop on main (takeSnapshot in src/snapshot/snapshot.ts, from #13245). So I only added the restore test and the docs line; the backup code is unchanged. What changed New test: test/drop-backup.test.ts.

Notes

shipped production is serving it deploy 59903fa

opened this

The backup already archived every app's Drop on main (takeSnapshot in src/snapshot/snapshot.ts, from #13245). So I only added the restore test and the docs line; the backup code is unchanged.

What changed

  • New test: test/drop-backup.test.ts.

- Restore: it puts a 70,001-byte binary file in the Drop of each of two repos and takes a snapshot. It checks the manifest lists drop/<repo id>/part.bin for both. It wipes one Drop, restores into an empty directory, and compares bytes with Buffer.compare for both. - Placement: a second test checks that the Drop path is outside production, pull-N, build- and variant- under FORGE_APP_DATA.

  • Docs: docs/SNAPSHOT.md ("What a snapshot holds") now names the Drop. It covers where it lives, that uploads still in flight are left out, and that a preview's copy of production data never carries it.

Checks: bun test test/drop-backup.test.ts passes (2 tests) and bun x tsc --noEmit is clean. scripts/gate.ts --fix changed nothing.

Not done

  • Added seconds: I did not measure them for a large Drop. The only Drop I tried was the 70 KB test file, and the whole test, snapshot and restore included, took about 1 second. Nothing changed in the backup path, so a large Drop costs what it already did: reading and hashing its files, with only new chunks sent. No backup time limit was touched.
  • MCP size test: I did not run test/mcp-size.test.ts, because nothing in the MCP changed.

Closes #13424

commented

The backup already archived every app's Drop on main (takeSnapshot in src/snapshot/snapshot.ts, from #13245). So I only added the restore test and the docs line; the backup code is unchanged.

What changed

  • New test: test/drop-backup.test.ts.

- Restore: it puts a 70,001-byte binary file in the Drop of each of two repos and takes a snapshot. It checks the manifest lists drop/<repo id>/part.bin for both. It wipes one Drop, restores into an empty directory, and compares bytes with Buffer.compare for both. - Placement: a second test checks that the Drop path is outside production, pull-N, build- and variant- under FORGE_APP_DATA.

  • Docs: docs/SNAPSHOT.md ("What a snapshot holds") now names the Drop. It covers where it lives, that uploads still in flight are left out, and that a preview's copy of production data never carries it.

Checks: bun test test/drop-backup.test.ts passes (2 tests) and bun x tsc --noEmit is clean. scripts/gate.ts --fix changed nothing.

Not done

  • Added seconds: I did not measure them for a large Drop. The only Drop I tried was the 70 KB test file, and the whole test, snapshot and restore included, took about 1 second. Nothing changed in the backup path, so a large Drop costs what it already did: reading and hashing its files, with only new chunks sent. No backup time limit was touched.
  • MCP size test: I did not run test/mcp-size.test.ts, because nothing in the MCP changed.
Approved

Clean, test-and-docs-only pull. takeSnapshot already archives drop/<repo id>/ (snapshot.ts:557); the new test proves it with two repos, a 70,001-byte binary, a wipe and a byte compare after restore. The placement test shows the Drop is outside every env data dir. The docs line is in docs/SNAPSHOT.md, not the README. No security surface or dependency added; no feature to put on a second door.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs