← Back to Pull requests

Record cleanup resource ownership #287

Open
unknown opened this pull request with 217 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 19, 2026 19:09 UTC
Author

Placement now records which Substrate resources each Create, Restore and Fork created, so a later cleanup change can release them by UID instead of by name. Nothing releases them yet, and teardown is unchanged from main.

A backend with dedicated resources implements api.ResourceCleanupRuntime. Before runtime I/O, placement records the operation's full plan: provider-opaque references, and which resource borrows which (a memory-tier fork child borrows its tag's snapshot). The runtime returns the UIDs it proved it created in Incarnation.Cleanup, also when the call then fails, and placement confirms them. A lost response stays unconfirmed. A confirmation can't add a reference, change a UID or change a borrower, and nothing adopts an object found by name. A fork child's plan is recorded without publishing the child.

The Substrate backend produces this when the daemon gives it a cleanup key. A backend built without one, such as an embedded library user, records no plan and behaves as on main.

Schema v10 adds allocation_resources and allocation_borrowers and is one-way. Stop every writer and back up the database and WAL before the first open; the steps are in spec §18. The canonical_resource_id column ships empty so the cleanup change won't need v11.

Worth a close look: sqlitelog/cleanup.go confirmResources, and the error paths in Substrate Create and Fork that now return the partial claim with the error.

Root and integrations/substrate build, vet and race-shuffle suites pass, along with chain verification, doc links, doccheck, buf lint and the changelog check. The v9 migration test uses a journal written by v0.4.0. Refs #88.

🤖 Generated with Claude Code

Diff: 217 lines (+162 / -55) across 2 files Reviewer: aramase Review duration: 4342m
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.37) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 217 lines diff across 2 files
0.37
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
46%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth shallow_review_depth
0.344
Diff Size diff_size
0.322
Real PR Conversation Timeline
1 comments
"Review active on #287"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 46.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 36.7% (MEDIUM) · Higher = larger blast radius
36.7%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 46.7% · Lower = rushed or shallow review
46.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 19.6% · Safe to merge
19.6%