Skip to content

test(backup): guard prune and create growth on long histories - #309

Merged
cpcloud merged 4 commits into
mainfrom
pr/scaling-7-backup-growth
Nov 5, 2026
Merged

cpcloud merged 4 commits into
mainfrom
pr/scaling-7-backup-growth

Conversation

@rodboev

@rodboev rodboev commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Backup tests now fail if prune or incremental create allocations grow too quickly as snapshot history gets longer. Each check builds histories of 100 and 1,000 incremental snapshots, with one new attachment per snapshot, and compares allocations between the two sizes. For create, the 100-snapshot history starts from a base snapshot of 900 attachments, so both sizes hold equal attachment counts.

On the code before the list segment growth fixes, prune allocates 173x more at 1,000 snapshots than at 100. With the fixes, the ratio drops to 33x, an 81% cut. Memoization alone leaves prune at 69x, so the prune check catches a regression in segment compaction as well as in memoization.

Allocation ratio, 1,000 vs 100 snapshots Before After Bound
Prune 173 33 50
Create 2.3 1.5 2

Prune visits each snapshot's growing attachment set, about N²/2 refs in total, so its bound allows a 1.5x margin over the measured 33x. Create runs against histories with equal live attachment counts, so its growth should stay flat. Its bound allows 2x.

Backup tests stopped short of histories that exposed repeated attachment
list decoding and unbounded segment growth. Allocation bounds let CI
catch those regressions without depending on runner timing.

Keep the live attachment count equal for incremental create so its
comparison measures history length. Prune retains growing attachment
sets to cover the reference walks that caused the earlier regression.
Future changes need to preserve the intended measurements when adapting
these checks. Document why prune exceeds linear growth and which
repository state incremental create inherits from the preceding check.
The incremental create check should measure its own history without
inheriting repository changes from prune. Independent fixtures make
that contract clear and avoid extra cache state in the test, at the
cost of building the large history twice.
Changing the large history must also change the small history's base
attachment count. Share that size so future adjustments keep the live
attachment totals equal and measure history growth alone.
@roborev-ci

roborev-ci Bot commented Nov 5, 2026

Copy link
Copy Markdown

roborev: Combined Review (7b4334b)

Verdict: No findings at or above medium severity.


Reviewers: 3x codex, codex (security), codex (test-value) | Synthesis: codex | Total: 3m0s

@rodboev
rodboev marked this pull request as ready for review November 5, 2026 09:37
@cpcloud
cpcloud merged commit dca075b into main Nov 5, 2026
15 checks passed
@cpcloud
cpcloud deleted the pr/scaling-7-backup-growth branch November 5, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants