Repository navigation
sc-281: accept recommended target changes after a failed selection - #341
Open
gazdagergo wants to merge 8 commits into
Open
gazdagergo wants to merge 8 commits into
gazdagergo wants to merge 8 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
|
||
| function suggestions() { var o=[]; model.forEach(function(c){ c.values.forEach(function(v){ if(v.sug) o.push({c:c,v:v}); }); }); return o; } | ||
| function pendingList() { var o=[]; model.forEach(function(c){ c.values.forEach(function(v){ if(v.pending) o.push({c:c,v:v}); }); }); return o; } | ||
| function esc(s){ return CSS.escape(s); } |
…utton sc-281 adds Accept / Accept all / Accept all & re-run-selection buttons to the targets Check page, so an organiser can apply the algorithm's recommended min/max relaxations in one click instead of retyping them. The plan maps the change onto the existing feasibility and target-save services (reusing check_targets_detailed and update_target_value), and the standalone HTML mockup gives Hamish a clickable before/after prototype plus user-flow and data-flow diagrams for review. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X12D2pPnMTbVGriEVMRcJL
Reworks the plan and mockup after Hamish's review. The journey now starts where the problem actually surfaces — a failed initial selection — with an "Adjust targets" link into the targets check rather than assuming the organiser is already on the targets page. Adds the audit comment recorded on accept (the mockup demonstrates both candidate behaviours, auto-written and review-before-save, via a toggle), and gates the "Accept all & re-run selection" button on having arrived from a selection run. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X12D2pPnMTbVGriEVMRcJL
A failed initial selection used to be a dead end: the run showed which minimums and maximums to relax, but applying them meant retyping each one in the Targets editor from a second tab. The failed-run modal now offers "Adjust targets", which opens the targets check with the suggestions showing. Each suggestion has an Accept button that reveals a pre-filled, editable comment and, on save, applies just that value; "Accept all" applies them together, and "Accept all & re-run selection" also starts a fresh run — the latter only when the organiser arrived from a run. The new accept-suggestions route re-derives the suggestions itself rather than trusting the posted numbers, and applies them through the existing update_target_value, so the manual-override and validation rules are unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X12D2pPnMTbVGriEVMRcJL
A full-width table row that offers one suggested change to the row above it. The comment saved with the change is pre-filled and editable from the start, so accepting is a single click rather than an Accept that opens an editor and a Save that applies it. Accept does one of two things, chosen by what the caller passes: - action: the row is a form, and Accept posts the comment and hidden fields, for views that save each change as it is made; - apply: a map of input id to value, which Accept writes into the page's inputs, firing input on each so totals and the leave guard hear of it. Nothing is saved until the page's own Save; Undo puts back whatever has not been typed over, and a suggestions-accept-all window event accepts every row at once. With neither, the row just shows the suggestion. All three appear in the component showcase. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012x8xa4i725xyzCWtWJkziJ
…uggestion "Adjust targets" on a failed initial selection now opens the targets page in edit mode, with each of the algorithm's suggestions as a suggestion row under the value it would change. Accept writes the suggested min or max and the pre-filled, editable comment into that row in one click; "Accept all suggestions" does every row. The edits are saved with the form like any other. When the organiser came from a run, the save bar also offers "Save & re-run selection", which saves and starts a fresh initial selection. A plain save keeps the from/run_id provenance, so the check it lands on can still offer the re-run, and discarding returns to that check rather than to a page without the suggestions. The read-only view uses the same row: there Accept saves the one change through accept-suggestions straight away, replacing the Accept-then-Save editor. Suggestions are now tinted as warnings, matching their badge, and accepting keeps the scroll position. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012x8xa4i725xyzCWtWJkziJ
A failed test selection now offers "Adjust targets" as well. The link carries test=1, and the targets page passes it through its forms and redirects, so "Save & re-run" and "Accept all & re-run" start a test selection again rather than the real one. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012x8xa4i725xyzCWtWJkziJ
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012x8xa4i725xyzCWtWJkziJ
gazdagergo
force-pushed
the
281-recommended-target-button
branch
from
October 20, 2026 10:55
e0455ab to
1ccfe43
Compare
gazdagergo
marked this pull request as ready for review
October 20, 2026 13:27
…are not as expected Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012x8xa4i725xyzCWtWJkziJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sc-281: accept recommended target changes after a failed selection
The problem
When an initial or test selection fails, the algorithm suggests min/max changes that would make the targets work, but the failure view gives no way to apply them. You had to open the Targets tab and type the numbers in by hand.
What this does
db_selection_progress_modal.html) offers Adjust targets for both initial and test selections. It opens the targets check in edit mode (targets/check?from=selection&run_id=…&edit=1), with the check already run and each suggestion shown under the target it applies to. A failed test selection addstest=1.start_db_select_task(test_selection=…)). A direct visit to the targets page shows the suggestions but no re-run.POST /targets/accept-suggestions. That route works the suggestion out again on the server withcheck_targets_detailed()and saves it through the existingupdate_target_value().backoffice/components/suggestion_row.html(and thesuggestionRowAlpine component) has three modes: message only, save on accept, and fill in on accept. It's documented on the showcase page.Tests
tests/component/test_target_suggestions.py: the accept route, edit-mode entry, save & re-run, initial vs test re-run, and the modal links.src/js/components/suggestion-row.test.js: accept, combining comments, and undo.Notes
backend/docs/agent/sc-281-*(plan + mockup) are still in the PR. They can be dropped before merge if we don't want to keep them.🤖 Generated with Claude Code
https://claude.ai/code/session_012x8xa4i725xyzCWtWJkziJ