test(regeneration): pin the relationship-traversal narrowing limitation

Draft
PO
4mo ago
+69-4

What

Adds a strict-xfail component test that pins a known limitation of post-merge selective regeneration: when the changed field is reached through a relationship, the selection widens to every target instead of narrowing to the members whose query actually read it.

Behavior

Schema (CAR_SCHEMA): Car(name, color) —owner→ Person(name). The artifact/generator query pins its root Car by ids and reads owner { name } through the relationship.

CaseChangeResult
Member root (happy path)Car.namenarrows — widened=False, only that member's subscriber
Relationship-reached (sad path)Person.name (the car's owner)widens — widened=True, every target of the group

Person is reached only by traversal, so it is not tracked as a member of the query's target group and cannot be mapped back to a Car's subscriber. Widening is the safe fallback: it over-executes but never ships a stale output.

The new test sets up a second car with its own owner and subscriber so the over-execution is observable — changing owner-1 should select only car-1's subscriber, yet today it selects both. It asserts the desired narrowed outcome and is marked xfail(strict=True), so it flips to a failure (prompting removal of the marker) once narrowing through relationships lands.

Verification

INFRAHUB_TESTING_TASKMGR_BACKGROUND_SVC_REPLICAS=1 \
  uv run pytest backend/tests/component/core/regeneration/test_impact.py -v
# 2 passed, 1 xfailed

🤖 Generated with Claude Code