Guarantor: finish an issued firm offer after a stop; fail closed in the portfolio and at load #79
All Vouch review confidence checks passed
Residual risk 0.42 = Change Risk (0.52) × (1 − Review Confidence (0.20)).
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.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 27% · 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.344
Real PR Conversation Timeline
1 comments
"Review active on #79"
general
weight: 0.35
chatgpt-codex-connector[bot]
One of four changes that make the Guarantor provider coordinator recoverable after a crash. This one covers firm-offer issuance and four small items from the same reviews. The Guarantor profile is incubation and not wired into the binary. The pinned
aidependency is unchanged.1. A firm-offer issuance that stopped after the journal issued the offer could never finish
resumeFirmOfferIssuancePlanreserved the plan's unsigned position again (guarantor_provider.go,ReserveUnsignedOffer(plan.Position)). When the earlier run had already madeCommitFirmOffer, the stored position was the issued one, so the reservation failed withGuarantor offer identity conflicts with prior reservation(guarantor_journal.go,ReserveUnsignedOffer). An issuance that stopped betweenCommitFirmOfferand the authority's terminal transition stayed prepared at the authority for good.plannedFirmOfferIsIssued). An offer stored under that digest that is the plan's exact offer is neither reserved nor issued again, and the resume goes on to the terminal transition, the admission log and the plan's removal. An offer stored under that digest that is not the plan's is a conflict.Guarantor admission semantic identity conflicts. The repeated call built a second action under the portfolio revision of the later call, with the same stable identity and another request digest. The request names an authority instance, and the journal holds the offer issued under it, so that offer is now returned (issuedFirmOffer): only if its envelope matches its record, its issuance is terminal at the authority and it still verifies for the request and Agreement of the call.2. Small items
| item | wrong | now |
|---|---|---|
|
portfolioForamounts | a paid or defaulted amount that did not parse was counted as zero | the portfolio fails with the coverage and the amount named ||
portfolioForclaim count |activeClaims += uint32(len(...))|addGuarantorClaimCount, range-checked at both ends || coverage key at load | a coverage's map key was never compared with its record's Agreement digest | a load refuses a coverage whose key is not a digest or is not the one its record names |
|
ResolveAdmission,SaveFirmOfferIssuancePlan| a closed or replaced journal was reported as an invalid resolution or plan | the journal's own error is returned ||
pkg/tools/fssandbox write | temporary file named.tmp-<pid>-<nanos>; two writers in one process could pick one name, and a failed create removed the name, which was the other writer's file |fileutil.CreateTemporaryFileRoot: the atomic write's random name with its retry; a name that could not be created is not removed |The test fixtures that stored a coverage with an empty record now store it under the Agreement its record names (
testCoverageWithClaim, the durability fixture,commitTestGuarantorEvidence, the command package's inspection fixture).Tests
TestGuarantorProviderIssuesReservedOfferAndLinearizesAcceptanceand the other scenarios): the second offer's issuance stops before its terminal transition, with the plan stored, the offer issued and the action prepared (checked); the journal is opened from disk; the repeated issuance completes and returns the issued offer, the plan is gone, and repeating the completed issuance returns the same offer.TestGuarantorPortfolioFailsOnAnAmountItCannotRead,TestGuarantorPortfolioClaimCountIsChecked,TestGuarantorJournalRefusesACoverageStoredUnderAnotherIdentity,TestGuarantorJournalReportsADetachedJournalAsThat(closed, and directory replaced).TestSandboxWritesNeverCollideOnTheirTemporaryName(64 writers, 200 rounds, nothing left behind),TestSandboxTemporaryFileHasTheAtomicWriteName.Before the fix, and red controls
Development host,
GOWORK=off GOFLAGS=-tags=goolm,stdjson, pinned tosctl, one run at a time.| tree | result |
|---|---|
|
origin/mainb5a9e54e plus the tests that build there | lifecycle:issue expiring offer after a stop between its journal commit and its terminal transition: state=prepared err=Guarantor offer identity conflicts with prior reservation; portfolio: four casesa portfolio was summed over an amount that cannot be read; identity: both mismatches loaded (got <nil>); detached: all four cases reported... is invalid||
origin/main, sandbox write, five runs |2 of 12800 concurrent sandbox writes failed, the first with: failed to open temp file: openat .tmp-...: file exists|| this head, the issued offer not recognized on resume | the same lifecycle failure as before the fix |
| this head, the stored offer not returned, the key check, the amount check and the two error returns removed | lifecycle:
repeating the completed issuance: state= err=Guarantor admission semantic identity conflicts; the three unit tests fail |TestGuarantorPortfolioClaimCountIsCheckedand the temporary-file helper test need the new functions and cannot be built on the base.Verification
At 0953b453:
gofmt -l pkg cmdempty;go build ./...;go vet ./...;go test -p 4 -count=1 -timeout 30m ./pkg/earning/ ./pkg/servicebridge/... ./pkg/config/ ./cmd/openfox/... ./pkg/messengerauth/ ./pkg/actionauth/ ./pkg/fileutil/ ./pkg/tools/fs/: exit 0, 23 packagesok,pkg/earning884.9 s.golangci-lintas the PR workflow runs it (--build-tags=goolm,stdjson --new-from-merge-base=origin/main): 0 issues.Known limits
beginAdmission,CommitFirmOffer,ExpireOffer, the commit methods ofguarantor_decision_journal.goand others). Only the two named in the review are changed here.paid_atomicnow fails the portfolio once its reservation is released; the load fills in onlydefaulted_atomic. Coverages the journal creates always carry both.Authored by Floria