Repository navigation
CONTRACT: feat(ui-sdk): read-only reference pool growth status (#3515) - #4064
Merged
Merged
Conversation
Background deduplication is rejected on the measured evidence of #3514, so residual growth is reported instead. `brain-native-store pool growth` and the manager client's `poolGrowth()` compare each worktree and each changed refresh with its chain's cold acquisition, and count the sources retained under one published name across views. Flags fire strictly above the ruled thresholds (25 %, 0.75x, more than two) and carry the measured bytes and the threshold. The status reads one stable observation without reconciling, so it commits, deletes, resets and reserves nothing. A basis it cannot read is unavailable, never zero, and a view name that resolves anywhere but a recorded sealed source in that view makes the whole status unavailable. Sealing now records each root's charge, so the basis survives the cold acquisition's release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Case 20 acquires a generated Odysseus repository cold into two views, keeps a worktree and a changed refresh within the thresholds (no flag), then grows each past its threshold and publishes a third copy (exactly three flags). It checks the recovery records are unchanged, the CLI projection matches, and planted view names that escape or point at a non-published root are refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ce (#3515) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-status # Conflicts: # docs/integration-contract.md
…-resume # Conflicts: # docs/decisions/reference-pool-accounting.md # docs/integration-contract.md # packages/ui-sdk/src/server/native-reference-pool.ts # scripts/native-proof/reference-pool.native.ts
#3515) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ro (#3515) A root the owner accounting has no charge for reported ownerBytes 0 in its comparison and in its retained-source group, contradicting the issue's unavailable-not-zero rule. Comparisons, source roots and their sums now carry null, and a retained-sources flag's observedBytes is null when its sum includes an unknown charge. The package-api component records the nullable fields; the growth status is still unreleased. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 15, 2026
Closed
Merged
…-resume # Conflicts: # docs/integration-contract.md # packages/ui-sdk/src/server/native-brain-manager-client.ts
schlessera
marked this pull request as ready for review
November 16, 2026 11:04
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3515
Resumes the ownerless draft #3806 (its approach still matches the issue and current main), with
origin/mainmerged and one correction. #3806 is closed in favour of this PR.What changed
The host-only reference pool gains a read-only residual-growth status:
brain-native-store pool growth <config>, the manager client'spoolGrowth()and theNativePoolGrowthtype.unavailable, and a root with no recorded owner charge reportsownerBytes: nullin its comparison, its retained-source group and that group's sum. So does any view name that does not resolve to a recorded sealed source in its own view: a path escape, a foreign view or a stale identity.reference-pool-accounting.mdrecords the rejection of background dedupe, with the three measured reasons.Why this shape
referenceSourceNamederives from a hash of the canonical repository and revision. The pool needs no new identity channel.reconcile, so it never commits an intent, removes a qgroup or deletes anything. The existingstatusdoes reconcile.omitted.Proof
Unit tests (
packages/ui-sdk/tests/native-reference-pool.test.ts, 20 pass, 160 assertions) on the merged tree:Correction in this PR (
da9a7d64d). Review of the resumed code found that a root missing from the owner accounting reportedownerBytes: 0in its comparison and its retained-source group (owner.get(...) ?? 0). That breaks the unavailable-not-zero criterion. Those fields are nownumber | null, a group's sum is null when any root is unknown, and a retained-sources flag'sobservedBytesis null only in that case. The status is unreleased, so this amends the additive contract text inpackage-api.mdand the decision record. Instance sweep: the only other?? 0inreferencePoolGrowthwas the source-group charge, fixed in the same commit; the reply-size and threshold paths carry no default.Mutations re-run on the merged tree, each restored to green (file compared byte-identical afterwards):
REFERENCE_POOL_GROWTH_WORKTREE_FLAG,_RULED_THRESHOLDS,_LIVE_SEALED_BASIS,_FLAGS_KEPTREFERENCE_POOL_GROWTH_REFRESH_FLAG,_RULED_THRESHOLDS>→>=on ratio flagsREFERENCE_POOL_GROWTH_AT_THRESHOLD_IS_CLEAN>→>=REFERENCE_POOL_GROWTH_SOURCES_PER_NAME,_AT_THRESHOLD_IS_CLEAN,_FLAGS_KEPT0REFERENCE_POOL_GROWTH_BROKEN_CHAIN?? 0(the pre-fix code)REFERENCE_POOL_GROWTH_MISSING_SOURCE_CHARGE_NOT_ZERO?? 0(the pre-fix code)REFERENCE_POOL_GROWTH_MISSING_CHARGE_NOT_ZEROThe last two are the failing-first receipts for the correction.
Native case 20 in
scripts/native-proof/reference-pool.native.tsruns on owned Btrfs in hostedruntime_host, using generated Odysseus repositories:pool growthchild exits 0 with the same flags.Earlier hosted draft heavy feedback on #3806 (run 42652529226 at
6b8057ddd; feedback, not proof):runtime_hostgreen with case 20. Receipts fromreference-pool-receipts.json:The cold-acquisition basis is 8,638,464 bytes. Every charge in that run is present, so the null correction does not change these receipts. The native proof cells re-run on this PR's own main squash under the hybrid ruling.
tsc --noEmitandbun run buildare clean;api-report/ui-server.txtis regenerated. Moved citations inreference-pool-accounting.mdare repointed and passscripts/check-citations.ts.Collision check at
da9a7d64d(bun scripts/collisions.ts --json --pr 4064):scripts/native-proof/reference-pool.native.ts, epic Epic: repository trust is bound to verified Git acquisition and actual source bytes #3598's managed-references work) and CONTRACT: feat(ui-sdk,ui-server): place a turn's data tree on the managed volume by reflink (#2911) #4050 (docs/integration-contract.md,native-brain-manager-client.ts). Whichever lands second merges the other; neither branch is edited here.Refreshed at
b765c7484by mergingorigin/mainafter #4050 (#2911) landed: the contract index keeps both sections and the manager client imports bothNativeTurnTreeandNativePoolGrowth. Typecheck, build, the focused tests andcheck:prpass on the merge; the API reports regenerate unchanged.{"version":1,"kind":"brain-check-pr-receipt","head":"b765c7484a0ac13b6ccc6ddeb4b2c6bf618d15cd","base":"origin/main","mode":"focused","startedAt":"2026-11-16T10:36:00.103Z","finishedAt":"2026-11-16T10:37:35.741Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":14010.083887999997},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":137.53559200000018},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":115.56942999999956},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":34.26930899999934},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":81320.698153}]}Checklist
docs/reflect the change, or nothing documented moved.docs/decisions/provider-history.md): the provider-history guard passes, or nothing on a turn's path changed.Anything left open
Nothing. #3513 remains open for its own criteria; none of them is an input to this status.
🤖 Generated with Claude Code