feat(voyager): add Hide Reverse Relationships toggle for ER diagram#99
Merged
Merged
Conversation
Add a new display toggle that hides ONETOMANY reverse-mirror edges in the ER diagram, keeping only MANYTOONE (FK-holder side) and MANYTOMANY edges. Eliminates the visual duplication produced by SQLModel `back_populates` bidirectional relationships (each entity pair went from 2 edges to 1). Backend: - `ErDiagramDotBuilder.__init__` accepts `hide_reverse_relationships: bool` - `_add_relationship_link` early-returns on `direction == 'ONETOMANY'` when the flag is on; MANYTOONE and MANYTOMANY are preserved unchanged - `ErDiagramPayload` and `ErDiagramSubgraphPayload` get the new field (default `False`, backward compatible) - `VoyagerContext` transparently passes the field through to the builder Frontend: - `store.js` adds `state.filter.hideReverseRelationships` field, `toggleHideReverseRelationships(val, onGenerate)` action, and threads the field into both payload builders (`buildErDiagramPayload` and `buildErDiagramSubgraphPayload`) - `vue-main.js` reads the persisted state from `localStorage` on init and registers the toggle action - `index.html` renders a `<q-toggle>` in the ER-diagram display options panel (keyboard-accessible by default; only shown in ER-diagram mode) - Subgraph (spec 005) follows the filter automatically because `filter_to_neighborhood` consumes the already-filtered `self.links` Spec kit artifacts under `specs/007-voyager-er-pure-fk/` (spec, plan, research, data-model, contracts, quickstart, tasks) — feature was renamed from "Pure Foreign Key" to "Hide Reverse Relationships" mid-spec after discovering the original premise (independent FK-column edges) doesn't match the current implementation; directory name retained as a filesystem identifier, decoupled from the UI label. Tests: 10 new pytest cases cover filter off/on, M2M preservation, unirectional MANYTOONE/ONETOMANY, SchemaNode.fields invariance (FR-007), endpoint contract + backward compat, subgraph follow-through, and self-referential back_populates. Full suite: 41 passed, 0 regressions. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
allmonday
added a commit
that referenced
this pull request
Jul 3, 2026
Version bump for PR #99 (Voyager ER diagram Hide Reverse Relationships display toggle). Updates CHANGELOG, pyproject.toml, uv.lock. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2 tasks
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.
Summary
Adds a new display toggle "Hide Reverse Relationships" to the Voyager ER diagram. When enabled, ONETOMANY reverse-mirror edges are hidden; only MANYTOONE (FK-holder side) and MANYTOMANY edges remain. Eliminates the visual duplication produced by SQLModel
back_populatesbidirectional relationships (each entity pair drops from 2 edges to 1).ErDiagramDotBuilderearly-returns ondirection == 'ONETOMANY'when the flag is on;RelationshipInfo.direction(already populated by SQLAlchemyinspect()) drives the filter, no new reflection neededq-togglein the ER-diagram display options panel; state persisted tolocalStorage(keyhide_reverse_relationships); both/er-diagramand/er-diagram-subgraphpayloads carry the fieldfilter_to_neighborhoodconsumes the already-filteredself.linksNaming note
Originally specced as "Pure Foreign Key" — feature was renamed mid-spec after discovering the original premise (independent FK-column edges) doesn't match the current implementation (all ER edges today come from
Relationship(...)fields, not FK column constraints). Directoryspecs/007-voyager-er-pure-fk/kept as a filesystem identifier, decoupled from the UI label. See spec.md Q4/Q5 for the full clarification trail.Implementation notes
_add_relationship_link(entrance early-return), soself.rel_name_setstill records all relationships — Fields tab content is unaffected (FR-007 invariant verified bytest_fields_table_unchanged)False→ old clients unaffected, response shape unchangedTest plan
tests/test_voyager_hide_reverse.py— 10 new pytest cases (filter off/on, M2M preservation, unirectional MANYTOONE/ONETOMANY, SchemaNode.fields invariance, endpoint contract + backward compat, subgraph follow-through, self-referential back_populates)uv run pytest tests/ -k voyager→ 41 passed, 0 regressionstasks.md):uv run uvicorn demo.enterprise_voyager.voyager_demo:app --port 8010specs/007-voyager-er-pure-fk/quickstart.md§2.2–2.10Spec kit artifacts
Full spec-kit trail under
specs/007-voyager-er-pure-fk/:spec.md(5 clarify Q&As)plan.md+research.md(5 implementation decisions)data-model.md+contracts/(3 contract documents)quickstart.md(10 pytest cases + 10 manual verification procedures)tasks.md(27 tasks, 21 auto-completed, 6 pending manual)🤖 Generated with Claude Code