Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: preserve whole checkouts through verified native transactions (#13492)
picodot791cd8299224
diff --git a/docs/features/branch-reconciliation.md b/docs/features/branch-reconciliation.mdindex b14d681cb2..654ccdc685 100644--- a/docs/features/branch-reconciliation.md+++ b/docs/features/branch-reconciliation.md@@ -456,3 +456,25 @@ archive identity and timestamp so a newer checkout obligation cannot be satisfieby replaying an older retirement. Interrupted transactions outside the machine-verified continuation aboverequire explicit status and recovery; ambiguous identities remain held. Theprivate journal and all copies remain available after success or recovery.++## Whole-checkout preservation++For a reviewed checkout that exceeds the ordinary archive byte bounds, the+explicit `POST /api/cos/schedule/branch-reconcile/whole-checkouts/review` and+`whole-checkouts/retire` endpoints use the initialized-checkout transaction+backend without requiring an initialized submodule. They accept the same exact+inventory tuple, PR URL and review confirmation as the initialized endpoints.+Their reviews are distinct: a digest from another preservation mode is refused.++This path retains the backend's source-byte and writable-capacity bounds,+ownership checks, complete metadata capture, standalone object proof, quarantine+and branch-retirement receipt. Uninitialized gitlink paths may be absent or+contain ordinary files; all present files are preserved. Actual embedded Git+stores and external object dependencies retain their existing refusal rules.+The ordinary archive limits and initialized-only endpoint remain unchanged.++Status, rollback, independent archive verification and later branch retirement+use the existing `initialized-checkouts` transaction endpoints with the returned+transaction ID and a fresh journal digest. A failed preservation attempt is+unverified and retains its originals and partial evidence; it is not successful+cleanup. No archive deletion or retention policy is added by these endpoints.diff --git a/scripts/lib/initialized_checkout_archive.py b/scripts/lib/initialized_checkout_archive.pyindex 04d1fe7b60..8a156b9af8 100644--- a/scripts/lib/initialized_checkout_archive.py+++ b/scripts/lib/initialized_checkout_archive.py@@ -55,6 +55,10 @@ def git(admin, work, *args, objects=None, input_data=None, expected_returncode=0env['GIT_OBJECT_DIRECTORY'] = str(objects)return command(['git', '--no-optional-locks', '--git-dir', str(admin),'--work-tree', str(work), '-c', 'core.fsmonitor=false',+ # Graphs are disposable acceleration metadata and can retain+ # pruned commits. Preserve their exact bytes, but prove real+ # refs, reflogs and indexes from the actual object stores.+ '-c', 'core.commitGraph=false','-c', 'core.hooksPath=' + os.devnull, *args], env, input_data,expected_returncode=expected_returncode).strip()@@ -534,6 +538,7 @@ def inspect(request, full=False):if locked and lock.read_text().strip() != (release.get('lockReason') or ''):fail('release-lock-reason-changed')modules = []+ whole_checkout = request.get('wholeCheckout') is True or request.get('expected', {}).get('wholeCheckout') is Truefor item in git(admin, work, 'ls-files', '--stage', '-z').split('\0'):if not item:continue@@ -543,7 +548,15 @@ def inspect(request, full=False):continueif stage != '0' or os.path.isabs(relative) or '..' in Path(relative).parts:fail('unmerged-or-unsafe-module')- module_work = safe_path(str(work / relative))+ candidate = work / relative+ # An uninitialized gitlink may be absent or contain ordinary local+ # files. Capture those bytes without pretending it is a repository.+ # Any actual pointer/store still goes through the strict module checks.+ if whole_checkout and not os.path.lexists(candidate / '.git'):+ if os.path.lexists(candidate):+ safe_path(str(candidate))+ continue+ module_work = safe_path(str(candidate))module_admin = read_pointer(module_work / '.git', 'gitdir:')if not module_admin.is_relative_to(admin / 'modules'):fail('external-module-administration')@@ -555,7 +568,7 @@ def inspect(request, full=False):'administrationPath': str(module_admin.relative_to(admin)),'identity': {'working': identity(module_work), 'administration': identity(module_admin)},'gitlink': oid, **facts})- if not modules:+ if not modules and not whole_checkout:fail('initialized-module-required')expected_pointers = {'.git', *(m['path'] + '/.git' for m in modules)}for current, dirs, files in os.walk(work, followlinks=False):@@ -576,6 +589,8 @@ def inspect(request, full=False):facts = {'identity': {'working': identity(work), 'administration': identity(admin), 'common': identity(common)},'privateGitDir': str(admin), 'commonGitDir': str(common), 'modules': modules, 'parent': parent,'repoPath': request['repoPath'], 'release': release}+ if whole_checkout:+ facts['wholeCheckout'] = Truefacts['administrationFingerprint'] = digest(sources['administration'])facts['fingerprint'] = digest({'facts': facts, 'sources': sources})return {**facts, **({'sources': sources} if full else {})}diff --git a/scripts/lib/initialized_checkout_archive_test.py b/scripts/lib/initialized_checkout_archive_test.pyindex fdf9a11c1c..575756a494 100644--- a/scripts/lib/initialized_checkout_archive_test.py+++ b/scripts/lib/initialized_checkout_archive_test.py@@ -121,6 +121,48 @@ class NativeArchive(unittest.TestCase):self.request['manifestSha256'] = proof['manifestSha256']return proof+ def test_whole_checkout_preserves_uninitialized_gitlink_bytes_and_restores_offline(self):+ module_admin = archive.read_pointer(self.work / 'sub/.git', 'gitdir:')+ shutil.rmtree(self.work / 'sub')+ shutil.rmtree(module_admin)+ self.request['wholeCheckout'] = True+ self.assertEqual(archive.inspect(self.request)['modules'], [])+ del self.request['wholeCheckout']+ (self.work / 'sub').mkdir()+ (self.work / 'sub/unpublished.bin').write_bytes(b'private uninitialized content')+ with self.assertRaises(FileNotFoundError):+ archive.inspect(self.request) # Existing initialized-only contract.+ self.request['wholeCheckout'] = True+ proof = self.preserve()+ self.assertEqual(len(proof['restoreProof']), 1)+ self.assertTrue(archive.verify(self.request)['verified'])+ self.assertEqual((self.txn / 'archive/working/sub/unpublished.bin').read_bytes(),+ b'private uninitialized content')+ for part in ['working', 'administration']:+ archive.move({**self.request, 'part': part, 'direction': 'quarantine'})+ self.assertFalse(self.work.exists())+ self.assertTrue(archive.verify({**self.request, 'mode': 'standalone'})['standalone'])+ for part in ['administration', 'working']:+ archive.move({**self.request, 'part': part, 'direction': 'restore'})+ self.assertEqual((self.work / 'sub/unpublished.bin').read_bytes(), b'private uninitialized content')+ self.assertTrue(archive.verify(self.request)['verified'])++ def test_stale_commit_graph_is_preserved_but_cannot_substitute_for_indexed_objects(self):+ orphan = self.git(self.repo, 'commit-tree', 'HEAD^{tree}', '-p', 'HEAD', '-m', 'disposable cached commit')+ self.git(self.repo, 'update-ref', 'refs/fixture/graph-only', orphan)+ self.git(self.repo, 'commit-graph', 'write', '--reachable')+ self.git(self.repo, 'update-ref', '-d', 'refs/fixture/graph-only')+ (self.repo / '.git/objects' / orphan[:2] / orphan[2:]).unlink()+ graph = (self.repo / '.git/objects/info/commit-graph').read_bytes()+ self.preserve()+ self.assertEqual((self.txn / 'archive/common/objects/info/commit-graph').read_bytes(), graph)+ self.assertTrue(archive.verify(self.request)['verified'])+ saved = json.loads((self.txn / 'manifest.json').read_text())+ index_blob = self.git(self.work, 'rev-parse', ':staged.txt')+ (self.txn / 'restore/common/objects' / index_blob[:2] / index_blob[2:]).unlink()+ with self.assertRaisesRegex(RuntimeError, 'missing-or-invalid-index-object|missing blob'):+ archive.proof_repositories(self.txn, saved['facts'])+def test_admission_bookkeeping_does_not_change_source_review(self):before = archive.inspect(self.request)admission = Path(before['commonGitDir']) / 'portos-checkout-admission'diff --git a/server/lib/hostControlRoutes.js b/server/lib/hostControlRoutes.jsindex 98a4f7e51a..7cbc46971e 100644--- a/server/lib/hostControlRoutes.js+++ b/server/lib/hostControlRoutes.js@@ -502,6 +502,8 @@ export const HOST_CONTROL_ROUTES = Object.freeze(['POST /api/cos/schedule/branch-reconcile/checkouts/review','POST /api/cos/schedule/branch-reconcile/initialized-checkouts/review','POST /api/cos/schedule/branch-reconcile/initialized-checkouts/retire',+ 'POST /api/cos/schedule/branch-reconcile/whole-checkouts/review',+ 'POST /api/cos/schedule/branch-reconcile/whole-checkouts/retire','GET /api/cos/schedule/branch-reconcile/initialized-checkouts/status','POST /api/cos/schedule/branch-reconcile/initialized-checkouts/restore','POST /api/cos/schedule/branch-reconcile/initialized-checkouts/review-metadata-restore',diff --git a/server/routes/cosScheduleRoutes.js b/server/routes/cosScheduleRoutes.jsindex 81da4ec2e2..0da6e50018 100644--- a/server/routes/cosScheduleRoutes.js+++ b/server/routes/cosScheduleRoutes.js@@ -337,6 +337,23 @@ router.post('/schedule/branch-reconcile/initialized-checkouts/retire', asyncHandres.status(result.ok ? 200 : 409).json(result);}));+// Explicit whole-checkout preservation uses the same journal, byte/capacity+// bounds, metadata proof, quarantine and recovery as initialized modules. The+// ordinary archive limits and existing initialized-only endpoint stay intact.+router.post('/schedule/branch-reconcile/whole-checkouts/review', asyncHandler(async (req, res) => {+ const { appId, prUrl, ...release } = validateRequest(heldCheckoutReviewBodySchema.omit({ kind: true }).strict(), req.body);+ const { reviewInitializedCheckout } = await import('../services/initializedCheckoutRecovery.js');+ const result = await reviewInitializedCheckout({ appId, release, prUrl, wholeCheckout: true });+ res.status(result.ok ? 200 : 409).json(result);+}));++router.post('/schedule/branch-reconcile/whole-checkouts/retire', asyncHandler(async (req, res) => {+ const { appId, review, ...release } = validateRequest(initializedCheckoutRetireBodySchema, req.body);+ const { retireInitializedCheckout } = await import('../services/initializedCheckoutRecovery.js');+ const result = await retireInitializedCheckout({ appId, release, review, wholeCheckout: true });+ res.status(result.ok ? 200 : 409).json(result);+}));+router.get('/schedule/branch-reconcile/initialized-checkouts/status', asyncHandler(async (req, res) => {const input = validateRequest(initializedCheckoutTransactionSchema, req.query);const { initializedCheckoutStatus } = await import('../services/initializedCheckoutRecovery.js');diff --git a/server/routes/cosScheduleRoutes.test.js b/server/routes/cosScheduleRoutes.test.jsindex e3face121b..c37515ca0a 100644--- a/server/routes/cosScheduleRoutes.test.js+++ b/server/routes/cosScheduleRoutes.test.js@@ -131,6 +131,21 @@ describe('CoS Schedule Routes', () => {expect(response.body.context).toEqual({ reason: result.reason, archiveLimit: result.archiveLimit, nextAction: result.nextAction });});+ it('requires exact proof for whole-checkout preservation without changing the ordinary route contract', async () => {+ const base = '/api/cos/schedule/branch-reconcile/whole-checkouts';+ const tuple = { path: '/synthetic/checkout', head: 'a'.repeat(40), branch: 'claim/42', locked: false, lockReason: null };+ const prUrl = 'https://github.com/example/repo/pull/42';+ initialized.reviewInitializedCheckout.mockResolvedValue({ ok: true, review: { digest: 'b'.repeat(64) } });+ expect((await request(app).post(`${base}/review`).send({ appId: 'app', ...tuple, prUrl })).status).toBe(200);+ expect(initialized.reviewInitializedCheckout).toHaveBeenCalledWith({ appId: 'app', release: tuple, prUrl, wholeCheckout: true });+ expect((await request(app).post(`${base}/retire`).send({ appId: 'app', ...tuple })).status).toBe(400);+ expect(initialized.retireInitializedCheckout).not.toHaveBeenCalled();+ const review = { prUrl, digest: 'b'.repeat(64), acceptSuperseded: false };+ initialized.retireInitializedCheckout.mockResolvedValue({ ok: false, reason: 'active-owner' });+ expect((await request(app).post(`${base}/retire`).send({ appId: 'app', ...tuple, review })).status).toBe(409);+ expect(initialized.retireInitializedCheckout).toHaveBeenCalledWith({ appId: 'app', release: tuple, review, wholeCheckout: true });+ });+it('requires exact review and journal proofs for explicit initialized checkout operations', async () => {const base = '/api/cos/schedule/branch-reconcile/initialized-checkouts';const tuple = { path: '/synthetic/checkout', head: 'a'.repeat(40), branch: 'claim/42', locked: false, lockReason: null };diff --git a/server/services/branchCompletionPolicy.js b/server/services/branchCompletionPolicy.jsindex a8cb4d45d9..be2d7fd6fa 100644--- a/server/services/branchCompletionPolicy.js+++ b/server/services/branchCompletionPolicy.js@@ -151,6 +151,10 @@ function reviewedOrphanCheckout(policy, input) {// An orphan's captured generation may belong to a different checkout of the// same delivered head. It cannot transfer its cleanup obligation to an explicit// detached-copy review. Keep its result and original cleanup record unchanged.+const sameReviewedPath = (a, b, input) => samePath(a, b)+ || (typeof a === 'string' && typeof b === 'string' && Boolean(input.checkoutIdentities?.[a])+ && input.checkoutIdentities[a] === input.checkoutIdentities[b]);+function completedOrphanSibling(policy, input) {const agent = policy.agent;if (!/^[a-f0-9]{64}$/.test(input.detachedCheckoutIdentity || '')@@ -158,9 +162,9 @@ function completedOrphanSibling(policy, input) {|| (policy.tip && policy.tip !== input.tip) || agent.status !== 'completed' || agent.result?.orphaned !== true|| agent.result.validationPassed === false || policy.completion !== PR_COMPLETIONS.REVIEW_THEN_MERGE) return false;return agent.metadata?.completedCheckouts?.some(row => row.version === 2 && completedCheckoutReceiptValid(agent, row)- && samePath(row.repoPath, input.repoPath) && row.branch === input.branch && row.head === input.tip- && samePath(row.path, agent.metadata.workspacePath) && !samePath(row.path, input.checkoutPath)- && !samePath(row.path, input.repoPath) && row.incarnation?.pointer+ && sameReviewedPath(row.repoPath, input.repoPath, input) && row.branch === input.branch && row.head === input.tip+ && sameReviewedPath(row.path, agent.metadata.workspacePath, input) && !sameReviewedPath(row.path, input.checkoutPath, input)+ && !sameReviewedPath(row.path, input.repoPath, input) && row.incarnation?.pointer&& createHash('sha256').update(JSON.stringify(['dev', 'ino', 'birthtimeNs'].map(key => row.incarnation.pointer[key]))).digest('hex') !== input.detachedCheckoutIdentity) === true;}diff --git a/server/services/heldCheckoutRecovery.js b/server/services/heldCheckoutRecovery.jsindex e8a5b2cfd0..424e177db9 100644--- a/server/services/heldCheckoutRecovery.js+++ b/server/services/heldCheckoutRecovery.js@@ -510,7 +510,16 @@ async function retirementPolicy(repoPath, branch, opts, reviewIdentity = {}) {const scopes = [meta.worktreeBranch, meta.jiraBranch, meta.claimBranch, meta.branchCompletionPolicy?.branch,...(Array.isArray(meta.claimBranches) ? meta.claimBranches : []),...(Array.isArray(meta.claimReleasedBranches) ? meta.claimReleasedBranches : [])];- if (scopes.includes(branch) && isAbsolute(meta.workspacePath || '')) paths.add(meta.workspacePath);+ if (scopes.includes(branch)) {+ if (isAbsolute(meta.workspacePath || '')) paths.add(meta.workspacePath);+ // Receipt capture canonicalizes filesystem names. Windows short names+ // and other existing aliases need the same server-observed identity+ // comparison as the current checkout, never textual guessing.+ for (const row of Array.isArray(meta.completedCheckouts) ? meta.completedCheckouts : []) {+ if (row?.version !== 2 || row.branch !== branch) continue;+ for (const path of [row.repoPath, row.path]) if (isAbsolute(path || '')) paths.add(path);+ }+ }}// A failed identity read or excessive history cannot prove distinctness.// Missing paths resolve through their existing canonical ancestor, the samediff --git a/server/services/heldCheckoutRecovery.test.js b/server/services/heldCheckoutRecovery.test.jsindex 62ea7c9115..37f92005db 100644--- a/server/services/heldCheckoutRecovery.test.js+++ b/server/services/heldCheckoutRecovery.test.js@@ -2096,7 +2096,7 @@ describe.skipIf(SKIP_HEAVY_INTEGRATION)('held checkout recovery (real git)', ()expect(await readFile(join(result.archiveDir, 'files/ignored.txt'), 'utf8')).toBe('ignored work\n');});- it.each(['confirmed', 'missing-receipt', 'same-incarnation', 'human-handoff', 'active-owner'])('keeps an orphan sibling obligation separate from a detached copy: %s', async scenario => {+ it.each(['confirmed', 'owner-alias', 'missing-receipt', 'same-incarnation', 'human-handoff', 'active-owner'])('keeps an orphan sibling obligation separate from a detached copy: %s', async scenario => {const c = await reviewedCheckout(`orphan-sibling-${scenario}`);const namedPath = c.path;const namedBranch = c.release.branch;@@ -2110,7 +2110,12 @@ describe.skipIf(SKIP_HEAVY_INTEGRATION)('held checkout recovery (real git)', ()agent.result = { success: false, executionSuccess: false, orphaned: true, validationPassed: null };agent.metadata.completedCheckouts = await evidence.captureSeededCompletionCheckouts(agent);expect(agent.metadata.completedCheckouts).toHaveLength(1);- const path = join(external, `detached-${scenario}`);+ if (scenario === 'owner-alias') {+ const alias = join(external, 'canonical-owner-alias');+ await symlink(namedPath, alias, 'junction');+ agent.metadata.workspacePath = alias;+ }+ let path = join(external, `detached-${scenario}`);if (scenario === 'same-incarnation') {const pointerIdentity = await readRetirementCheckoutIdentity(namedPath);await execGit(['worktree', 'move', namedPath, path], repo);@@ -2121,6 +2126,10 @@ describe.skipIf(SKIP_HEAVY_INTEGRATION)('held checkout recovery (real git)', ()await execGit(['worktree', 'add', '--detach', path, c.release.head], repo);await writeFile(join(path, 'ignored.txt'), 'distinct detached work\n');}+ // Real inventories use Git's observed spelling. Windows temp paths can+ // differ from that registration (including short names and drive casing).+ path = (await execGit(['rev-parse', '--show-toplevel'], path)).stdout.trim();+ expect(await registered(path)).toBe(true);const release = { path, branch: null, head: c.release.head, locked: false, lockReason: null };c.forge.publishedBranch = namedBranch; c.forge.exactAliasHead = release.head;injected.policies = [agent];@@ -2129,10 +2138,11 @@ describe.skipIf(SKIP_HEAVY_INTEGRATION)('held checkout recovery (real git)', ()if (scenario === 'active-owner') { agent.status = 'running'; c.opts.readAgents = async () => [agent]; }await recordBranchReconcileOutcome('app-1', { status: 'incomplete', remaining: [{ ...release, reason: 'worktree-unmanaged-location' }] });const prepared = await prepareInventoriedCheckoutRetirement({ appId: 'app-1', release, prUrl: c.forge.prUrl }, c.opts);- if (scenario !== 'confirmed') {+ if (!['confirmed', 'owner-alias'].includes(scenario)) {expect(prepared.ok).toBe(false); expect(await registered(path)).toBe(true); expect(await archives()).toEqual([]);return;}+ expect(prepared.reason).toBeUndefined();expect(prepared).toMatchObject({ ok: true, review: { policy: { policies: [{ success: false, orphanedSibling: true }] } } });const result = await retireInventoriedCheckout({ appId: 'app-1', release,review: { prUrl: c.forge.prUrl, digest: prepared.review.digest, acceptSuperseded: false } }, c.opts);diff --git a/server/services/initializedCheckoutRecovery.js b/server/services/initializedCheckoutRecovery.jsindex 47e4ee12e9..b42df1b667 100644--- a/server/services/initializedCheckoutRecovery.js+++ b/server/services/initializedCheckoutRecovery.js@@ -200,15 +200,16 @@ export function _createInitializedCheckoutRecovery(deps = {}) {if (!result.ok) fail(result.reason);return result.policy;};- const makeReview = async ({ appId, release, prUrl }) => {+ const makeReview = async ({ appId, release, prUrl, wholeCheckout = false }) => {const ctx = await context(appId, release);const policy = await ensureOwner(ctx, release);- const snapshot = await native({ command: 'inspect', repoPath: ctx.repoPath, release, requireOwnership: true });+ const snapshot = await native({ command: 'inspect', repoPath: ctx.repoPath, release, requireOwnership: true,+ ...(wholeCheckout && { wholeCheckout: true }) });const facts = await forge(ctx, release, prUrl);const base = await comparison(ctx, release, prUrl, snapshot, policy, facts);const checkoutIdentity = await readRetirementCheckoutIdentity(release.path);if (release.checkoutIdentity && release.checkoutIdentity !== checkoutIdentity) fail('checkout-identity-changed');- const evidence = { ...base, mode: 'initialized-private-modules', snapshot,+ const evidence = { ...base, mode: wholeCheckout ? 'whole-checkout' : 'initialized-private-modules', snapshot,...(checkoutIdentity && { checkoutIdentity }) };delete evidence.digest;return { ctx, review: { digest: hash(evidence), ...evidence } };@@ -589,7 +590,8 @@ export function _createInitializedCheckoutRecovery(deps = {}) {|| cancellationProof.archiveVerified !== false || cancellationProof.contentAndMetadataUnverified !== true|| cancellationProof.partialArchivesRetained !== true) fail('retirement-cancellation-proof-invalid');} else {- const snapshot = await native({ command: 'inspect', repoPath: ctx.repoPath, release: state.release });+ const snapshot = await native({ command: 'inspect', repoPath: ctx.repoPath, release: state.release,+ ...(state.review.snapshot.wholeCheckout && { wholeCheckout: true }) });if (JSON.stringify(snapshot) !== JSON.stringify(state.review.snapshot)) {// Ordinary restore retains its original unchanged-content proof.if (state.proof?.manifestSha256 || state.phase === 'preserved') fail('retirement-source-changed');@@ -876,7 +878,7 @@ export function _createInitializedCheckoutRecovery(deps = {}) {|| !isAbsolute(state.repoPath || '') || !isAbsolute(state.release?.path || '')|| typeof state.release?.branch !== 'string' || !state.release.branch|| !/^[a-f0-9]{40}(?:[a-f0-9]{24})?$/.test(state.release?.head || '')- || original?.mode !== 'initialized-private-modules' || original.digest !== hash(unsigned)+ || !['initialized-private-modules', 'whole-checkout'].includes(original?.mode) || original.digest !== hash(unsigned)|| !sameRelease(original.release, state.release)) fail('retirement-journal-binding-invalid');const ctx = await context(state.appId);if (ctx.repoPath !== state.repoPath) fail('retirement-transaction-app-mismatch');diff --git a/server/services/initializedCheckoutRecovery.test.js b/server/services/initializedCheckoutRecovery.test.jsindex c86309166e..64860fd6d5 100644--- a/server/services/initializedCheckoutRecovery.test.js+++ b/server/services/initializedCheckoutRecovery.test.js@@ -201,6 +201,25 @@ const reviewed = async () => {};describe('initialized checkout transaction', () => {+ it('binds whole-checkout admission to a distinct review before the existing durable retirement flow', async () => {+ const native = vi.fn(async input => {+ const result = await fixture.deps.native(input);+ return input.command === 'inspect' && input.wholeCheckout ? { ...result, wholeCheckout: true } : result;+ });+ const service = _createInitializedCheckoutRecovery({ ...fixture.deps, native });+ const ordinary = await reviewed();+ const input = { appId: 'app', release, prUrl, wholeCheckout: true };+ const prepared = await service.review(input);+ expect(prepared.review).toMatchObject({ mode: 'whole-checkout', snapshot: { wholeCheckout: true } });+ expect(await service.retire({ ...input, review: ordinary.review })).toEqual({ ok: false, reason: 'retirement-review-changed' });+ expect(fixture.cut).toBeNull();+ const review = { prUrl, digest: prepared.review.digest, acceptSuperseded: false };+ const result = await service.retire({ ...input, review });+ expect(result).toMatchObject({ ok: true, originalsQuarantined: true, branchDeleted: false });+ expect((await service.status({ appId: 'app', transactionId: result.transactionId })).phase).toBe('quarantined');+ expect(native).toHaveBeenCalledWith(expect.objectContaining({ command: 'preserve', expected: expect.objectContaining({ wholeCheckout: true }) }));+ });+it('refuses unrepresentable ownership during preview before reserving or archiving', async () => {fixture.ownershipRefusal = 'ownership-preservation-unavailable:uid=501:gid=0';expect(await fixture.service.review({ appId: 'app', release, prUrl })).toEqual({