Repository navigation
fix(parser): every hop of a multi-hop @flows gets its line's location and continuation; conformance cases for longer chains - #48
Merged
Conversation
…route channel on a longer chain
…xtend every hop's description A multi-hop @flows in a .gal sidecar sited only its first hop at the @source block; later hops kept the .gal file as their location, so they had no handler or anchor. A '-- "..."' continuation line extended only the last hop's description. Both now apply to every hop, as SPEC §3.2 @flows (Chains) states. Two conformance cases pin them; both fail on the previous parser.
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.
What changed
Fix: every hop of a multi-hop
@flowsgets the whole lineSPEC §3.2
@flows(Chains) says that every hop carries the line's mechanism, description and location. Onmainthe parser did not do that in two cases:Sidecar chains were sited at the
.galfile. In.guardlink/annotations/app/pay.py.gal:On
main,guardlink parsegave the first hopapp/pay.py:4withorigin_filepointing at the sidecar. The second hop got.guardlink/annotations/app/pay.py.gal:2with no origin, so it had no handler or anchor and sent readers to the sidecar instead of the code.parseStringnow applies the@sourcelocation to every record a line produces. All hops share one location object, the same as inline hops.Continuation lines extended only the last hop. For
# @flows #a -> #b -> #c via tok -- "first"followed by# -- "second",maingave hop 1 the descriptionfirstand hop 2first second. A continuation now appends to every record the line above produced, so both hops readfirst second.The SPEC sentence on chains now names both cases explicitly, and the CHANGELOG has an entry under Unreleased → Fixed.
Longer chains in the conformance corpus
Until now,
conformance/flows.jsonexercised only a three-endpoint chain. This PR adds fiveparsecases:chain/four-endpoints-via-description: four endpoints become three hops, each with the full mechanism and description.chain/five-endpoints-no-via: five endpoints become four hops, each with anullmechanism. This one chain uses all four endpoint forms: component path (User,Svc.Api),#id,#repo.idand quoted.route/four-endpoint-chain:via PATCH./orders/{id}?fields (json)on four endpoints becomes three hops. Each keeps the full mechanism and the routePATCH /orders/{id}.chain/continuation-every-hop: a continuation line reaches both hops of an inline chain.sidecar/chain-every-hop-sited: both hops of a sidecar chain are sited atapp/pay.py:4, withorigin_fileandorigin_lineset, and a continuation in the.galfile reaches both.Only cases are added, so the corpus format
versionstays at 1. The corpus now has 44 cases, 27 of themparsecases.Verification
src/parser/parse-file.tsfrommainswapped in, exactly the two new cases for the fix fail (chain/continuation-every-hopandsidecar/chain-every-hop-sited). With this branch's parser, all 45 corpus tests pass.npm run build, thennpm test: 111 files, 1973 passed, 1 skipped.npm run lint: clean.guardlink validate . --artifacts: current and drawable. Re-runningsyncandartifactschanges nothing, because this repository's own model has no multi-hop@flowsaffected by the fix.