feat(portfolio,findings): the three doors that retire the database-reaching backfills #513
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #513"
general
weight: 0.35
gurnben
What
The three core doors the interaction boundary audit sequenced (traust-security/traust-foundry#97, Wave 2) — the doors that retire SCI's three backfill scripts that reached the
traust_coredatabase over psql, the audit's Class 4 "shouldn't-exist" findings. The boundary they close is the SDK contract's own principle (the read-side plan, stable-platform): a consumer keeps only its own extension data, joined to traust by id — a missing endpoint is a core change first, an SDK regen second, a rewire third, never a psql prefix. Every door here is batch-shaped from birth, per the perf-coverage plan's statement-bound discipline: one bounded statement per batch, never a per-item fan-out.1.
ResolveRepositories— the batch identity resolution door (S1)POST /v1/repositories:resolve— the read-side plan's step 1, its S1 shape verbatim:ResolveRepositories(urls)answering, per spelling, the id core already knows.alias_ofhint when the matched row carries one — a fork or a mirror is the caller's judgement, not the door's (S1's open question — the URL's own id with an aliasOf hint, or the canonical? Probably both, in one response — answered as designed)..gitstripped,git@ssh folded to https, host lowercased; scheme and www preserved — deliberately nothing broader. Distinct records a wider fold would collapse meet only as candidates.find_by_urls_casefold); several rows under one folded spelling answer as the candidates, oldest first — the retired script's review list, made the door's honest answer, never a script-side guess.2. The default-ref observation door
POST /v1/repositories/{repository_id}/refs/default—mark_default_branchexposed as the door the retired script's survey half feeds: the forge's default-branch answer (branch + head commit) recorded exactly the way the repo_state observation records it — the get_or_add that adds the line when absent and names the new line the default (a named line is immutable once recorded; earlier flags stay, the naming time orders the default line).register_refcarries. Not the person-only gate the disposition doors carry: this door moves no disposition.register_refand answers its sibling's semantics for the unknown-repository case (the insert's own constraint refusal).3. The occurrence-claim door
POST /v1/occurrence-claims— the person-gated write path for the CVSS claims occurrences' reports stated, retiring the backfill that wrotetraust.occurrence.cvss_score/cvss_vectorin core's DB with the append-onlyreject_mutationtrigger disabled inside each transaction — the sharpest boundary violation in the estate.append_occurrence_claim, besideappend_claim: a verified person, a ticket, a meaningful rationale, the ledger's audit append, nothing in the disposition fold).models.cvss.score_of— never a guess at a malformed one: a vector without a version prefix, a malformed metric, an uncomputable base score are refused and listed), the finding resolves by fingerprint (the identity both sides share), and the occurrence binds (the assessment must have reported the finding — the same binding the claim-correction path enforces).recorded,already_recorded(idempotent),already_carried(the occurrence's own columns state it — the fixed intake'sFindingCandidate.cvss_*→Occurrencewrite),conflicting(the review list, never an overwrite — the retired script's own never-overwrite rule),unknown_finding,unreported,invalid. The response carries the coverage counts — the report shape the retired script produced, answered from the door's own responses.What this does not do
The historical NULL-CVSS occurrence columns are not rewritten: occurrence rows keep what they said, by the append-only design's own choice (the intake fix's own words). The claims are recorded as governed statements under a person's authority; serving them through the read models is the read-side plan's own sequencing (S3's generic query, S4's typed accessors), not this wave's.
Checklist
developmentfind_by_urls,find_by_urls_casefold)ObjectStore; no in-memory stand-ins insrc/uow/seedsrc/); shared logic is one helpermake lint-fix && make testgreenTests
tests/v1/rest/portfolio/test_resolution.py— the registered spelling; the drift folds (trailing slash,.git,git@, host case); the GitHub case drift and the folded collision (candidates, oldest first); the vacated-spelling follow; the fork's own id with the upstream hint; the honest absences; batch order; machine equals person; the empty/oversized refusals; 401; the operation id the SDK generates.tests/v1/rest/portfolio/test_default_ref.py— naming the line; the new-answer semantics (earlier flags stay,current-defaultorders by naming time); the get_or_add beside the observation lane's own records; machine equals the lane; the unknown-repository 409; the malformed 422; 401; the operation id.tests/v1/rest/findings/test_occurrence_claims.py— the recorded statement (the audit trail, and the append-only proof: the occurrence keeps what it said); idempotency; already-carried; conflicting-never-overwrites; the per-claim refusals; batch order + counts; the machine principal refused (403); the weak authority 422; empty/oversized; 401; the operation id.Gates
make lintgreen.make test-integration, Postgres): 4246 passed, 6 skipped, with the same two failuresorigin/developmentitself carries (test_renders_through_context[postgres],test_repository_display_search_and_sort_fall_back_to_ids[postgres]— reproduced on a pristine base checkout side-by-side) and the same parallel-run error flakiness this host's local Postgres shows identically for my branch and the pristine base (every erroring test passes in isolation).make api-check: 91 paths (was 88).The chain
The door pattern (foundry#88): core (this PR) → traust-sdk regen at this ref (
ResolveRepositories,MarkDefaultBranch,RecordOccurrenceClaims) → source-code-intelligence (the three scripts' retirement). Routed for review — not to be merged before the review lands.💘 Generated with Crush
Assisted-by: Crush:rits/zai-org/glm-5-3