test: failing test for #6293 -- generator instance orphaned when target object deleted - #10370
Conversation
|
AGENT_REVIEW_VERDICT: TEST_APPROVED Overall verdict: APPROVED WITH SUGGESTIONSThe failing test correctly encodes the architectural fix identified in the analysis (fix 2: a cascade path from the generator target to its A. Test realismNot a client-input test — it operates purely on the processed Core schema. Every value used is a real system value traced to production code:
Crucially, the test resolves the target kind dynamically ( B. Test correctness
One weakness worth noting (see suggestion 1): the test inspects the raw C. Test quality
Minor convention deviation (see suggestion 2): the assertion uses membership ( D. Alignment with analysis
Recommended next stepsApproved as-is; the fixer may proceed. Two optional strengthenings the fixer (or a follow-up) can fold in:
AGENT_REVIEW_ITERATION: test-1
|
Analyst's findings (summary)
Replication test
Test file:
backend/tests/unit/core/node/test_delete_validator.pyTest name:
test_deleting_generator_target_cascades_to_generator_instanceWhat it tests: Building the real Core schema, the kind that
CoreGeneratorInstance.objecttargets must carry a relationship withon_delete=CASCADEback toCoreGeneratorInstance, so deleting a target object removes its generator instance instead of orphaning it.Verification: Test confirmed FAILING on current code.
Failure reason: On
stabletheobjectrelationship peers toCoreNode, a generic that carries no cascade relationship, so the set of cascade-delete peers is empty andCoreGeneratorInstanceis absent — proving the target object has no cascade path to its generator instance (the orphaning bug). OnceCoreGeneratorInstance.objectpeers to aCoreGeneratorTargetgeneric carrying aninstancesrelationship withon_delete=CASCADE(mirroringCoreArtifactTarget), the peer set becomes{CoreGeneratorInstance}and the test passes.Failure output (last 20 lines)
Test expectations
The test asserts the schema-level cascade contract that fix 2 in the analysis establishes: the node kind targeted by
CoreGeneratorInstance.objectmust have aCASCADEon_deleterelationship pointing back toCoreGeneratorInstance, exactly asCoreArtifact.objectpeers toCoreArtifactTarget(which has anartifactsCASCADE relationship). It reads the target kind dynamically from the processed Core schema rather than hard-coding a not-yet-existing kind, so it fails today (target isCoreNode, no cascade) and passes once the generator-target generic is added and theobjectpeer is repointed to it.Notes:
map_subscriber_ids_by_member, so the originalValueErrorcrash no longer reproduces; the remaining, architecturally-correct behavior is the cascade delete this test targets.test_repository_cascade_reaches_exactly_expected_kindsand reuses the same Core-schema / delete-index setup pattern. It is a unit test (no DB) and runs in ~2s.AGENT_TEST_COMPLETE