Repository navigation
Handle different refs on target - #48
Merged
Merged
Conversation
rracariu
approved these changes
Nov 17, 2026
kianj2
approved these changes
Nov 17, 2026
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.
Relativize filters to other refs on the target
Why
A graphic bound to an equip often needs to reference points that aren't under that equip. For example, an equip with a
cooRefto a sibling co-ordinator record needs filters for the co-ordinator's points, written relative to the equip:Previously,
includeOtherRefsonly matched records that carry the same ref as the target (cooRef == $cooRef). Records contained under the referenced record couldn't be relativized, so the call threw.What changed
makeRelativeHaystackFilterForTargetnow tries a priority-ordered list of anchor refs on the target. For each anchor, a record matches if it either:cooRef == $cooRef and ...(the existing behaviour), orequipRef == $cooRef and ...orequipRef->equipRef == $cooRef and ....The first match wins and sets the macro used in the filter (
$id,$cooRef, ...).Anchor selection
idis always tried first, then the other Ref tags on the target. Containment refs (siteRef,equipRef,spaceRef,floorRef) are never used, because they point to ancestors and would match far too broadly. Ifoptions.namespaceis given, any ref defs it marks withcontainedBy(HNamespace.getContainmentRefs()) are excluded as well.targetRefNames?: string | string[]option replaces automatic discovery and is used exactly as given, in order. Includeidif you want it. An empty value falls back to automatic discovery.includeOtherRefs: falselimits automatic discovery toidonly.Other changes
resolveDictPathForIdis renamed toresolveContainedPath(anchorRef, ...).makeRelativeHaystackFilterForTarget,includeOtherRefsandtargetRefNames.getParentRefTagis unchanged and still uses its hardcoded order.Compatibility
$idand shared-ref results are unchanged.Tests
A new
anchor refsblock inspec/filter/relativize.spec.tscovers:$id, contained and nested-contained matchesidprecedence over other refsincludeOtherRefs: falsetargetRefNamesas a string, a list, in priority order, and empty