aws-cqc / aws-cqc/DeviceLayout.jl
`transformation` does not find `Path` attachments
- Dominant language
- Julia
- Stars
- 67
- Forks
- 14
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 21
Description
`refs(::Path)` creates an array of new references relative to the path origin every time it's called. This leads to the following issue:
```jl
using DeviceLayout, .PreferredUnits
c = CoordinateSystem("main")
pa = Path()
straight!(pa, 100nm, Paths.Trace(10nm))
place!(c, pa)
c2 = CoordinateSystem("attachment")
ref_orig = sref(c2)
attach!(pa, ref_orig, 5nm, location=1)
ref_from_path = refs(pa)[1]
# Bug: Neither of these finds the attachment
transformation(c, ref_orig)
transformation(c, ref_from_path)
```
In the first case, `transformation(c, ref_orig)` does not find the reference because it checks against `refs(pa)`, in which the reference has origin (5, -5), instead of checking the style where the original reference is stored. In the second case, it does not find the reference because it checks identity (`===`), but a new (mutable) instance is created every time `refs` is called. The documentation doesn't say that either of these should work, but at least one probably should. Hard to say which, because I'm not sure any user has needed to do either on purpose. It just bothers me that this doesn't work.
Note that references inside those attachments can still be found by `transformation`—it's just the things directly attached to the path that face this issue.
Contributor guide
Research direction
Reproduce the issue with the provided Julia example, then inspect the transformation, refs, and attach! entry points to determine how directly attached references are matched. Clarify whether the original reference or the generated path reference should be accepted, and add regression coverage showing the chosen behavior for both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100