Created
Jul 01, 06:11
Started
Jul 01, 06:12
Completed
Jul 01, 12:10
DevOps handoff
Type
Feature
Shape
backend
Worktree Slug
grade-narrated-trajectory-spans
Repositories
mcritchie-studio
Release Slug
—
Branch
feat/grade-narrated-trajectory-spans
Local URL
—
QA URL
—
Production URL
—
Acceptance Criteria
Expected Test Plan
Checks Run
Agent Context
Extend the learning heartbeat's grading (ActionGrade) so a grade can target an AtomicEvent SPAN, not only a raw AtomicAction. DESIGN = additive dual-FK, NOT a polymorphic rewrite (keep the working action path intact, low overnight risk): (1) migration adds nullable atomic_event_id FK to action_grades (on_delete: nullify, index), relaxes atomic_action_id to nullable, adds a partial unique index on (atomic_event_id, grader) WHERE atomic_event_id IS NOT NULL — mirror the existing (atomic_action_id, grader) unique index. (2) ActionGrade: add belongs_to :atomic_event, optional: true; keep atomic_action optional:true; add a model validation that EXACTLY ONE of atomic_action_id/atomic_event_id is present (XOR); add scope for_event; keep the grader-uniqueness working for BOTH targets (conditional validation per FK). (3) HeartbeatController: add a NEW action grade_event (route: post 'alex/heartbeat/events/:id/grade', as: :heartbeat_event_grade) that upserts one grade for (event, grader) and returns JSON only — do NOT touch any view/partial or the existing #grade turbo_stream path (E3 owns all heartbeat UI; keeping E2 view-free avoids a merge conflict with E3). Same disposition/slug/long_form/intent=bank|discard semantics as #grade, wrapped in rescue_and_log. (4) grade_counts should keep working (it counts action grades today; leave it, E3 will extend). TESTS: model unit specs for the XOR + event grader-uniqueness + bank/discard on an event grade; a request spec POSTing to the new event-grade route asserting persistence + JSON. Backend discipline: grade writes RAISE (deliberate user action), rescue_and_log with the grade as target. Part of the narrated-events next-draft epic — see project_opsd_learning_layer.
Stage Timeline
Who handled each stage, the time it took (measured), and the model / tokens / cost reported (best-effort) — plus who's on it right now. — means the agent didn't report that metric.
Conversation
QA review feedback, agent handoffs, and follow-up notes for this task.
No task feedback has been recorded yet.
Sealed-bid sizing
Edit →Alex (PM)
—
Avi (PO)
MEDIUM
Dev
MEDIUM
Actual
XL
We emailed a one-tap sign-in link to . It expires shortly and can only be used once.
No email? Check spam, or close this and try again.