Skip to content

Clean up graph resolve feature and infra labels#982

Open
Nih1tGupta wants to merge 2 commits into
mainfrom
cleanup-graph-resolve
Open

Clean up graph resolve feature and infra labels#982
Nih1tGupta wants to merge 2 commits into
mainfrom
cleanup-graph-resolve

Conversation

@Nih1tGupta

@Nih1tGupta Nih1tGupta commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix potpie resolve so feature-related claims are returned under features instead of being surfaced through infra_topology. This change keeps the include labels semantically clean for top-level resolve output. Feature predicates such as PROVIDES and IMPLEMENTED_IN now stay in the feature path, while infra_topology remains limited to topology-oriented claims.

Closes #981

What Changed

  • Added features to the default include set for the feature intent
  • Removed feature predicates from the infra_topology reader
  • Updated the graph view contract so infra_topology.service_neighborhood no longer advertises PROVIDES
  • Added focused tests for:
    • feature intent expansion
    • infra-topology exclusion of feature predicates
    • graph view contract alignment

Why

Previously, top-level resolve could return feature claims under infra_topology, which made the include labels misleading even when the underlying context was useful.

This PR corrects that semantic boundary so downstream users and agents can trust the include family more accurately.

Validation

uv run pytest tests/unit/test_read_orchestrator.py tests/unit/test_graph_views.py tests/unit/test_p9_readers.py tests/unit/test_graph_surface_lite_contract.py
uv run ruff check domain/agent_context_port.py application/readers/infra_topology.py domain/graph_views.py tests/unit/test_read_orchestrator.py tests/unit/test_graph_views.py
uv run ruff format --check domain/agent_context_port.py application/readers/infra_topology.py domain/graph_views.py tests/unit/test_read_orchestrator.py tests/unit/
test_graph_views.py

Notes

Focused automated validation is passing.

A separate manual local-graph inconsistency was observed while creating ad hoc fixture data for CLI verification: a committed feature claim did not surface in live reads even though the mutation plan recorded it as accepted.
That behavior appears unrelated to the resolve-labeling change in this PR and is not part of this fix.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: f4b83fc9-18b5-4e2c-96c0-4fb45ba4698b

📥 Commits

Reviewing files that changed from the base of the PR and between 5260058 and c0a55bf.

📒 Files selected for processing (1)
  • potpie/context-engine/tests/unit/test_graph_views.py

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Updated infra topology handling so neighborhood results now follow the latest relationship patterns, improving which infrastructure connections are surfaced.
    • Refined feature-related context routing so the right supporting details are included for feature requests and infrastructure views no longer mix in unrelated feature links.

Walkthrough

Infra topology traversal now matches a revised predicate set, graph view inline relations map PROVIDES to EXPOSES, and tests assert feature claims route to features while infra topology returns only infrastructure predicates.

Changes

Infra/Feature Predicate Separation

Layer / File(s) Summary
Infra predicate set and graph view inline_relations
potpie/context-engine/application/readers/infra_topology.py, potpie/context-engine/domain/graph_views.py, potpie/context-engine/domain/agent_context_port.py
_INFRA_PREDICATES swaps PROVIDES/IMPLEMENTED_IN for USES_ADAPTER/CONFIGURES/DEPLOYED_WITH; service_neighborhood inline_relations replaces PROVIDES with EXPOSES; DEFAULT_INTENT_INCLUDES["feature"] is reformatted.
Graph view and orchestrator routing tests
potpie/context-engine/tests/unit/test_graph_views.py, potpie/context-engine/tests/unit/test_read_orchestrator.py
service_neighborhood test now checks PROVIDES is absent and EXPOSES is present; new orchestrator tests verify PROVIDES routes to features and infra_topology returns only DEFINED_IN claims.

Possibly related issues: #981 — The changes separate feature predicates from infra topology routing and update the expected include labels accordingly.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the resolve-label cleanup and graph predicate changes.
Description check ✅ Passed The description matches the implemented fix and test updates.
Linked Issues check ✅ Passed The PR moves feature predicates into features, keeps infra_topology topology-focused, and adds matching tests for #981.
Out of Scope Changes check ✅ Passed All changes are directly tied to the resolve-labeling fix and its test coverage.
📋 Issue Planner

Built with CodeRabbit's Coding Plans for faster development and fewer bugs.

View plan used: #981


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
potpie/context-engine/application/readers/infra_topology.py (1)

37-47: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Add EXPOSES to the infra-topology predicate set.

infra_topology.service_neighborhood now advertises EXPOSES in potpie/context-engine/domain/graph_views.py, but _INFRA_PREDICATES will never read that relation. That leaves the view contract and the reader out of sync, so infra_topology requests can silently miss service exposure edges the graph view says are available.

Suggested fix
 _INFRA_PREDICATES: tuple[str, ...] = (
     "DEFINED_IN",
     "DEPLOYED_TO",
     "DEPENDS_ON",
     "USES",
     "USES_ADAPTER",
     "CONFIGURES",
     "DEPLOYED_WITH",
     "HOSTED_ON",
     "OWNED_BY",
+    "EXPOSES",
 )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@potpie/context-engine/application/readers/infra_topology.py` around lines 37
- 47, Add EXPOSES to the infra-topology predicate whitelist so the reader and
graph view stay aligned. Update _INFRA_PREDICATES in infra_topology.py to
include EXPOSES alongside the existing relation names, and make sure
infra_topology.service_neighborhood can now read that edge type just like the
others.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@potpie/context-engine/tests/unit/test_graph_views.py`:
- Around line 66-69: The neighborhood view test only verifies that PROVIDES was
removed, so it can still pass if EXPOSES is missing too. Update
test_neighborhood_declares_depth_direction_environment to also assert that
EXPOSES is present in spec.inline_relations, ensuring the relation swap is fully
covered when checking infra_topology.service_neighborhood via view_spec.

---

Outside diff comments:
In `@potpie/context-engine/application/readers/infra_topology.py`:
- Around line 37-47: Add EXPOSES to the infra-topology predicate whitelist so
the reader and graph view stay aligned. Update _INFRA_PREDICATES in
infra_topology.py to include EXPOSES alongside the existing relation names, and
make sure infra_topology.service_neighborhood can now read that edge type just
like the others.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: d4cb68f1-41b9-4245-a6b2-d1521c573975

📥 Commits

Reviewing files that changed from the base of the PR and between 5751c2e and 5260058.

📒 Files selected for processing (5)
  • potpie/context-engine/application/readers/infra_topology.py
  • potpie/context-engine/domain/agent_context_port.py
  • potpie/context-engine/domain/graph_views.py
  • potpie/context-engine/tests/unit/test_graph_views.py
  • potpie/context-engine/tests/unit/test_read_orchestrator.py
💤 Files with no reviewable changes (1)
  • potpie/context-engine/domain/graph_views.py

Comment thread potpie/context-engine/tests/unit/test_graph_views.py
@Nih1tGupta Nih1tGupta marked this pull request as draft July 2, 2026 10:41
@Nih1tGupta Nih1tGupta marked this pull request as ready for review July 8, 2026 04:51
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.

Fix mislabeled feature claims in potpie resolve output

1 participant