An agree check can compare against the record's own to-one - #7677
Open
nedelcho-delchev-tues wants to merge 2 commits into
Open
nedelcho-delchev-tues wants to merge 2 commits into
nedelcho-delchev-tues wants to merge 2 commits into
Conversation
`agree` resolved both of its sides as `<relation>.<onProperty>`, so it could only ever compare two hops. The rule an opening balance needs is the other shape: the record carries a fiscal `year` (which belongs to a company) and a `company` of its own, and what has to agree is `Year.Company == Company` - one hop on the left, none on the right. It could not be authored at all. A side whose hop does not resolve now falls back to the record's own to-one, but only when the OTHER side's hop did resolve: an `onProperty` that names nothing on either target must keep saying so rather than be read as a comparison of two bare foreign keys. Both sides must still end on the same entity - comparing a Company key with a Customer key is refused for the reason eclipse-dirigible#7095 refuses it one construct over, the two nomenclatures making the comparison always false. A path that fails also leaves no hop behind in the walker it shares with the other side, so the own-to-one side emits no load for a record it never reads. Fixes eclipse-dirigible#7631 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…own-to-one # Conflicts: # .claude/docs/intent-dsl-features.md
This branch has not been deployed
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.
Fixes #7631
agreeresolved both of its sides as<relation>.<onProperty>, so it could only ever compare two hops. The rule an opening balance needs is the other shape: the record carries a fiscalyear(which belongs to a company) and acompanyof its own, and what has to agree isYear.Company == Company— one hop on the left, none on the right. There was no way to author it.A side now falls back to the record's own to-one, resolved from the bare relation name by the same walker, and the authoring stays what it was:
- { kind: agree, relations: [year, company], onProperty: company }The fallback is taken only when the other side's hop resolved. An
onPropertythat names nothing on either target keeps reporting exactly that, instead of being silently read as a comparison of the two bare foreign keys.Both sides must still end on the same entity. The widening makes one new mistake reachable — comparing keys from two nomenclatures, a Company id against a Customer id — which is refused for the reason #7095 refuses it one construct over: the comparison can only ever be false.
A failed path now leaves no hop behind.
ResolvePathSupport.Walkerregistered a step for each prefix it walked even when the path went on to fail at its terminal, so the side that falls back would have emitted a load for a record it never reads. A resolve that fails now rolls its steps back, which is right for every caller.Covered by
IntentParserTest.anAgreeSideMayBeTheRecordsOwnToOne(the shape parses, a mismatched nomenclature is refused, a typo'donPropertystill says it names nothing) andEdmIntentGeneratorTest.anAgreeSideMayBeTheRecordsOwnToOne(the own side renders asentity.Companywith no hop, and only the hopped side is loaded). The engine-intent suite is green: 1481 tests.