Bug Description
_validate_bus compares a BusRef's schema against the program's with is, but deepcopy, loads and with_waveforms all hand back a program holding a fresh copy of the BusSchema. Every ref built from the original schema is then rejected as foreign, so you cannot keep building on a program derived from another one. BusSchema defines no __eq__, so identity is currently the only comparison available; giving it structural equality and comparing with == would fix all three paths.
Minimal Reproducible Example
import copy
import qprogram as qp
from qprogram.buses import BusSchema
s = BusSchema.transmon()
p = qp.QProgram(schema=s)
p.measure(s.q[0].readout, "r", "w")
copy.deepcopy(p).measure(s.q[0].readout, "r", "w")
Expected Behavior
A copied, reloaded or waveform-bound program keeps accepting bus references from the same schema it was built with.
Actual Behavior
File "src/qprogram/qprogram.py", line 925, in _validate_bus
raise ValidationError(msg)
qprogram.errors.ValidationError: BusRef 'q0/readout' (element='q', kind='readout') comes from a different BusSchema than the one attached to this QProgram. A program may use only one schema; use a plain string bus name if you need to reference a bus that lives outside the schema.
System Information
qprogram 0.1.0
python 3.14.3 | Linux-7.0.0-30-generic-x86_64-with-glibc2.43
vendors none
Bug Description
_validate_buscompares aBusRef's schema against the program's withis, butdeepcopy,loadsandwith_waveformsall hand back a program holding a fresh copy of theBusSchema. Every ref built from the original schema is then rejected as foreign, so you cannot keep building on a program derived from another one.BusSchemadefines no__eq__, so identity is currently the only comparison available; giving it structural equality and comparing with==would fix all three paths.Minimal Reproducible Example
Expected Behavior
A copied, reloaded or waveform-bound program keeps accepting bus references from the same schema it was built with.
Actual Behavior
System Information
qprogram 0.1.0 python 3.14.3 | Linux-7.0.0-30-generic-x86_64-with-glibc2.43 vendors none