Skip to content

feat: phase 5 — determinism classification, per-check config, activation authority - #7

Merged
barancan merged 7 commits into
mainfrom
feature/phase-5-determinism
Jul 2, 2026
Merged

feat: phase 5 — determinism classification, per-check config, activation authority#7
barancan merged 7 commits into
mainfrom
feature/phase-5-determinism

Conversation

@barancan

@barancan barancan commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Determinism badges: Derives deterministic/stochastic from check type everywhere checks appear — review page, wizard Step 3, and run transcripts. No DB column; template/generated → deterministic, judge → stochastic.
  • Per-check param editing: Wizard Step 3 now fetches the persisted check list after generation and lets you edit each check's with params inline (PATCH /pipelines/versions/{vid}/check-params). Draft-only; active/archived versions → 409.
  • Activation authority fix: POST /pipelines/generate no longer silently swallows PermissionError in enforced mode. Non-reviewer users see activated: false + a "saved as draft — reviewer activation required" banner with a link to the review page.
  • Grouping filter on review page: All / Deterministic / Stochastic filter pills on pipeline_review.html (Alpine, read-only page stays read-only).

Test plan

  • Run pytest -q — should show 143 passed
  • Open /pipelines/new, generate a pipeline, confirm Step 3 shows determinism badges and "Edit params" expanders per check
  • Edit a check's params (e.g. max_ms) and verify the value persists after page refresh via the review page
  • Open a version's review page (/pipelines/{id}/versions/{vid}/review) and click the Deterministic / Stochastic filter pills
  • In enforced mode (seed a non-reviewer user), generate a pipeline and confirm the "saved as draft" banner appears with the correct link
  • Open a run transcript and confirm determinism badges appear on each check row

🤖 Generated with Claude Code

barancan and others added 7 commits July 2, 2026 21:23
…ion authority

- Derive deterministic/stochastic badge from check type (no DB column):
  template/generated → deterministic, judge → stochastic
- CheckResult gains `type` field, stored in CaseResult.checks JSON for display
- registry.py stamps type on every result including error fallbacks
- New update_check_params() in service.py; deep-copies config to ensure
  SQLAlchemy JSON dirty detection; draft-only, recomputes content_hash
- _build_check_list adds determinism + check_index fields
- New GET /pipelines/versions/{vid}/checks and PATCH /pipelines/versions/{vid}/check-params endpoints
- POST /pipelines/generate surfaces PermissionError (activated:false + permission_error)
  instead of silently swallowing it in enforced mode
- determinism_badge macro added to _macros.html
- pipeline_review.html: badge per check row + All/Deterministic/Stochastic filter pills
- pipeline_new.html Step 3: fetches persisted checks, shows badges, inline param editing,
  draft warning banner for enforced-mode non-reviewer flows
- _transcript.html: badge + score/threshold display per check (graceful for old records)
- 10 new tests in test_phase5.py; all 143 tests passing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tion

- Stochastic badge → badge-pro (purple); deterministic badge → badge-accent (blue)
  Applies everywhere: _macros.html, pipeline_new.html Alpine bindings, review
  page coverage bar (judge segment now var(--text-pro))
- Wizard step 3: auto-redirects to /pipelines after 2.5 s with a "Draft saved"
  banner and "Go now" link — eliminates the ephemeral-state refresh problem
- Remove per-check param editing expanders from wizard step 3; checks are now
  a read-only preview before redirect

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Storage

Adds init() + _persist() to the Alpine component:
- On page load (new pipeline only), restores requirements/project/name/adapter/
  model/endpoint/key_env from localStorage key 'assay_wizard_new'
- $watch on each field saves to localStorage on every change
- localStorage cleared on successful generate so the next new-pipeline visit
  starts blank
- Edit flows (resumeVersionId set) skip localStorage entirely — server supplies
  the pre-populated values

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
saveDraft() now: clears localStorage, sets draftSaved flag (shows fixed-position
success toast), then navigates to /pipelines after 1.5 s. Previously it silently
fired the POST with no user feedback.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
After deleting a draft from the new/edit wizard (steps 1 or 2), the user
lands on /pipelines. The review-page delete is unchanged — it still goes
to /projects/{name} since that page is the natural parent from there.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All three delete buttons (review page + wizard steps 1 & 2) now navigate
to document.referrer if it's same-origin, otherwise fall back to /pipelines.
This means: arrived from /projects/foo → goes back there; arrived from
/pipelines → goes back there; no referrer → /pipelines.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two root causes fixed:
1. Server was returning HX-Redirect to /projects/{name} which htmx processed
   immediately, racing against (and winning over) the client-side handler.
   delete_pipeline now returns plain {"ok": true} — client controls routing.
2. document.referrer is unreliable here: if the user arrived from the project
   detail page, referrer was /projects/{name} which is now an empty ghost.
   All three delete buttons (wizard step 1, step 2, review page) now
   unconditionally navigate to /pipelines on success.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@barancan
barancan merged commit f09fa79 into main Jul 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant