← Back to Pull requests

feat: edit an existing protocol instead of deleting and retyping it #7

Closed
unknown closed this pull request without merging on Aug 09, 2026 22:55 UTC
View on GitHub
unknown unknown commented on Aug 08, 2026 13:58 UTC
Author

The Plan page could create protocols, pause them and delete them, but never change one. Correcting a dose or a schedule meant deleting the protocol and entering it again, which breaks the link to every dose already logged against it.

The store has supported this all along. updateProtocol takes a Partial and is already what the pause button calls. Only the form was missing, so this reuses it rather than adding a second one: passing initial seeds every field from the saved protocol and turns the save into a patch.

Three things the reuse had to get right.

Fields the form does not ask about are carried through untouched. The old onSave hardcoded active: true, which as an edit would have silently resumed a paused protocol. endedAt and notes survive for the same reason.

Titration is stored as steps, not as the id of the plan they came from, so the plan is recognised by comparing its steps. Steps that match nothing, from an import, get a "keep the existing steps" option rather than being dropped when the user edits something unrelated.

Route is not a form field. An unchanged peptide keeps the saved route; a changed one takes the new peptide's default.

Adherence and progress replay the current schedule over past dates, so moving the timing of a running protocol also moves figures for weeks already gone. The form says so, but only when the schedule or start date actually differs from what was saved.

Gate: tsc clean, eslint clean, 962 tests passing in four timezones.

Diff: 188 lines (+141 / -47) across 2 files Reviewer: ArunNGun Review duration: 1977m
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 188 lines diff across 2 files
0.36
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
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
Diff Size diff_size
0.314
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% 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: 35.8% (MEDIUM) · Higher = larger blast radius
35.8%
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: 60.5% · Lower = rushed or shallow review
60.5%
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: 14.1% · Safe to merge
14.1%
Repository