Skip to content

F · Session ↔ plans link/delink#69

Closed
pskeshu wants to merge 9 commits into
feature/embryo-roles-observabilityfrom
feature/session-plan-linking
Closed

F · Session ↔ plans link/delink#69
pskeshu wants to merge 9 commits into
feature/embryo-roles-observabilityfrom
feature/session-plan-linking

Conversation

@pskeshu

@pskeshu pskeshu commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Sub-project F. A session can link to multiple plan items, link/delink from both surfaces.

  • Source of truth = PlanItem.session_ids; unlink_plan_item_session + reverse-query; link/delink endpoints; Plans-tab controls + a session 'Linked plans' panel.
  • Base plans deferred (your call). 4 tasks + whole-branch review + fix; ~70 tests; both surfaces Chrome-audited.

Stack:feature/embryo-roles-observability (D2).

pskeshu added 9 commits June 29, 2026 07:15
Adds the two missing data-layer pieces for session↔plan linking (Task 1):
- unlink_plan_item_session: mirrors link's load/persist/notify; idempotent;
  clears back-compat session_id scalar when the last session is removed.
- get_plan_items_for_session: reverse query across active campaigns; deduped
  by item id; back-compat via _dict_to_plan_item's existing normalisation.
10 new tests, 0 regressions.
POST /api/campaigns/{cid}/items/{item_id}/sessions — links a session to a
plan item (link_plan_item_session + link_session_campaign) and returns the
campaign's updated sessions. DELETE …/sessions/{sid} delinks via
unlink_plan_item_session, returns {unlinked: bool}. GET
/api/sessions/{session_id}/plans reads plan items for a session via
get_plan_items_for_session, maps to [{id,title,campaign_id,status}].
16/16 route tests pass; no new failures in suite (32 pre-existing).
Add [+ link session] picker and per-session [×] delink to the item-detail
Sessions section. Sessions rendered from item.session_ids (item-scoped),
not the campaign pool. Backend get_item_detail now filters to item.session_ids.

Picker: click opens inline select from /api/sessions (already-linked filtered
out), Link → POST /api/.../sessions → selectItem re-fetch; Cancel closes.
Delink: × → DELETE /api/.../sessions/:sid → selectItem re-fetch.
State: _sessionPickerOpen + _availableSessions on state; reset on item switch.
CSS: .session-link-btn, .session-delink-btn, .session-picker* styles added.
node --check: pass. Chrome-MCP harness: scratchpad/flink/index.html (verified
link, delink, picker flow, empty-state, filtered select).
Adds a "Linked plans" panel to the Operations/experiment-overview view
(experiment-overview.js). The panel appends below the tactic spine,
is session-scoped (session_id from /api/operation_plan/current, always
available even when no plan is active), and is symmetric with the
Plans-tab Sessions section added in Task 3.

Panel: fetches GET /api/sessions/{id}/plans + GET /api/campaigns in
parallel; renders title · campaign · status badge · delink (×) per row;
inline plan-item picker (select from unlinked items); POST/DELETE hit
the same Task 2 endpoints; refetches + re-renders on every link/delink.
Empty state: "Not linked to any plan" with link control still present.
Backward compat: no session → no panel; store/network errors → graceful
empty/loading state. node --check passes.
…ive split + back-compat test

POST link_session_to_item now re-fetches the item and filters get_sessions_for_campaign
by item.session_ids — identical scope to GET get_item_detail (contract consistency).
handleSessionDelink catch block calls renderInspector to restore UI on failure.
experiment-overview.js picker split limited to 2 parts for defensive id parsing.
Back-compat store tests: legacy scalar-only session_id found by reverse query and
correctly removed by unlink_plan_item_session.
@pskeshu

pskeshu commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #72 — the temperature + Operations/tactics suite and the new Operate (bottom-cam→SPIM) surface are consolidated onto feature/temperature-operations-all (now targeting development). This increment's work is included there; its feature branch was deleted. Closing to keep a single main PR.

@pskeshu pskeshu closed this Jul 1, 2026
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