Repository navigation
fix: Project session topology from canonical session_links - #5188
Conversation
The archive tier and the repository tree mixin both walked sessions.parent_session_id, synthesizing edges the canonical session_links relation never asserted. Both now compose through the one topology engine; the parent/root columns stay write-side accelerators. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
session_lineage_edges materialized one-hop parent/child edges from the sessions.parent_session_id accelerator, so a daemon lineage page could show an edge the canonical relation never asserted and could traverse a quarantined or conflicting one. It now reads composing session_links rows and reports no parent for a contradicted child. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedNext included review available in 49 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Two public read paths still built the session graph by walking
sessions.parent_session_id/root_session_id. They now project from canonicalsession_links, which this bead (polylogue-27ezu) makes the edge authority.Problem
polylogue-27ezudecides thatsession_linksis the edge authority: the session parent/root columns may accelerate lookup but must never synthesize an edge or replace its provenance. Two constructions at head contradicted AC2:archive_tiers/archive.py::get_session_treeresolved the root via_root_session_id_for_treeand scannedsessions.root_session_id.session_lineage_edges— public through the daemon lineage list rows (operations/daemon_reads.py::_lineage_edges_payload) — materialized one-hop edges fromparent_session_id/parent_session_id IN (...), and ignored composability entirely.The repository read path (
storage/repository/archive/tree.py) walked the parent column in a loop forget_parent/get_children/get_root/get_session_tree.Solution
get_session_treecollects the link-connected neighbourhood (_topology_closureover_incident_session_links, both directions) and composes it through the single enginecompose_session_topology; node order is the engine's BFS-from-root order, matching the facade's declaredstable_order="depth,session_id"._root_session_id_for_treeis deleted.session_lineage_edgesselects composingsession_linksrows (resolved_dst_session_id IS NOT NULL AND topology_status_composes_sql()). A child with contradictory composable parents reports no parent and is dropped from the parent's child tuple — an excluded edge stays visible as evidence but is never traversed (AC5, which this route previously ignored).repository/archive/tree.pyprojects fromderive_session_topology_asyncover canonical link reads; the walk loop is gone.queries/session_links.pyextractsSESSION_LINK_COLUMNSso the new sync reader and existing async readers select the same provenance columns — a divergence there would silently drop fields on one surface.storage/repository/archive/reads.pywas inspected and needed no change: it is a 22-line mixin composition, and the residual lived in the mixin it composes.On the modified test
tests/unit/storage/test_query_unit_time_expression.py::test_get_session_tree_does_not_epoch_collide_timeless_siblingseeded only the accelerator columns and asserted the child appeared in the tree — so it could only pass while the implementation walkedparent_session_id. It asserted the mechanism being removed.The fixture now also seeds the canonical
session_linksrow; the assertion is unchanged, so the test keeps its own invariant (a timeless sibling is not dropped by a NULL ordering key) and its anti-vacuity condition is documented in place. The code was not weakened to satisfy it.New anti-vacuity tests prove authority in both directions: nulling the accelerator keeps the tree and the lineage edge; deleting the canonical row while the accelerator still claims "child of root" removes both.
Verification
⚠ Landing order
archive_tiers/archive.pyandqueries/session_links.pyare both IN the derived-schema identity closure (devtools schema closure, independently confirmed). This change moves the stamped derived identity and must land before a production rebuild starts; a mid-run landing silently invalidates it.repository/archive/tree.pyisout.This confirms the bead's most recent note and refutes an earlier note claiming all four files were outside the closure.
Residuals
delegationshits are a different relation).UNRESOLVED_NATIVEstays read-compat only and is never emitted by the canonical mapper. Codex's structurally-absentparent_dispatchstill yields child-side-only edges resolving asedge_only, which is correct and was left alone.write_scoperemains broader than what was touched; the widening tosession_lineage_edgesand the shared column constant is evidenced above.🤖 Generated with Claude Code
https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK