Skip to content

Project view edge endpoints with one helper and drop repeated focus checks - #184

Merged
Deicyde merged 2 commits into
mainfrom
golf/graph-views-endpoints
Oct 11, 2026
Merged

Deicyde merged 2 commits into
mainfrom
golf/graph-views-endpoints

Conversation

@Deicyde

@Deicyde Deicyde commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Cleanup in graph_views.py. No behaviour change: 1 file, +22/-39, one commit per item.

  • Edge endpoints (chapter_view, _scope_view). Each view spelled out every inside and outside combination of an edge's two ends, and repeated the boundary projection once per side. Each now projects one end in a local endpoint function and applies it to both. The skip rules are the same: chapter_view skips an edge with neither end inside the chapter, and _scope_view skips an edge whose ends are under the same child or both outside the scope, and an edge with one end outside unless include_external is set. Boundary members and edge counts are unchanged.
  • Focus checks (_focus_view, _node_view). _focus_view re-checked the node id and radius that focus_view and focus_views validate before they call it. _node_view dropped duplicate and unknown ids from its selection, but both callers pass distinct ids from graph.nodes: full_view passes the mapping itself, and _focus_view passes a sorted set of ids that _adjacency has already looked up.

Noticed, not changed:

Overlaps with open PRs:

Validation at exact head a52040da: ruff check autoform_cli servers tests is clean. tests/test_graph_views.py (8), tests/test_graph_scale.py (30), tests/test_graph_view_rendering.py (2), tests/test_hierarchy_render_regressions.py (7), tests/test_render.py (77), tests/test_visualization.py (23), tests/test_dashboard.py (14) and tests/test_skill_examples.py (25) pass.

chapter_view and _scope_view each spelled out every inside and outside
combination of an edge's two endpoints, and repeated the boundary
projection once per side. Each now projects one endpoint in a local
function and applies it to both ends. The skip rules, boundary members
and edge counts are unchanged.
_focus_view re-checked the node id and radius that both of its callers
validate first. _node_view filtered its selection for duplicates and
unknown ids, but both callers pass distinct ids from graph.nodes:
full_view passes the mapping itself, and _focus_view passes a sorted
set of ids that _adjacency has already looked up.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 7, 2026
@Deicyde

Deicyde commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Review at a52040d

Verdict: merge-ready. The no-behaviour-change claim holds line by line, and nothing else turned up. In chapter_view, endpoint returns an inside id unchanged and projects an outside id exactly as the old branches did. Left-to-right tuple evaluation keeps _top_scope and the boundary updates in the same order. In _scope_view, source_child == target_child covers both old skips (both None, or both under one child), because a child is a node id and never equals None. The second test then sees exactly one None end, which is the old elif not include_external case. _focus_view has no callers besides focus_view and focus_views, both of which validate node_id and radius first. Nothing in tests/, graph_pages.py or render.py calls it. Both _node_view callers pass distinct ids from graph.nodes. full_view passes the dict itself. _focus_view passes a sorted set drawn from _adjacency, which raises KeyError on any relation endpoint missing from graph.nodes before _node_view runs, and does so at head and base alike. So the dropped dict.fromkeys(... if node_id in graph.nodes) filter was a no-op. An independent fuzz run compared base and head on 240 hand-built graphs, including dangling dependencies, Node.id differing from its key, and missing statuses. Across about 25k calls to every public view, it found identical output and exceptions. Exact-head CI is green.

Landing

Posted by PR swarm: Review #179 #184 #186

@Deicyde
Deicyde marked this pull request as ready for review October 11, 2026 02:46
@Deicyde
Deicyde merged commit 967e6a7 into main Oct 11, 2026
9 checks passed
@Deicyde
Deicyde deleted the golf/graph-views-endpoints branch October 13, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant