diff --git a/changelog.md b/changelog.md index 96a5af23..81865290 100644 --- a/changelog.md +++ b/changelog.md @@ -15,6 +15,13 @@ sustained stretch without a correction. ## Unreleased +### ModelRepo clone layouts are resolved + +Models that declare `clones` now expose the inherited wire layout with numeric +parameter replacements applied before child-only extensions. This fixes both +ordinary and PCOM cab addressing and the cloned reverb families. A malformed +model logs the model and reason, then falls back locally without discarding the +rest of the device catalog. ### Rename the unit, drive undo/redo, and read inhibited modules `set_device_name()` sends a sparse Version update. `undo()` and `redo()` drive @@ -52,7 +59,7 @@ the only enum whose names are known to differ from what the screen shows. `OPTION_AUDIT` tells you whether anybody has held a list against the unit's screen. It does not tell you how much rides on the answer, and that is the other -half of the question: `Off,On` decides 222 parameters and `CHO1,CHO2` decides +half of the question: `Off,On` decides 278 parameters and `CHO1,CHO2` decides two, so 94 unread lists are not 94 equal jobs. `OPTION_USAGE` publishes the count for every fixed list, keyed by the labels @@ -64,11 +71,11 @@ from pyquadcortex.protocol import options unread = [labels for labels, status in options.OPTION_AUDIT.items() if status is None] unread.sort(key=lambda labels: (-options.OPTION_USAGE[labels], len(labels), labels)) -options.OPTION_USAGE[unread[0]] # 14 parameters - the biggest unread list +options.OPTION_USAGE[unread[0]] # 40 parameters - the biggest unread list ``` -On the CorOS 4.0.1 snapshot that is 527 parameters across 113 lists, of which -190 across 94 lists are unread. `tests/test_option_audit.py` holds +On the CorOS 4.0.1 snapshot that is 611 parameters across 113 lists, of which +218 across 94 lists are unread. `tests/test_option_audit.py` holds `docs/domain-model.md` to those numbers, so they cannot be carried in prose from a count taken once. @@ -261,9 +268,9 @@ covering all 533 models, and the readings that built it are now tests units needs a catalog, which comes from the unit; `protocol.bpm_to_tempo` and the other standalone helpers still work without one. -**Option names were in the catalog all along.** 527 parameters use 113 distinct +**Option names were in the catalog all along.** 611 parameters use 113 distinct lists, so `pyquadcortex.protocol.options` publishes them as enums -(`options.DynMode3.GATE`, `options.HpfSlope.MINUS_12`); 247 parameters are plain +(`options.DynMode3.GATE`, `options.HpfSlope.MINUS_12`); 303 parameters are plain Off/On and take a `bool`. `set_param_option` needs `source=` only for the twelve dynamic lists. The unit's own spelling stays on the wire (`Noral`). diff --git a/docs/domain-model.md b/docs/domain-model.md index 75172b68..d1622441 100644 --- a/docs/domain-model.md +++ b/docs/domain-model.md @@ -1203,12 +1203,17 @@ omitted with the reason written down. | attribute | on | what it looks like, and what is unknown | |---|---|---| -| `replaces` | 462 | Distinct from the `` attribute of the same name. On a parameter it presumably names a superseded index, which would matter for reading an old preset. Untested | | `toggleOn`, `toggleOff`, `toggleStep` | 132 / 83 / 13, 212 parameters between them | `toggleOn` carries a number on `float` parameters such as a tremolo's `LEVEL`, and `toggleStep` sometimes carries a pair (`"0,1"`). The obvious reading is the two values a footswitch toggle alternates between. Untested | | `tooltip` | 126 | The help text the unit shows. Real prose, sometimes with content: a Vibrato's `MODE` warns that changing it causes a brief mute. The values contain HTML | | `selfTestValue` | 66 | A value the unit uses during its self test. Sometimes an IR name, sometimes a token | | `isplayPos` | 1 | `displayPos` with the `d` missing. The catalog's own typo, recorded rather than silently accepted as an alias | +Numeric parameter `replaces` values are inherited wire indexes on a model that +declares `clones`; the parser resolves them before publishing the model. +`Model/@clones` names the parent layout. The nonnumeric `replaces="INTENSITY"` +on `MX Vibe` remains unexplained and makes only that model fall back to its local +parameter order. + ### `type` names the widget, and two of its values are readouts Across the catalog `type` takes twelve values: `float` 2618, `switch` 461, @@ -1375,23 +1380,24 @@ against `Return 1/2`, `USB 5` against `USB input 5`). So every list's names are a hypothesis until a person reads them off the unit. `options.OPTION_AUDIT` publishes which have been, keyed by the labels rather than by the enum so the two Off/On lists and the metronome list, which get no enum -and are 260 parameters between them, can be recorded too. The readings are in +and are 316 parameters between them, can be recorded too. The readings are in `tests/fixtures/catalog/option_readings.json`, one row per position, and `scripts/generate_options.py` stamps each enum's docstring from them. -**Where it stands (2026-09-16, CorOS 4.0.1): 13 audited, 1 drawn, 5 not drawn, -94 unread**, of 113 fixed lists. The fourteen read lists cover 301 of the 527 -parameters that carry a fixed list. The 94 unread cover 190. +**Where it stands (2026-09-16, CorOS 4.0.1): 13 audited, 1 drawn, 5 absent, +94 unread**, of 113 fixed lists. The 14 assessed lists cover 357 +parameters; 5 lists looked for and not drawn account for 36, and the 94 +unread lists account for 218 of the 611 parameters that carry a fixed list. What is left is not 94 equal jobs. Ranked by how many parameters each list -decides, the tail falls away fast: the biggest five cover 54 of the 190. +decides, the tail falls away fast: the biggest five cover 82 of the 218. `options.OPTION_USAGE` publishes the count for every list, so a session at the unit can be planned from the library rather than from a count taken once. | parameters | positions | list | somewhere it appears | |---|---|---|---| +| 40 | 3 | `Small,Med,Large` | Ambience / `SIZE` | | 14 | 17 | a 17-entry `SYNC NOTE` | Vibrato / `SYNC NOTE` | -| 12 | 3 | `Small,Med,Large` | Ambience / `SIZE` | | 11 | 3 | `Off,Duck,Gate` | Digital Delay (ST) / `DYN MODE` | | 9 | 14 | a 14-entry `SYNC NOTE` | Dual Chorus / `SYNC NOTE` | | 8 | 3 | `Normal,Thick,Thicker` | CA 1Star Clean 50W Normal / `EQ` | @@ -1411,7 +1417,7 @@ defines. | list | parameters | how it was read | |---|---|---| -| `Off,On` | 222 | a Circular Delay's `SYNC` and `TRAILS`, each position driven | +| `Off,On` | 278 | a Circular Delay's `SYNC` and `TRAILS`, each position driven | | `SYNC NOTE` (21 entries) | 28 | the dial in order, anchored at 0 and 13 | | `OFF,ON` | 25 | the same block's `VINTAGE MODE`, each position driven | | `OFF,MUTE,DOWN,ON` | 13 | the metronome cells, re-driven as the control | diff --git a/docs/protocol.md b/docs/protocol.md index c75a37eb..b38c65fd 100644 --- a/docs/protocol.md +++ b/docs/protocol.md @@ -1984,10 +1984,14 @@ The XML is ``. - **`Model/@id` is the wire hash.** Ids are globally unique: category 4 (Equalizer) holds 4000 to 4007, category 21 (Cabsim Bass) holds 21001 to 21009. -- **`` children are in wire-index order**, each with `min`, `max`, +- **Resolved `` children are in wire-index order**, each with `min`, `max`, `defaultValue`, `units`, `skew`, `steps`, `stepNames`, `type` and more. This is - what gives a parameter index meaning: writing index 0 of a cab moves no visible - knob because a cab's own entry lists internal `ir selector` parameters. + what gives a parameter index meaning. A model may declare `clones`; numeric + parameter `replaces` values place child metadata at inherited indexes and + child-only parameters extend the layout. Read-only CorOS 4.1.0 checks by + Antoni Ivanov on 2026-09-08 confirmed the 21/31-parameter cab parent layouts + and the cloned `Gojira REV` ordering; Jonathan Stokes independently confirmed + the same shapes on CorOS 4.0.1 on 2026-09-09. - **Parameter values on the wire are normalized 0..1.** Sending `1.0` to a `THRESHOLD` whose catalog range is -60..+12 dB made the unit display +12.0 dB. @@ -1998,6 +2002,7 @@ Attributes that classify a model: | `sku`, `plugin_id` | purchasable plugin content; a given unit may not have it | | `hidden`, `internal` | not user-facing; `hidden` also appears on whole categories. Read the value, not the presence: two ordinary amps ship `hidden="false"` (Bogna Uber Clean 1130, Bogna Uber Lead 1131) | | `replaces` | this model supersedes the listed id(s). Both stay in the catalog and can share a display name (two "Graphic-9" equalizers, 4005 replacing 4002) | +| `clones` | this model inherits another model's parameter layout; numeric parameter-level `replaces` values override inherited wire indexes | Because the catalog comes from the unit it also covers Neural Captures (categories 14 and 20), which are user content. The library ships generated diff --git a/pyquadcortex/protocol/catalog.py b/pyquadcortex/protocol/catalog.py index 626e1027..e706d178 100644 --- a/pyquadcortex/protocol/catalog.py +++ b/pyquadcortex/protocol/catalog.py @@ -24,12 +24,16 @@ from __future__ import annotations +from dataclasses import dataclass, field, replace import gzip import io +import logging import math import tarfile import xml.etree.ElementTree as ET -from dataclasses import dataclass, field, replace + + +logger = logging.getLogger(__name__) # The numbers behind the catalog's symbolic bounds. `units` imports nothing from # this module, so this direction is the only one and there is no cycle. @@ -882,10 +886,93 @@ def _parameter(index: int, p, model_name: str) -> Parameter: ) +def _effective_parameter_elements( + model, + models: dict[int, ET.Element], + resolving: tuple[int, ...] = (), +) -> tuple[tuple[int, ET.Element], ...]: + """Return a model's parameters at their effective wire indexes. + + ModelRepo models may ``clone`` another model and publish only the + parameters they replace. Each child's numeric ``replaces`` attribute is the + inherited wire index; child parameters without one extend the resolved + list. On the contributed CorOS 4.1.0 catalog (2026-09-08, Antoni Ivanov), + cabs clone four different 21- or 31-parameter layouts and a reverb family + clones model 8015. Jonathan Stokes confirmed the same 4.0.1 layout sizes + on 2026-09-09. + + A missing clone target is diagnosed and treated like an ordinary model. A + malformed clone (including a cycle) raises here so :func:`parse_model_repo` + can fall that model back to its local parameters without discarding the + catalog. + """ + model_id = _as_int(model.get("id")) + assert model_id is not None + if model_id in resolving: + chain = " -> ".join(str(ident) for ident in (*resolving, model_id)) + raise ValueError(f"ModelRepo clone cycle: {chain}") + + clone_id = _as_int(model.get("clones")) + base = models.get(clone_id) if clone_id is not None else None + if clone_id is not None and base is None: + model_name = model.get("name", "") + raise ValueError( + f"ModelRepo model {model_id} ({model_name!r}) declares missing " + f"clone parent {clone_id}" + ) + if base is None: + effective = list(enumerate(model.findall("Parameter"))) + else: + inherited = _effective_parameter_elements(base, models, (*resolving, model_id)) + by_index = dict(inherited) + replacements = [] + extensions = [] + for parameter in model.findall("Parameter"): + raw = parameter.get("replaces") + if raw is None: + extensions.append(parameter) + continue + replaced = _as_int(raw) + if replaced is None: + raise ValueError( + f"ModelRepo model {model_id} has non-numeric parameter " + f"replaces={raw!r}" + ) + replacements.append((replaced, parameter)) + + seen = set() + for index, parameter in replacements: + if index in seen: + raise ValueError( + f"ModelRepo model {model_id} replaces parameter index " + f"{index} more than once" + ) + seen.add(index) + by_index[index] = parameter + next_index = max(by_index, default=-1) + 1 + for parameter in extensions: + by_index[next_index] = parameter + next_index += 1 + effective = sorted(by_index.items()) + + indexes = [index for index, _ in effective] + if indexes != list(range(len(indexes))): + raise ValueError( + f"ModelRepo model {model_id} resolves to non-contiguous parameter " + f"indexes {indexes}" + ) + return tuple(effective) + + def parse_model_repo(payload: bytes) -> ModelCatalog: """Parse a device ModelRepo payload into a :class:`ModelCatalog`.""" root = ET.fromstring(_extract_xml(payload)) catalog = ModelCatalog() + elements = { + model_id: element + for element in root.iter("Model") + if (model_id := _as_int(element.get("id"))) is not None + } for category in root.findall("Category"): category_id = _as_int(category.get("id")) category_name = category.get("name", "") @@ -901,9 +988,23 @@ def parse_model_repo(payload: bytes) -> ModelCatalog: model_id = _as_int(element.get("id")) if model_id is None: continue + try: + effective = _effective_parameter_elements(element, elements) + except ValueError as exc: + # A catalog can include purchased content and player-created + # models this build has never seen. One malformed clone must + # not discard every other model; preserve its local parameters + # in published order, as the parser did before clone support. + logger.warning( + "ModelRepo model %s clone resolution failed; using its local " + "parameter order: %s", + model_id, + exc, + ) + effective = tuple(enumerate(element.findall("Parameter"))) parameters = tuple( - _parameter(i, p, element.get("name", "")) - for i, p in enumerate(element.findall("Parameter")) + _parameter(index, parameter, element.get("name", "")) + for index, parameter in effective ) catalog.models[model_id] = Model( id=model_id, diff --git a/pyquadcortex/protocol/catalogs/coros_4_0_1/options.py b/pyquadcortex/protocol/catalogs/coros_4_0_1/options.py index 31ade1ca..d7c63f73 100644 --- a/pyquadcortex/protocol/catalogs/coros_4_0_1/options.py +++ b/pyquadcortex/protocol/catalogs/coros_4_0_1/options.py @@ -7,11 +7,11 @@ qc.set_param_option(block, 'DYN MODE', options.DynMode.GATE) -110 enums cover 267 parameters, because the same list means +110 enums cover 295 parameters, because the same list means the same thing wherever it appears - the note-length list is shared by ``SYNC NOTE``, ``SYNC NOTE L``, ``SYNC NOTE R`` and two more. -**A two-option Off/On parameter gets no enum.** 247 parameters +**A two-option Off/On parameter gets no enum.** 303 parameters offer exactly those, and ``True`` says everything ``OffOn.ON`` would:: qc.set_param(block, 'SYNC', True) @@ -1361,9 +1361,9 @@ class Scale(IntEnum): class Size(IntEnum): - """12 parameters use this list: SIZE + """40 parameters use this list: SIZE - On 12 models, among them Ambience, Dual (M), Dual (M) Lite. + On 40 models, among them Ambience, Cory Wong Cab 1 (M), Cory Wong Cab 1 (ST). NOT audited against the screen. These names are the catalog's ``stepNames``, which is not known to be the @@ -2203,14 +2203,14 @@ class VoiceMode(IntEnum): #: LABELS, like the audit, so the three lists with no enum are in #: it too. #: -#: Totals on this snapshot: 527 -#: parameters across 113 lists, of which 190 across +#: Totals on this snapshot: 611 +#: parameters across 113 lists, of which 218 across #: 94 lists nobody has read. The work is long-tailed - the -#: five biggest unread lists cover 54 of those 190. +#: five biggest unread lists cover 82 of those 218. OPTION_USAGE = { ('OFF', 'MUTE', 'DOWN', 'ON'): 13, # no enum ('OFF', 'ON'): 25, # no enum - ('Off', 'On'): 222, # no enum + ('Off', 'On'): 278, # no enum ('Bypass', '90°', '180°'): 2, # Adjust ('1/16', '1/8T', '1/16D', '1/8', '1/4T', '1/8D', '1/4', '1/2T', '1/4D', '1/2', '1/1T', '1/2D', '1/1'): 2, # AnalogDelayMSyncNote ('Up', 'Down', 'Up & Down', 'Down & Up', 'Random'): 1, # ArpPattern @@ -2291,7 +2291,7 @@ class VoiceMode(IntEnum): ('MULTI', 'HP', 'OUT 1/2', 'OUT 3/4', 'SEND 1/2'): 1, # Routing ('Grid', 'In 1', 'In 2', 'Ret 1', 'Ret 2', 'In 1/2', 'Ret 1/2', 'Out1', 'Out2', 'Out3', 'Out4', 'Out1/2', 'Out3/4', 'Multi'): 1, # RoutingMode ('Major', 'Minor'): 1, # Scale - ('Small', 'Med', 'Large'): 12, # Size + ('Small', 'Med', 'Large'): 40, # Size ('1/64T', '1/64', '1/32T', '1/64D', '1/32', '1/16T', '1/32D', '1/16', '1/8T', '1/16D', '1/8'): 2, # SlapbackDelayMSyncNote ('6dB/Oct', '12dB/Oct', '18dB/Oct', '24dB/Oct'): 1, # Slope ('Clean', 'Crunch', 'Lead'): 1, # SoldanoSlo100Channel diff --git a/pyquadcortex/protocol/catalogs/coros_4_0_1/params.py b/pyquadcortex/protocol/catalogs/coros_4_0_1/params.py index 451dd88c..3e0261b7 100644 --- a/pyquadcortex/protocol/catalogs/coros_4_0_1/params.py +++ b/pyquadcortex/protocol/catalogs/coros_4_0_1/params.py @@ -16,9 +16,10 @@ (ADR-0018). The runtime check is unchanged and still covers every other caller - a string, a bare index, or anyone not running a checker. -**Cabs share one layout.** The catalog lists two parameters for a cab - -its two mic selectors - while the wire carries 22. So a cab is CHOSEN by -its `models.*` id and DRIVEN through :class:`Cabsim`:: +**Cabs use multiple layouts.** :class:`Cabsim` names the ordinary +21-parameter layout; PCOM cabs have 31 catalog parameters and should be +resolved through the connected device's catalog. A cab is chosen by its +`models.*` id:: cab = Block(0, 5, models.CabsimGuitarM.N412_CA_STAND_OS_S_V30_90S_M) qc.set_block(cab) @@ -157,27 +158,30 @@ class TempoParam(ParamSet): STEPSTATE12: Param[NoUnit] = Param(22, 'STEPSTATE12') # empty -# -- cabs: one layout, shared by every cab model ------------------------------ +# -- ordinary 21-parameter cab layout --------------------------------------- class Cabsim(ParamSet): - """Every cab model's parameters. The catalog under-describes these. + """The ordinary 12000-family cab layout (21 catalog parameters). - Measured on four cabs across all four categories: the wire carries - 22 parameters in the `Default Cabsim` layout regardless of which cab - is loaded, or whether it is mono or stereo. `MIC_1_PAN` is labelled - BALANCE on a stereo cab and PAN on a mono one - one wire index, two - screen names. + The wire carries one additional undocumented value at index 21. PCOM + cabs instead clone a 31-parameter layout (and carry 32 wire values), + so resolve their extra controls through the live catalog. + + The catalog declares index 3 as PAN over 0..10 on mono layouts and + BALANCE over -1..1 on stereo layouts. Neither span matches the + screen: on CorOS 4.0.1 both layouts displayed wire values 0, 0.5, + 0.75 and 1 as 50 L, C, 25 R and 50 R. See issue #55. The mic-to-index mapping was confirmed against the unit's own - editor. Index 21 exists on the wire, is absent from the catalog and + editor on mono cabs. Index 21 exists on the wire, is absent from the catalog and reads 0.0 everywhere, so it is omitted rather than guessed at. """ MIC_1_BYPASS: Param[NoUnit] = Param(0, 'MIC_1_BYPASS') # switch MIC_1_IR_SELECTOR: Param[NoUnit] = Param(1, 'MIC_1_IR_SELECTOR') # string MIC_1_LEVEL: Param[DbUnit] = Param(2, 'MIC_1_LEVEL') # float dB - MIC_1_PAN: Param[NoUnit] = Param(3, 'MIC_1_PAN') # float + MIC_1_PAN: Param[NoUnit] = Param(3, 'MIC_1_PAN') # float; mono PAN 0..10, stereo BALANCE -1..1 MIC_1_DISTANCE: Param[NoUnit] = Param(4, 'MIC_1_DISTANCE') # float MIC_1_POSITION: Param[NoUnit] = Param(5, 'MIC_1_POSITION') # float MIC_1_PHI: Param[NoUnit] = Param(6, 'MIC_1_PHI') # switch diff --git a/pyquadcortex/protocol/targets.py b/pyquadcortex/protocol/targets.py index 7da0d9ec..18a7cf54 100644 --- a/pyquadcortex/protocol/targets.py +++ b/pyquadcortex/protocol/targets.py @@ -34,15 +34,6 @@ from pyquadcortex.protocol.errors import ControlNotDrivable -#: Catalog model ids for the containers whose model never varies. -CABSIM_LAYOUT = 12000 -#: The categories whose models use the `Default Cabsim` layout. Enumerated -#: rather than matched on a "Cabsim" prefix: this repo's precedent is -#: `LANE_OUTPUT_UNASSIGNABLE` - "a MEASURED LIST, not a rule" - and a prefix -#: would silently sweep in a future category whose layout may differ. -#: `tests/hardware/test_generated_constants.py` holds the same four names. -CABSIM_CATEGORIES = ("Cabsim Guitar (M)", "Cabsim Guitar (ST)", - "Cabsim Bass (M)", "Cabsim Bass (ST)") LANE_OUTPUT_CONTROL = 23000 INPUT_GATE_CONTROL = 28000 TEMPO_CONTROL = 25000 @@ -133,10 +124,8 @@ def index_of(self, param, get_catalog, model=None): spoken to a device. Ask for :meth:`spec_at` when the spec is actually needed. - The name resolves against :meth:`wire_model`, not against the model's - own entry, because the index this returns is a WIRE index. On a cab - those are different lists - see that method - and resolving against the - model's own one returned a number that addressed a different knob. + The name resolves against :meth:`wire_model`; ModelRepo clone + inheritance has already made that model's parameters wire-indexed. """ if isinstance(param, str): source = self.wire_model(get_catalog, model) @@ -156,11 +145,9 @@ def index_of(self, param, get_catalog, model=None): def spec_at(self, index, get_catalog, model=None): """The catalog :class:`~pyquadcortex.protocol.catalog.Parameter` at ``index``. - ``index`` is a WIRE index, so this reads :meth:`wire_model` rather than - the model's own entry. There is one answer to "what sits at wire index - N" and every caller wants the same one - the unit check, the string - guard, the bool guard and the conversion. Two methods answering it two - ways is what ADR-0016's triage found twice. + ``index`` is a WIRE index, so this reads :meth:`wire_model`. There is + one answer to "what sits at wire index N" and every caller wants the + same one. ``None`` when the catalog does not describe it, which is a real case: the wire carries more parameters than the catalog documents on several @@ -173,60 +160,13 @@ def spec_at(self, index, get_catalog, model=None): return source.parameters[index] def wire_model(self, get_catalog, model=None): - """The catalog :class:`Model` whose parameter list is WIRE-INDEXED here. - - Usually the block's own model. The exception is a cab, and the reason is - not that the catalog under-describes it - it is that a cab's own entry - is a LOCAL list, numbered from zero over the parameters that model - contributes, and those numbers do not address the wire. - - `Plini Cab (M)` (12053) is the whole argument. Its own entry reads - ``0:ir selector 1:ir selector 2:POSITION 3:DISTANCE 4:POSITION - 5:DISTANCE``, and the shared `Default Cabsim` layout reads - ``0:bypass 1:ir selector 2:LEVEL 3:PAN 4:DISTANCE 5:POSITION``. They are - not the same list with holes in it; they are different numberings of - overlapping parameters. Writing wire index 2 on that block and reading - the screen settled which one the wire speaks: it showed ``LEVEL - -3.0 dB``, the layout's answer, with the block's own POSITION untouched - beside it. Recorded in `tests/test_scales.py`. 12 cabs name their own - index 2 that way - 8 call it DISTANCE and 4 POSITION - and on the other - 157 it is absent, which is why the disagreement was invisible for so - long: 157 of 174 fail quietly rather than wrongly. - - So the test is whether the model's own list can be wire-indexed at all, - and LENGTH answers it. 169 of the 174 cab models describe 2, 4 or 6 - parameters against the layout's 21, and a list that short cannot be - numbering wire positions from 0 - if it were, index 2 would have read - POSITION on the unit, and it read LEVEL. The other 5 describe 21 or 31 - and start at ``0:bypass`` exactly as the layout does, so they number the - wire themselves and are left alone. - - Leaving those 5 alone matters beyond tidiness: the three 31-parameter - cabs DIVERGE from the layout at index 19, where the layout says - `IR NAME` and they say `ROOM MIX`. Borrowing for a model that already - numbers the wire would be this same bug facing the other way. - - What the catalog adds beyond the reading: of the 16 LEVEL parameters - the 5 self-describing cabs carry between them, every one has - ``MIN_CABSIM_DB`` and ``skew="4.9594844"``, and those 5 include stereo - models. So the device states the law wherever it states anything, and - the 169 that state nothing are exactly the ones that borrow. Applying it - across the category is still an EXTRAPOLATION and saying otherwise would - overstate it - all four blocks read on hardware are mono, and 86 of the - 174 are stereo. - - Only cabs need this. `Parallax` is a Bass Overdrive carrying a cab - section and describes that section itself, which is why it is outside - CABSIM_CATEGORIES and why its own LEVEL carries the cab law - see - `tests/test_scales.py`. + """This target's wire-indexed catalog model. + + :func:`parse_model_repo` resolves the device's declared ``clones`` and + parameter ``replaces`` relationships. Targets therefore need no cab + category heuristic or shared-layout borrowing. """ - source = self.model(get_catalog, model) - if source is None or source.category not in CABSIM_CATEGORIES: - return source - layout = get_catalog().get(CABSIM_LAYOUT) - if layout is None or len(source.parameters) >= len(layout.parameters): - return source - return layout + return self.model(get_catalog, model) def normalize(self, index, real, get_catalog, spec=None): """Convert ``real``, in the parameter's own units, to the wire's 0..1. diff --git a/scripts/generate_options.py b/scripts/generate_options.py index 623e83b9..f3d5abc8 100644 --- a/scripts/generate_options.py +++ b/scripts/generate_options.py @@ -18,12 +18,12 @@ Four decisions this generator makes: -1. **One enum per distinct LIST, not per parameter.** 527 parameters carry a +1. **One enum per distinct LIST, not per parameter.** 611 parameters carry a fixed list and they use only 113 distinct ones, of which 110 get an enum, because the same list means the same thing everywhere: the note-length list is shared by ``SYNC NOTE``, ``SYNC NOTE L``, ``SYNC NOTE R``, ``SYNC NOTE A`` and ``SYNC NOTE B``. One enum per list is one enum per concept. -2. **``Off,On`` gets no enum.** 247 of those 527 offer exactly "Off" and "On", +2. **``Off,On`` gets no enum.** 303 of those 611 offer exactly "Off" and "On", and ``OffOn.ON`` says nothing that ``True`` does not. Those parameters take a bool. 3. **The device's spelling is kept on the wire and corrected in the name.** @@ -542,7 +542,7 @@ def collect_all(cat: catalog.ModelCatalog) -> dict: Every one, including the two that become a bool and the one already published by hand. ``OPTION_AUDIT`` covers these rather than only the enums: a list with no enum is still a list whose words nobody has checked, - and the Off/On pair alone is 247 parameters. Counting only the enums would + and the Off/On pair alone is 303 parameters. Counting only the enums would report the job as smaller than it is. """ lists = collections.defaultdict(list) diff --git a/scripts/generate_params.py b/scripts/generate_params.py index 690592be..f05b6028 100644 --- a/scripts/generate_params.py +++ b/scripts/generate_params.py @@ -17,13 +17,12 @@ python scripts/generate_params.py --snapshot coros_4_1_0 \ --payload tests/fixtures/catalog/model_repo_coros_4_0_1.bin -Three things this generator knows that the catalog does not: +Three things this generator knows beyond the raw catalog rows: -1. **The catalog UNDER-DESCRIBES cabs.** It lists two parameters for a cab - model - the two mic selectors - while the wire carries 22. Measured on four - cabs across all four categories (Bass/Guitar, M/ST): every one is the - ``Default Cabsim`` layout. So the 140 cab models share ONE layout and get one - enum, rather than 140 two-member enums that would each hide 20 parameters. +1. **Cab layouts are families, not one universal layout.** Clone resolution + exposes 21-parameter ordinary and 31-parameter PCOM layouts. The legacy + ``Cabsim`` constants intentionally describe the ordinary 12000 family; + PCOM-only controls must be resolved from the connected device's catalog. 2. **A cab's repeated block is a MICROPHONE**, not an IR slot or a channel. Confirmed against the unit's own editor: mic 1 read POSITION 2.9 / DIST 3.0 and mic 2 read POSITION 5.6 / DIST 3.3, matching wire indices 5 and 13 at @@ -56,8 +55,8 @@ / "pyquadcortex" / "protocol" / "catalogs") -#: The cab layout every cab model actually uses on the wire. Its repeated -#: eight-parameter block is a microphone. +#: The ordinary 21-parameter cab layout used for the backward-compatible +#: ``Cabsim`` constants. PCOM cabs clone a different 31-parameter layout. CABSIM_LAYOUT = 12000 CABSIM_CATEGORIES = ("Cabsim Guitar (M)", "Cabsim Guitar (ST)", "Cabsim Bass (M)", "Cabsim Bass (ST)") @@ -139,7 +138,10 @@ def members(model, group: str = None) -> list[tuple[str, int, str]]: else: name = base units = f" {p.units}" if p.units else "" - out.append((name, p.index, f"{p.type}{units}")) + comment = f"{p.type}{units}" + if model.id == CABSIM_LAYOUT and name == "MIC_1_PAN": + comment += "; mono PAN 0..10, stereo BALANCE -1..1" + out.append((name, p.index, comment)) return out @@ -205,9 +207,10 @@ def render(cat: catalog.ModelCatalog, snapshot: str) -> str: "(ADR-0018). The runtime check is unchanged and still covers every other", "caller - a string, a bare index, or anyone not running a checker.", "", - "**Cabs share one layout.** The catalog lists two parameters for a cab -", - "its two mic selectors - while the wire carries 22. So a cab is CHOSEN by", - "its `models.*` id and DRIVEN through :class:`Cabsim`::", + "**Cabs use multiple layouts.** :class:`Cabsim` names the ordinary", + "21-parameter layout; PCOM cabs have 31 catalog parameters and should be", + "resolved through the connected device's catalog. A cab is chosen by its", + "`models.*` id::", "", f" cab = Block(0, 5, {example_cab(cat)})", " qc.set_block(cab)", @@ -269,17 +272,19 @@ def render(cat: catalog.ModelCatalog, snapshot: str) -> str: for cls, model_id, doc in CONTAINERS: lines += render_enum(cls, doc, cat[model_id]) - lines += ["", "", "# -- cabs: one layout, shared by every cab model " + "-" * 30] + lines += ["", "", "# -- ordinary 21-parameter cab layout " + "-" * 39] lines += render_enum( "Cabsim", - "Every cab model's parameters. The catalog under-describes these.\n\n" - " Measured on four cabs across all four categories: the wire carries\n" - " 22 parameters in the `Default Cabsim` layout regardless of which cab\n" - " is loaded, or whether it is mono or stereo. `MIC_1_PAN` is labelled\n" - " BALANCE on a stereo cab and PAN on a mono one - one wire index, two\n" - " screen names.\n\n" + "The ordinary 12000-family cab layout (21 catalog parameters).\n\n" + " The wire carries one additional undocumented value at index 21. PCOM\n" + " cabs instead clone a 31-parameter layout (and carry 32 wire values),\n" + " so resolve their extra controls through the live catalog.\n\n" + " The catalog declares index 3 as PAN over 0..10 on mono layouts and\n" + " BALANCE over -1..1 on stereo layouts. Neither span matches the\n" + " screen: on CorOS 4.0.1 both layouts displayed wire values 0, 0.5,\n" + " 0.75 and 1 as 50 L, C, 25 R and 50 R. See issue #55.\n\n" " The mic-to-index mapping was confirmed against the unit's own\n" - " editor. Index 21 exists on the wire, is absent from the catalog and\n" + " editor on mono cabs. Index 21 exists on the wire, is absent from the catalog and\n" " reads 0.0 everywhere, so it is omitted rather than guessed at.\n ", cat[CABSIM_LAYOUT], group="MIC") diff --git a/tests/fixtures/catalog_clones.json b/tests/fixtures/catalog_clones.json new file mode 100644 index 00000000..2525ce8e --- /dev/null +++ b/tests/fixtures/catalog_clones.json @@ -0,0 +1,10 @@ +{ + "source": "Distilled ModelRepo clone records. Layout sizes were measured on Quad Cortex CorOS 4.0.1 by the maintainer on 2026-09-09; names and replacement fields below match that catalog.", + "families": [ + {"parent": 12000, "parent_name": "Default Cabsim", "parent_parameters": 21, "child": 12001, "child_name": "412 CA Stand OS S V30 90s (M)", "replacement": {"index": 1, "name": "ir selector", "default": 0}}, + {"parent": 12100, "parent_name": "PCOM Default Cabsim", "parent_parameters": 31, "child": 12050, "child_name": "Gojira Cab 1 (M)", "replacement": {"index": 5, "name": "POSITION", "default": 0.3}}, + {"parent": 32000, "parent_name": "Default Cabsim (ST)", "parent_parameters": 21, "child": 32001, "child_name": "412 CA Stand OS S V30 90s (ST)", "replacement": {"index": 3, "name": "BALANCE", "default": 0}}, + {"parent": 32100, "parent_name": "PCOM Default Cabsim (ST)", "parent_parameters": 31, "child": 32050, "child_name": "Gojira Cab 1 (ST)", "replacement": {"index": 3, "name": "BALANCE", "default": 0}}, + {"parent": 8015, "parent_name": "Default Reverb", "parent_parameters": 29, "child": 8016, "child_name": "Gojira REV", "replacement": {"index": 8, "name": "PRE 1 FREQ", "default": 40.0}} + ] +} diff --git a/tests/hardware/test_generated_constants.py b/tests/hardware/test_generated_constants.py index fa272834..ac8fed47 100644 --- a/tests/hardware/test_generated_constants.py +++ b/tests/hardware/test_generated_constants.py @@ -77,25 +77,29 @@ def test_the_committed_snapshot_matches_this_unit(live_catalog, profile, name): def test_the_cab_layout_claim_still_holds(qc, live_catalog): - """`params.Cabsim` asserts every cab shares the Default Cabsim layout. + """Cab clones resolve to the two layouts measured on CorOS 4.0.1. - That is the one claim in the generated file the catalog cannot support - - the catalog lists two parameters per cab and the wire carries 22 - so it is - held against the catalog entry the layout is taken FROM, and against the - cab models still being under-described in the way that made this necessary. + The ordinary families publish 21 catalog parameters and PCOM families + publish 31. The wire carries one additional value in both cases. This + tripwire replaces the old claim that every cab published only two local + parameters and therefore needed to borrow one shared layout. """ from pyquadcortex.protocol import params - reference = live_catalog[12000] - assert len(reference.parameters) == len(params.Cabsim), ( - "the Default Cabsim layout changed size; params.Cabsim is derived from it") + assert len(live_catalog[12000].parameters) == len(params.Cabsim) == 21 + assert len(live_catalog[12100].parameters) == 31 + assert len(live_catalog[32000].parameters) == 21 + assert len(live_catalog[32100].parameters) == 31 cabs = [m for m in live_catalog if m.category in ("Cabsim Guitar (M)", "Cabsim Guitar (ST)", - "Cabsim Bass (M)", "Cabsim Bass (ST)") - and m.is_factory] - assert cabs, "no factory cabs on this unit" - assert all(len(m.parameters) == 2 for m in cabs), ( - "a cab now publishes more than its two mic selectors - the catalog may " - "have started describing cabs properly, which would make the shared " - "params.Cabsim layout unnecessary") + "Cabsim Bass (M)", "Cabsim Bass (ST)")] + factory = [m for m in cabs if m.is_factory] + if not factory: + pytest.skip( + "this unit exposes no factory cab for the hardware layout check; " + "the available 31-parameter PCOM cabs are purchased content") + assert {len(m.parameters) for m in factory} == {21}, ( + "a factory cab no longer resolves to the ordinary 21-parameter layout") + assert all(m.sku or m.plugin_id for m in cabs if len(m.parameters) == 31), ( + "a 31-parameter PCOM cab is no longer purchased content") diff --git a/tests/test_catalog.py b/tests/test_catalog.py index be7e85c9..a9d1abe4 100644 --- a/tests/test_catalog.py +++ b/tests/test_catalog.py @@ -7,6 +7,8 @@ import gzip import io +import json +import pathlib import tarfile import pytest @@ -125,6 +127,201 @@ def test_parameters_are_ordered_and_carry_metadata(cat): assert cat[5005].parameters[0].units == "dB" +def test_cloned_models_inherit_and_replace_parameters_at_wire_indexes(): + xml = SAMPLE_XML.replace("", """ + + + + + + + + +""") + + cab = catalog.parse_model_repo(make_payload(xml))[12001] + + assert [p.index for p in cab.parameters] == [0, 1, 2, 3, 4] + assert [p.name for p in cab.parameters] == [ + "BYPASS", "CHILD IR 1", "LEVEL", "CHILD IR 2", "EXTRA" + ] + assert cab.parameters[1].default == 0.0 # string defaults remain lenient + assert cab.parameters[2].units == "dB" # untouched inherited metadata + assert cab.parameters[4].default == 5.0 + + +def test_clone_inheritance_is_recursive(): + xml = """ + + + + + + + + + + + """ + + leaf = catalog.parse_model_repo(make_payload(xml))[3] + + assert [(p.index, p.name) for p in leaf.parameters] == [ + (0, "LEAF A"), (1, "MIDDLE B") + ] + + +def test_missing_clone_target_falls_back_to_local_parameters(): + xml = """ + + + + """ + + model = catalog.parse_model_repo(make_payload(xml))[1] + + assert [(p.index, p.name) for p in model.parameters] == [(0, "LOCAL")] + + +def test_missing_clone_target_logs_model_and_parent(caplog): + xml = """ + + + + """ + + catalog.parse_model_repo(make_payload(xml)) + + assert "ModelRepo model 1 ('Partial')" in caplog.text + assert "missing clone parent 999" in caplog.text + + +def test_clone_cycle_falls_back_locally_without_discarding_the_catalog(): + xml = """ + + + """ + + cat = catalog.parse_model_repo(make_payload(xml)) + + assert cat[1].parameters == () + assert cat[2].parameters == () + + +def test_non_contiguous_clone_indexes_fall_back_to_local_parameters(): + xml = """ + + + + + + + """ + + model = catalog.parse_model_repo(make_payload(xml))[2] + + assert [(p.index, p.name) for p in model.parameters] == [(0, "C")] + + +def test_clone_replacements_are_applied_before_extensions(): + xml = """ + + + + + + + + + """ + + model = catalog.parse_model_repo(make_payload(xml))[2] + + assert [(p.index, p.name) for p in model.parameters] == [ + (0, "A"), (1, "CHILD B"), (2, "C") + ] + + +def test_non_numeric_clone_replacement_is_isolated_to_that_model(): + xml = """ + + + + + + + + + + """ + + cat = catalog.parse_model_repo(make_payload(xml)) + + assert [(p.index, p.name) for p in cat[2].parameters] == [(0, "Intensity")] + assert [(p.index, p.name) for p in cat[3].parameters] == [(0, "GAIN")] + + +def test_distilled_real_catalog_clone_families_resolve_at_wire_indexes(): + """Pin measured CorOS 4.0.1 facts independently of the input fixture.""" + path = pathlib.Path(__file__).parent / "fixtures" / "catalog_clones.json" + facts = json.loads(path.read_text(encoding="utf-8")) + models = [] + for family in facts["families"]: + params = "".join( + f'' + for i in range(family["parent_parameters"]) + ) + models.append( + f'' + f"{params}" + ) + replacement = family["replacement"] + models.append( + f'' + ) + xml = '' + "".join(models) + \ + "" + + cat = catalog.parse_model_repo(make_payload(xml)) + + expected = { + 12001: (21, 1, "ir selector", 0.0), + 12050: (31, 5, "POSITION", 0.3), + 32001: (21, 3, "BALANCE", 0.0), + 32050: (31, 3, "BALANCE", 0.0), + 8016: (29, 8, "PRE 1 FREQ", 40.0), + } + assert set(expected) == {family["child"] for family in facts["families"]} + for child_id, (size, index, name, default) in expected.items(): + child = cat[child_id] + assert len(child.parameters) == size + assert child.parameters[index].name == name + assert child.parameters[index].default == default + + +def test_clone_resolution_fallback_logs_model_and_reason(caplog): + xml = """ + + + + + + + """ + + with caplog.at_level("DEBUG", logger="pyquadcortex.protocol.catalog"): + catalog.parse_model_repo(make_payload(xml)) + + assert "model 2 clone resolution failed" in caplog.text + assert "non-contiguous parameter indexes" in caplog.text def test_a_labelled_end_control_carries_the_span_the_unit_draws(): """A pan reads 50 L .. C .. 50 R on screen whatever span it declares. @@ -1026,14 +1223,17 @@ def test_a_model_marked_internal_false_is_not_internal(): #: Attributes the parser may legitimately read by PRESENCE, each with the reason. #: -#: Empty, and that is the point - there is nowhere in this parser today where -#: "the attribute exists" is the question. The list exists because the failure -#: message offers this escape and a test that offers one without implementing it -#: sends a contributor in a circle. Same shape as `BOUNDARY_MODULES` in +#: `replaces` is read by presence: on a cloned parameter, a numeric value gives +#: the inherited wire index to replace, while an absent attribute means append +#: it after the inherited layout. The value `"0"` is meaningful, so truthiness +#: is not a substitute. Same shape as `BOUNDARY_MODULES` in #: `tests/test_translation.py` and `UNMARKED_OPERATIONS` in #: `tests/test_hardware_markers.py`: a name gets on it with a written reason, and #: a reviewer judges the reason. -PRESENCE_IS_RIGHT: dict[str, str] = {} +PRESENCE_IS_RIGHT: dict[str, str] = { + "replaces": "a present numeric value replaces that inherited wire index; " + "absence means append the child parameter", +} def _presence_reads(source: str) -> list[str]: diff --git a/tests/test_client.py b/tests/test_client.py index 5b35edaa..8eed1c37 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -4408,7 +4408,7 @@ def test_a_number_on_a_string_parameter_is_refused(): """ from tests.test_targets import _diverging_cab_catalog - for param in (1, "ir"): # by index and by name + for param in (1, "ir selector"): # by index and by name qc = client.QuadCortex(FakeTransport()) qc._catalog = _diverging_cab_catalog()() with pytest.raises(TypeError, match="is a string parameter"): @@ -4433,7 +4433,7 @@ def test_an_indexed_encoded_write_still_costs_no_catalog(): qc = client.QuadCortex(FakeTransport()) qc._catalog = _diverging_cab_catalog()() with pytest.raises(TypeError, match="is a string parameter"): - qc.set_param(Block(0, 5, 12001), "ir", Encoded(0.5)) + qc.set_param(Block(0, 5, 12001), "ir selector", Encoded(0.5)) def test_a_unit_check_reads_the_spec_the_conversion_uses_on_a_cab(monkeypatch): diff --git a/tests/test_option_audit.py b/tests/test_option_audit.py index e0f5680a..48c1821b 100644 --- a/tests/test_option_audit.py +++ b/tests/test_option_audit.py @@ -301,7 +301,7 @@ def test_the_document_quotes_the_same_counts(): text = " ".join(doc.read_text(encoding="utf-8").split()) counts = collections.Counter(options.OPTION_AUDIT.values()) phrase = (f"{counts['audited']} audited, {counts['drawn']} drawn, " - f"{counts['absent']} not drawn, {counts[None]} unread") + f"{counts['absent']} absent, {counts[None]} unread") assert phrase in text, ( f"docs/domain-model.md does not say {phrase!r}. The audit moved and the " f"document did not; they are updated in the same commit.") @@ -382,13 +382,24 @@ def test_the_document_quotes_the_same_parameter_counts(): per_status = collections.defaultdict(int) for labels, status in options.OPTION_AUDIT.items(): per_status[status] += options.OPTION_USAGE[labels] - assert sum(per_status.values()) == 527 + assert sum(per_status.values()) == 611 text = " ".join( (pathlib.Path(__file__).parents[1] / "docs" / "domain-model.md") .read_text(encoding="utf-8").split()) read = per_status["audited"] + per_status["drawn"] - for phrase in (f"cover {read} of the 527", f"unread cover {per_status[None]}"): + read_lists = sum(status in ("audited", "drawn") + for status in options.OPTION_AUDIT.values()) + absent = per_status["absent"] + absent_lists = sum(status == "absent" + for status in options.OPTION_AUDIT.values()) + unread = per_status[None] + unread_lists = sum(status is None + for status in options.OPTION_AUDIT.values()) + for phrase in ( + f"{read_lists} assessed lists cover {read} parameters", + f"{absent_lists} lists looked for and not drawn account for {absent}", + f"{unread_lists} unread lists account for {unread} of the 611"): assert phrase in text, ( f"docs/domain-model.md does not say {phrase!r}. The parameter " f"counts moved and the document did not.") @@ -408,7 +419,7 @@ def test_the_unread_work_is_long_tailed_and_the_document_says_so(): key=lambda labels: (-options.OPTION_USAGE[labels], len(labels), labels)) total = sum(options.OPTION_USAGE[labels] for labels in unread) top5 = sum(options.OPTION_USAGE[labels] for labels in unread[:5]) - assert (len(unread), total) == (94, 190) + assert (len(unread), total) == (94, 218) text = " ".join( (pathlib.Path(__file__).parents[1] / "docs" / "domain-model.md") diff --git a/tests/test_scales.py b/tests/test_scales.py index 233e058c..fda779c0 100644 --- a/tests/test_scales.py +++ b/tests/test_scales.py @@ -650,12 +650,11 @@ def test_the_unit_states_its_own_range_and_the_catalog_matches_it(): def test_parallax_carries_the_cab_law_itself(): - """It is a Bass Overdrive with a cab section, so it cannot borrow the layout. + """Parallax publishes both cab LEVEL laws in its own catalog entry. - `targets.wire_model` only borrows for models in CABSIM_CATEGORIES, and - Parallax is not one. It works only because its own catalog entry carries - MIN_CABSIM_DB and the same skew - which is also the evidence the - layout-borrowing design cites, so it is worth pinning where it is claimed. + It is a Bass Overdrive with two embedded cab sections rather than a cab + clone. Both controls therefore have to carry their own MIN_CABSIM_DB bound + and skew, independently of clone resolution. """ for index in (16, 24): spec = SCALES[(3008, index)] diff --git a/tests/test_targets.py b/tests/test_targets.py index b76aafc0..2846d37b 100644 --- a/tests/test_targets.py +++ b/tests/test_targets.py @@ -246,8 +246,8 @@ def _scale_catalog(): - - + + """ + "") @@ -354,48 +354,19 @@ def test_real_on_a_bare_block_names_the_missing_model_not_the_catalog(): Block(0, 1).normalize(0, 6.0, _Exploding()) -def test_a_cab_converts_through_the_shared_cabsim_layout(): - """A cab's own entry is a LOCAL list, so the layout is what numbers the wire. - - The taper it borrows is confirmed on three blocks in three different - categories, and the catalog agrees: every one of those LEVEL entries carries - the same skew and the same MIN_CABSIM_DB bound. - """ +def test_a_cloned_cab_converts_through_its_resolved_wire_layout(): + """Clone resolution retains inherited scale metadata at wire indexes.""" get = _scale_catalog() - # 21005 describes ONE parameter against the layout's several, so its own - # list cannot be numbering the wire and `spec_at` reads the layout's. - assert Block(0, 5, 21005).wire_model(get).id == 12000 assert Block(0, 5, 21005).spec_at(2, get).name == "MIC 1 LEVEL" assert Block(0, 5, 21005).normalize(2, -3.0, get) == pytest.approx(0.3400, abs=5e-4) -def test_a_non_cab_does_not_borrow_the_cabsim_layout(): - """The alias is not a back door into every model near a cab.""" - get = _scale_catalog() - assert Block(0, 1, 5005).wire_model(get).id == 5005 - - # -- the check and the conversion must read the SAME spec --------------------- def _diverging_cab_catalog(): - """The three shapes a cab comes in, at the proportions the device ships. - - Not hypothetical, and not "the catalog under-describes them". A cab's own - entry is a LOCAL list, numbered from zero over the parameters that model - contributes, and those numbers do not address the wire: - - * 157 of the 174 list two mic selectors and nothing else; - * 11 more add their mics' POSITION and DISTANCE, so their own index 2 names - a knob the wire carries at 5; - * 6 describe the whole layout starting at ``0:bypass``, and those DO number - the wire - three of them carry parameters past the layout's end, where - borrowing would be a fresh version of the same bug. - - The layout here is deliberately longer than the short models, because that - length difference is what `wire_model` reads. - """ + """A distilled catalog with declared short and full cab clone shapes.""" from tests.test_catalog import SAMPLE_XML, make_payload xml = SAMPLE_XML.replace("", """ @@ -406,15 +377,19 @@ def _diverging_cab_catalog(): + + + + - - - + + + - - - - + + + + @@ -431,16 +406,13 @@ def _diverging_cab_catalog(): return lambda: cat -def test_a_short_cabs_own_list_cannot_be_numbering_the_wire(): - """157 describe two parameters against a layout of many, so `spec_at` reads - the layout - the short list is local, and index 2 is not in it at all.""" +def test_a_short_cab_resolves_its_declared_parent_layout(): get = _diverging_cab_catalog() bare = Block(0, 5, 12001) - assert bare.wire_model(get).id == 12000 assert bare.spec_at(2, get).name == "LEVEL" -def test_a_cab_that_describes_the_whole_layout_numbers_the_wire_itself(): +def test_a_cab_with_full_layout_keeps_parameters_beyond_the_shared_layout(): """The 6 full-form cabs are left alone, and it is not tidiness. Three of them carry parameters PAST the layout's end - the layout says @@ -449,24 +421,15 @@ def test_a_cab_that_describes_the_whole_layout_numbers_the_wire_itself(): """ get = _diverging_cab_catalog() full = Block(0, 5, 12100) - assert full.wire_model(get).id == 12100 assert full.spec_at(6, get).name == "ROOM MIX" # past the layout's end assert full.spec_at(2, get).name == "LEVEL" # and agreeing before it -def test_the_layout_wins_over_the_cabs_own_disagreeing_entry(): - """12 cabs call index 2 POSITION while the wire carries LEVEL in dB. - - Confirmed on hardware 2026-08-27, because guessing this backwards would - have been worse than the bug it fixes. A `Plini Cab (M)` took a wire value - the two specs read differently and the screen showed `LEVEL -3.0 dB` - the - layout's answer - with its own `POSITION` untouched at 0.50. The reading is - in `tests/test_scales.py`. - """ +def test_a_replacement_keeps_its_declared_wire_index(): get = _diverging_cab_catalog() named = Block(0, 5, 12053) - assert named.model(get).parameters[2].name == "POSITION" # its own list - assert named.spec_at(2, get).name == "LEVEL" # the wire's + assert named.spec_at(2, get).name == "LEVEL" + assert named.spec_at(5, get).name == "POSITION" def test_a_name_on_a_cab_resolves_to_the_wire_index_not_the_models_own(): @@ -483,7 +446,6 @@ def test_a_name_on_a_cab_resolves_to_the_wire_index_not_the_models_own(): """ get = _diverging_cab_catalog() named = Block(0, 5, 12053) - assert named.model(get).parameters[2].name == "POSITION" # its own list index, spec = named.index_of("POSITION", get) assert index == 5 and spec.name == "POSITION"