runtime: the pre-flight resolves the edge the join wrote (ACE-133) - #319
Open
sandeep-agami wants to merge 1 commit into
Open
runtime: the pre-flight resolves the edge the join wrote (ACE-133)#319sandeep-agami wants to merge 1 commit into
sandeep-agami wants to merge 1 commit into
Conversation
The fan and chasm detectors matched a declared edge to a join by table pair and never read the columns the join wrote, so a subclass view joined to its base table on the key the model declares one-to-one was reported as a fan trap whenever a sibling many-to-one between the same pair was also declared, while the joins section of the same receipt, which reads the written key, called the join one-to-one. The edge list each arm's detectors read is now narrowed to the edges whose declared columns the written join matches; a join on a key the model does not declare, or two tables in scope with no join between them, keep every edge and today's verdict. Spec: ACE-133 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Spec: ACE-133 (agami-sdlc
projects/agami-core-extension/specs/reconcile-evidence/ACE-133-fan-trap-written-edge.md)Stacked on #318 (ACE-132). Round 9 of the reconcile stack, from the 51-row run.
The finding
"Pre-flight reports fan_trap on a join it elsewhere reports as one-to-one." A subclass view joined to its base table on the key the model declares
one_to_onewas reportedfan_trapon two aggregates bysm prepare, whilesm receipton the identical statement called the joinone_to_one. Clearing the finding forced a UNION ALL restructure of a correct statement._one_side_facing_manycollected every multiplying relationship between the two tables by table pair and never readfrom_column,to_columnor the written ON; co-presence in scope was the whole test. Not "first found": every edge between the pair is unioned, so declaration order cannot help. The receipt's joins section matches by column pairs (_declared_pairs(rel) <= js.pairs), a different algorithm with no shared helper, which is how one receipt contradicted itself. No test declared two usable edges between one pair;test_ace059_join_adherence.pyrules the shape out on purpose.The change
runtime.py_written_join_pairs(tree, scope_map): this SELECT's own joins as the column pairs each wrote, keyed by the unordered table pair, under_joined_table_pairs's pinning rule (an ON that names its own join's two relations; an unresolved qualifier contributes nothing)._edges_as_written(rels, tree, scope_map, dialect): for a table pair the statement joined with a readable key, when at least one declared edge between them matches that key, only the matching edges stay in the list; otherwise every edge stays._declared_pairs's None is "does not match", never a wildcard._aggregate_reports, before the chasm and fan detectors, so both read one list._one_side_facing_manyand_many_side_facing_oneare unchanged.A join on a key the model does not declare, or two tables in scope with no join between them (CROSS JOIN, a chain through a third table), keep every edge and today's verdict: over-reporting a fan says more than it had to; clearing one on an undeclared key would say something false.
Tests
tests/test_ace060_trap_free_aggregates.py, a new synthetic two-edge fixture (widget,widget_premium_v;one_to_oneonidandmany_to_oneonparent_id, the sibling declared first so a reorder could not pass): the identity join isnot_multipliedand the joins section of the same receipt readsdeclared,one_to_one(red before the change); the sibling join fans and names the join; a join on an undeclared key and a CROSS JOIN keep today's verdict. 507 passed across the trap, receipt, adherence, filter, probes and reconcile end-to-end suites.🤖 Generated with Claude Code