F · Session ↔ plans link/delink#69
Closed
pskeshu wants to merge 9 commits into
Closed
Conversation
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.
Collaborator
Author
|
Superseded by #72 — the temperature + Operations/tactics suite and the new Operate (bottom-cam→SPIM) surface are consolidated onto |
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.
Sub-project F. A session can link to multiple plan items, link/delink from both surfaces.
PlanItem.session_ids;unlink_plan_item_session+ reverse-query; link/delink endpoints; Plans-tab controls + a session 'Linked plans' panel.Stack: →
feature/embryo-roles-observability(D2).