Repository navigation
feat(planstep): size ramp steps by the cumulative target - #864
Conversation
Resolve now takes the step, the frozen step-1 baseline and the plan's committed ledger as parameters and buys clamp(target - committed, 0, shown) with target = floor(base x coverage x cumulative% / 10000). ErrTargetMet is returned only from the baseline and ledger, never from shown. The production resolver still calls it as step 1 with no ledger, so behavior is unchanged until the attach wiring lands. Refs #631 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 8 billable files and costs up to $2.00.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 27 minutes for your next included review. View limit details
Comment |
Gate verdict: CHANGES NEEDED (blocker: build break against main), reviewed head 4c66c36Blocker. The PR is BEHIND main by #859 (2c91411), and #859 added a caller of the old signature: Review of the PR's own code (no defects found; this carries over if the only change is the merge plus the adapter above):
Non-blocking notes for C3:
Local evidence (macOS, GOTOOLCHAIN=go1.26.9, |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Gate re-run at ff8f248: review CLEAN, NOT merged yetWhat changed since 4c66c36, checked with
Evidence at this exact head (macOS, GOTOOLCHAIN=go1.26.9,
Not merged, for two reasons:
A human or the coordinator needs to merge, or authorize the merge. |
Part of #631 (task C1). Builds on C0 (#860) and C2 (#861).
Scope
planstep.Resolvenow sizes a step by the cumulative target instead of a share of what is still shown:target = floor(base x coverage x CumulativePercent(step) / 10000),buy = clamp(target - committed, 0, shown).baseis the frozen baseline entry; at step 1 it is the shown count (post-suppression, never above demand). Identities without a baseline at step > 1 are skipped (reported inResult.Skipped, under-buy).step,baselineandcommittedare parameters; no extra store reads.Result.Baseline(step 1 only) records every matched count identity with shown > 0, including recs that size to 0.ErrTargetMet, decided from a non-empty baseline plus the ledger only, never fromshown(item 80 G1). A hidden identity with a gap isErrNoMatch; an empty step-1 read isErrNoMatchand returns no baseline (G2).Not in this PR
Attach wiring, the no-op completion path and its marker/note (C3, G3, G4), SP scope-out (C5), D1 (#859).
Compatibility
The production resolver (
planstepResolver) callsResolve(..., step=1, nil, nil), which is exactly the old formula (immediate plans are already forced to 100 by Precheck), so behavior is unchanged until C3.Evidence (fixture/mock, in-memory fakes; not real-scenario)
go build ./...,go vet,go test ./internal/planstep ./internal/purchasepass. New tests: weekly-25 cov-80 -> 20,20,20,20 (old formula 20,16,12,10); 3x40 -> 32,32,16; committed >= target -> ErrTargetMet; lagging shown (suppressions expired, shown regrown to 100) still buys exactly the target, total 80; manual purchase clamps to shown; shown=0; k x pps > 100; floor rounding; G1, G2, baseline-with-zero-size, skipped identities.Mutation probes (9 on the money lines): 6 killed; 3 survived (empty-baseline guard is equivalent to
judged > 0; step-1base.Count > 0and step-1shown+committedneed a non-empty ledger at step 1, which C3 will not pass). Non-blocking.Note for C3
At step 1, when every target floors to 0, Resolve returns ErrNoMatch together with a non-nil Result.Baseline. C3 must freeze that baseline on this path, or the ramp strands at step 2.