From 696f2f07bd99e1fd72ede3ea3a2926c7e0db9979 Mon Sep 17 00:00:00 2001 From: Antoni Ivanov <262547018+tony-xmelon@users.noreply.github.com> Date: Thu, 3 Sep 2026 23:56:40 +0300 Subject: [PATCH 1/7] Expose catalog editor metadata --- pyquadcortex/protocol/catalog.py | 29 ++++++++++++++++++++++++++--- tests/test_catalog.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/pyquadcortex/protocol/catalog.py b/pyquadcortex/protocol/catalog.py index 30777f81..299bd35c 100644 --- a/pyquadcortex/protocol/catalog.py +++ b/pyquadcortex/protocol/catalog.py @@ -187,6 +187,23 @@ class Parameter: exp_assignable: bool = True #: Whether the screen shows this without a decimal point. show_as_integer: bool = False + #: What the screen shows at the midpoint instead of a number, from + #: ``mid_string``. Most commonly ``"C"`` for a pan control. + mid_label: str = "" + #: This control's position in the model's on-device editor, from + #: ``displayPos``. ``None`` when the catalog does not assign one; internal + #: parameters such as bypass and IR paths commonly omit it. + display_position: int | None = None + #: Parameter indexes named by the catalog's ``toggleOn`` attribute. These + #: describe controls whose on-state makes this parameter applicable. + toggle_on: tuple[int, ...] = () + #: Parameter indexes named by ``toggleOff``. Their off-state makes this + #: parameter applicable. + toggle_off: tuple[int, ...] = () + #: Option indexes named by ``toggleStep`` for conditional controls. + toggle_steps: tuple[int, ...] = () + #: The related parameter index named by ``linkedSceneMode``. + linked_scene_mode: int | None = None @property def floor(self) -> "values.Real | None": @@ -629,6 +646,12 @@ def _parameter(index: int, p, model_name: str) -> Parameter: dynamic=p.get("dynamic") == "true", min_label=p.get("min_string", ""), max_label=p.get("max_string", ""), + mid_label=p.get("mid_string", ""), + display_position=_as_int(p.get("displayPos")), + toggle_on=_parse_indexes(p.get("toggleOn")), + toggle_off=_parse_indexes(p.get("toggleOff")), + toggle_steps=_parse_indexes(p.get("toggleStep")), + linked_scene_mode=_as_int(p.get("linkedSceneMode")), exp_assignable=p.get("expAssignable") != "false", show_as_integer=p.get("showAsInteger") == "true", ) @@ -662,7 +685,7 @@ def parse_model_repo(payload: bytes) -> ModelCatalog: hidden=element.get("hidden") is not None, internal=element.get("internal") is not None, category_hidden=category_hidden, - replaces=_parse_replaces(element.get("replaces")), + replaces=_parse_indexes(element.get("replaces")), ) # Second pass: a model is superseded once some other model claims to replace @@ -673,8 +696,8 @@ def parse_model_repo(payload: bytes) -> ModelCatalog: return catalog -def _parse_replaces(value: str | None) -> tuple[int, ...]: - """Parse a ``replaces`` attribute: one id, or several comma-separated.""" +def _parse_indexes(value: str | None) -> tuple[int, ...]: + """Parse one integer, or a comma-separated list of integers.""" if not value: return () ids = [] diff --git a/tests/test_catalog.py b/tests/test_catalog.py index ad35b557..13a93759 100644 --- a/tests/test_catalog.py +++ b/tests/test_catalog.py @@ -125,6 +125,37 @@ def test_parameters_are_ordered_and_carry_metadata(cat): assert cat[5005].parameters[0].units == "dB" +def test_parameter_carries_editor_and_conditional_metadata(): + xml = """ + + + + + """ + + parameter = catalog.parse_model_repo(make_payload(xml))[1].parameters[1] + + assert parameter.mid_label == "C" + assert parameter.display_position == 7 + assert parameter.toggle_on == (0, 4) + assert parameter.toggle_off == (2,) + assert parameter.toggle_steps == (1, 2) + assert parameter.linked_scene_mode == 9 + + +def test_absent_editor_metadata_has_neutral_defaults(cat): + parameter = cat[1].parameters[0] + + assert parameter.mid_label == "" + assert parameter.display_position is None + assert parameter.toggle_on == () + assert parameter.toggle_off == () + assert parameter.toggle_steps == () + assert parameter.linked_scene_mode is None + + def test_lookup_parameter_by_name_is_case_insensitive(cat): assert cat[1].parameter("gain").index == 0 assert cat[1].parameter("TREBLE").index == 1 From 45195dc08952283ee90bbd669b6fa35117fe088f Mon Sep 17 00:00:00 2001 From: Antoni Ivanov <262547018+tony-xmelon@users.noreply.github.com> Date: Tue, 8 Sep 2026 21:38:12 +0300 Subject: [PATCH 2/7] fix: ground editor metadata in catalog evidence --- changelog.md | 7 ++++ docs/ADR.md | 2 +- docs/domain-model.md | 22 ++++++++--- docs/protocol.md | 7 +++- pyquadcortex/protocol/catalog.py | 33 ++++++++++------ tests/fixtures/catalog/editor_metadata.json | 25 ++++++++++++ tests/test_catalog.py | 44 +++++++++++++++++++-- 7 files changed, 116 insertions(+), 24 deletions(-) create mode 100644 tests/fixtures/catalog/editor_metadata.json diff --git a/changelog.md b/changelog.md index d8b2b27f..7486d698 100644 --- a/changelog.md +++ b/changelog.md @@ -20,6 +20,13 @@ correction. ## Unreleased +### ModelRepo editor metadata is available + +Parameters expose midpoint labels, editor position hints, and the three +conditional-visibility references published by the catalog. These are raw +metadata: positions may collide or have gaps, and three self-references remain +unexplained. CorOS 4.1-only `linkedSceneMode` is documented but not exposed. + ### The first hardware run of the profile seam, and what it corrected Run 2026-09-07 on Quad Cortex, CorOS 4.0.1 / d14e, straight after the seam diff --git a/docs/ADR.md b/docs/ADR.md index 3a7feae5..4b5ee518 100644 --- a/docs/ADR.md +++ b/docs/ADR.md @@ -248,7 +248,7 @@ Records are append-only once `Decided` and built upon: a shipped decision is nev - **(a) The catalog wins; measurements become tests - chosen.** The table shrinks from 44 entries over 19 models to 14 numbers covering all 533, including models nobody has ever placed on a grid. - **(b) Keep `MEASURED_SPANS` as an override.** Safer against a lying catalog, but carries two tables that must agree, and the hand-measured one covers a twentieth of the models. - **(c) Trust the catalog without checking it.** Rejected. The formula was verified on hardware in both directions before anything was built on it, and `LOG_SKEW` turned out not to mean what its name says. -- **Open Questions:** Whether `toggleOn` / `toggleOff` / `toggleStep`, on 212 parameters, describe a footswitch toggle's two values. They are recorded in `docs/domain-model.md`'s appendix rather than guessed at. Also whether `expAssignable` governs the unit's own assignment UI - it demonstrably does not govern a host write, and what it DOES govern has not been established. +- **Open Questions:** Catalog shape now indicates `toggleOn` / `toggleOff` name a conditional-visibility driver and `toggleStep` its option (Splitter partitions cleanly by TYPE), but three Mono Synth parameters point to themselves and remain unexplained. Also whether `expAssignable` governs the unit's own assignment UI - it demonstrably does not govern a host write, and what it DOES govern has not been established. - **Rationale:** A measurement is evidence about a device; a catalog is that device's own description of itself. When both exist, the description is the better source and the evidence is the better test, and this project had them the wrong way round. Inverting it also fixes the coverage problem for free: a hand-measured table only ever covers what somebody happened to drive. The formula was confirmed before it was trusted, over three unrelated blocks in two different units - a cab LEVEL at skew 4.9594844, a Low-High Cut's HPF FREQ at 0.3, and the same block's OUTPUT with no skew - because applying an untested exponent to 615 parameters is exactly the guess this project's rules exist to prevent. `LOG_SKEW` justified that caution: it is a power law at skew 0.3, not the logarithmic sweep its name promises, and two readings on an Envelope Filter proved it independently. - **Consequences:** diff --git a/docs/domain-model.md b/docs/domain-model.md index 1655684b..f27ec51a 100644 --- a/docs/domain-model.md +++ b/docs/domain-model.md @@ -1397,24 +1397,34 @@ the n/a rows below where they intersect the API at all. ## Catalog attributes we can see and cannot yet explain -The device puts **24** distinct attributes on its `` elements. Fourteen -are parsed. These are the other ten, recorded so the next person does not have to +The CorOS 4.0.1 catalog puts **24** distinct attributes on its 3,809 +`` elements. Nineteen are parsed. These are the other five, recorded +so the next person does not have to rediscover that they exist. None is guessed at, per the rule that a control we do not understand is omitted with the reason written down. -The counts are from the shipped catalog, 3,809 parameters. +The counts in this table are from CorOS 4.0.1. | attribute | on | what it looks like, and what is unknown | |---|---|---| -| `displayPos` | 1446 | The order the unit lays knobs out on screen, which is not wire order. Nothing here needs it; a UI would. | | `hidden` | 650 | Present on a parameter, distinct from the `hidden` we already read on a ``. Whether it means "not shown on screen" or "not writable" is untested, and the two have very different consequences for a host. | | `replaces` | 462 | Also distinct from the `` attribute of the same name, which we do parse. 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 (`4`, `5`, `6`) on `float` parameters such as a tremolo's `LEVEL`, and `toggleStep` sometimes carries a PAIR (`"0,1"`, `"1,2"`). The obvious reading is the two values a footswitch toggle alternates between - obvious, and untested. Driving one and watching the screen would settle it. | | `tooltip` | 126 | The help text the unit shows. Real prose, occasionally load-bearing: a Vibrato's `MODE` warns that changing it causes a brief mute. Note the values contain HTML (`
`), which is where an `align` "attribute" appears - it is markup inside the tooltip, not an attribute of the parameter. | | `selfTestValue` | 66 | A value the unit uses during its self test. Sometimes an IR name (`"NG_412 Plini Cab_Dynamic 57"`), sometimes a token (`"eltron_self_test"`). | -| `mid_string` | 36 | The sibling of `min_string` and `max_string`, which we do read. Presumably a label at some middle position, but WHICH position is not stated anywhere, so it cannot be used. | | `isplayPos` | 1 | `displayPos` with the `d` missing. The device's own typo. Recorded rather than silently accepted as an alias, because a parser that took both would hide that the catalog has a defect. | +The five newly parsed editor fields retain evidence rather than promising a UI: +on CorOS 4.0.1, `mid_string` appears 36 times (35 `C`, one `A/B`), every +carrier also has bottom/top labels and linear skew; `displayPos` appears 1,446 +times but five models collide and 18 have gaps; and `toggleOn` / `toggleOff` / +`toggleStep` appear 132 / 83 / 13 times. Catalog shape, especially Splitter's +TYPE-dependent controls, implies the toggle fields describe conditional +visibility. Three Mono Synth self-references remain unexplained. + +`linkedSceneMode` appears 44 times in the contributed CorOS 4.1.0 catalog and +zero times in 4.0.1. Its meaning and relationship, if any, to preset +`scene_mode` are unknown, so it is recorded here and not exposed as shared API. + On ``, `blob` is also unexplained: a same-length string of letters that **changes between fetches**. Two dumps of one unit taken minutes apart differed on 338 models and on nothing else. A per-fetch token of some kind, not content. diff --git a/docs/protocol.md b/docs/protocol.md index cc166d7d..02fe21ed 100644 --- a/docs/protocol.md +++ b/docs/protocol.md @@ -3391,8 +3391,11 @@ Stated explicitly so nobody builds on a guess: is the obvious candidate and has not been checked. Separately, whether the unit ACTS on an assignment stored against such a parameter needs audio, not a wire read. -- **What `toggleOn` / `toggleOff` / `toggleStep` mean**, on 212 parameters. The - obvious reading is a footswitch toggle's two values; obvious and untested. +- **Three self-referencing conditional metadata entries** remain unexplained: + Mono Synth indexes 15 and 24 point `toggleOn` to themselves, and index 48 + points `toggleOff` to itself. Elsewhere, CorOS 4.0.1 catalog shape indicates + `toggleOn` / `toggleOff` name a conditional-visibility driver and + `toggleStep` its option: Splitter's controls partition cleanly by TYPE. - **Whether a capture id denotes different content on a different unit** is untested here, needing a second unit. - ~~**Whether a preset's descriptive `tags` can be set at all**~~ - ANSWERED: no. The diff --git a/pyquadcortex/protocol/catalog.py b/pyquadcortex/protocol/catalog.py index 299bd35c..30184707 100644 --- a/pyquadcortex/protocol/catalog.py +++ b/pyquadcortex/protocol/catalog.py @@ -188,22 +188,28 @@ class Parameter: #: Whether the screen shows this without a decimal point. show_as_integer: bool = False #: What the screen shows at the midpoint instead of a number, from - #: ``mid_string``. Most commonly ``"C"`` for a pan control. + #: ``mid_string``. On CorOS 4.0.1, 35 of 36 are ``"C"`` and the other is + #: ``"A/B"`` on ``A/B PITCH MIX``. Every carrier also has bottom/top + #: labels and linear skew, which supports (but does not encode) wire 0.5 as + #: the midpoint; a future skewed carrier would need separate interpretation. mid_label: str = "" #: This control's position in the model's on-device editor, from - #: ``displayPos``. ``None`` when the catalog does not assign one; internal - #: parameters such as bypass and IR paths commonly omit it. + #: ``displayPos``. This is a layout hint, not enough to recreate an editor: + #: five CorOS 4.0.1 models collide at a position and 18 have gaps. ``None`` + #: normally means omitted; Analog Delay (ST) FEEDBACK DEPTH instead carries + #: the device typo ``isplayPos="18"``, which is deliberately not aliased. display_position: int | None = None - #: Parameter indexes named by the catalog's ``toggleOn`` attribute. These - #: describe controls whose on-state makes this parameter applicable. + #: Parameter indexes named by ``toggleOn``. Catalog shape implies these are + #: visibility drivers: Splitter controls point to TYPE and its applicable + #: option. Three Mono Synth parameters point to themselves, whose meaning + #: remains unknown. toggle_on: tuple[int, ...] = () - #: Parameter indexes named by ``toggleOff``. Their off-state makes this - #: parameter applicable. + #: Parameter indexes named by ``toggleOff``; inferred as visibility drivers + #: from the same catalog evidence, with the same self-reference exception. toggle_off: tuple[int, ...] = () - #: Option indexes named by ``toggleStep`` for conditional controls. + #: Option indexes named by ``toggleStep`` for the inferred visibility + #: driver. Every CorOS 4.0.1 carrier also has ``toggleOn`` or ``toggleOff``. toggle_steps: tuple[int, ...] = () - #: The related parameter index named by ``linkedSceneMode``. - linked_scene_mode: int | None = None @property def floor(self) -> "values.Real | None": @@ -651,7 +657,6 @@ def _parameter(index: int, p, model_name: str) -> Parameter: toggle_on=_parse_indexes(p.get("toggleOn")), toggle_off=_parse_indexes(p.get("toggleOff")), toggle_steps=_parse_indexes(p.get("toggleStep")), - linked_scene_mode=_as_int(p.get("linkedSceneMode")), exp_assignable=p.get("expAssignable") != "false", show_as_integer=p.get("showAsInteger") == "true", ) @@ -697,7 +702,11 @@ def parse_model_repo(payload: bytes) -> ModelCatalog: def _parse_indexes(value: str | None) -> tuple[int, ...]: - """Parse one integer, or a comma-separated list of integers.""" + """Parse one integer, or a comma-separated list of integers. + + Invalid parts are deliberately ignored: device catalogs are extensible, + and one unfamiliar token must not discard otherwise usable metadata. + """ if not value: return () ids = [] diff --git a/tests/fixtures/catalog/editor_metadata.json b/tests/fixtures/catalog/editor_metadata.json new file mode 100644 index 00000000..dec4be4b --- /dev/null +++ b/tests/fixtures/catalog/editor_metadata.json @@ -0,0 +1,25 @@ +{ + "source": "Maintainer audit of the Quad Cortex CorOS 4.0.1 ModelRepo, reported in PR #46 on 2026-09-08.", + "firmware": "CorOS 4.0.1", + "parameters": 3809, + "mid_string": {"total": 36, "C": 35, "A/B": 1, "all_have_min_and_max_labels": true, "all_have_skew": 1.0}, + "displayPos": { + "carriers": 1446, + "collision_models": 5, + "gap_models": 18, + "examples": [ + {"model": "Soldano SLO-100", "position": 11, "parameters": ["DEPTH", "MUTE TRIG"]}, + {"model": "Minivoicer", "positions": [3, 8, 18]} + ], + "device_typo": {"model": "Analog Delay (ST)", "parameter_index": 20, "parameter": "FEEDBACK DEPTH", "attribute": "isplayPos", "value": 18} + }, + "toggle": { + "counts": {"on": 132, "off": 83, "step": 13}, + "all_step_carriers_have_on_or_off": true, + "self_references": [ + {"model": "Mono Synth", "index": 15, "parameter": "OSC2 WAVE", "attribute": "toggleOn"}, + {"model": "Mono Synth", "index": 24, "parameter": "SLOPE", "attribute": "toggleOn"}, + {"model": "Mono Synth", "index": 48, "parameter": "FREE RATE", "attribute": "toggleOff"} + ] + } +} diff --git a/tests/test_catalog.py b/tests/test_catalog.py index 13a93759..96ccfa80 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 @@ -131,7 +133,7 @@ def test_parameter_carries_editor_and_conditional_metadata(): + toggleOff="2" toggleStep="1,2"/> """ @@ -142,7 +144,6 @@ def test_parameter_carries_editor_and_conditional_metadata(): assert parameter.toggle_on == (0, 4) assert parameter.toggle_off == (2,) assert parameter.toggle_steps == (1, 2) - assert parameter.linked_scene_mode == 9 def test_absent_editor_metadata_has_neutral_defaults(cat): @@ -153,7 +154,44 @@ def test_absent_editor_metadata_has_neutral_defaults(cat): assert parameter.toggle_on == () assert parameter.toggle_off == () assert parameter.toggle_steps == () - assert parameter.linked_scene_mode is None + + +def test_real_catalog_editor_metadata_evidence_is_pinned(): + path = pathlib.Path(__file__).parent / "fixtures" / "catalog" / \ + "editor_metadata.json" + facts = json.loads(path.read_text(encoding="utf-8")) + + assert facts["firmware"] == "CorOS 4.0.1" + assert facts["mid_string"] == { + "total": 36, "C": 35, "A/B": 1, + "all_have_min_and_max_labels": True, "all_have_skew": 1.0, + } + assert facts["displayPos"]["carriers"] == 1446 + assert facts["displayPos"]["collision_models"] == 5 + assert facts["displayPos"]["gap_models"] == 18 + assert facts["displayPos"]["device_typo"] == { + "model": "Analog Delay (ST)", "parameter_index": 20, + "parameter": "FEEDBACK DEPTH", "attribute": "isplayPos", "value": 18, + } + assert facts["toggle"]["counts"] == {"on": 132, "off": 83, "step": 13} + assert facts["toggle"]["all_step_carriers_have_on_or_off"] is True + assert facts["toggle"]["self_references"] == [ + {"model": "Mono Synth", "index": 15, "parameter": "OSC2 WAVE", "attribute": "toggleOn"}, + {"model": "Mono Synth", "index": 24, "parameter": "SLOPE", "attribute": "toggleOn"}, + {"model": "Mono Synth", "index": 48, "parameter": "FREE RATE", "attribute": "toggleOff"}, + ] + + +def test_self_referencing_toggle_metadata_is_preserved_not_interpreted(): + xml = """ + + + + """ + + parameter = catalog.parse_model_repo(make_payload(xml))[1].parameters[0] + + assert parameter.toggle_on == (0,) def test_lookup_parameter_by_name_is_case_insensitive(cat): From d97fa63a1ed7512cf013e9d315802e742968807f Mon Sep 17 00:00:00 2001 From: Antoni Ivanov <262547018+tony-xmelon@users.noreply.github.com> Date: Wed, 23 Sep 2026 00:14:30 +0300 Subject: [PATCH 3/7] Pin editor metadata to real 4.0.1 catalog rows --- changelog.md | 9 +- pyquadcortex/protocol/catalog.py | 9 +- scripts/extract_editor_metadata_fixture.py | 162 +++ tests/fixtures/catalog/editor_metadata.json | 1019 ++++++++++++++++++- tests/test_catalog.py | 43 +- 5 files changed, 1211 insertions(+), 31 deletions(-) create mode 100644 scripts/extract_editor_metadata_fixture.py diff --git a/changelog.md b/changelog.md index 05a1d2cf..f07cf4bc 100644 --- a/changelog.md +++ b/changelog.md @@ -17,10 +17,11 @@ sustained stretch without a correction. ### Conditional editor metadata is exposed -Catalog parameters now preserve `toggleOn`, `toggleOff`, and `toggleStep` as -integer tuples. They are published as device metadata without guessing how a -host editor should interpret them; self-references and unknown tokens remain -safe and local to the affected parameter. +Catalog parameters now expose `toggle_on`, `toggle_off`, and `toggle_steps` as +integer tuples: the catalog's own conditional-editor references, published +without a claim about how a host editor should act on them. Read from the CorOS +4.0.1 catalog, where 132, 83 and 13 parameters carry them. + ### Rename the unit, drive undo/redo, and read inhibited modules `set_device_name()` sends a sparse Version update. `undo()` and `redo()` drive diff --git a/pyquadcortex/protocol/catalog.py b/pyquadcortex/protocol/catalog.py index 24c3a093..4ab8a357 100644 --- a/pyquadcortex/protocol/catalog.py +++ b/pyquadcortex/protocol/catalog.py @@ -232,9 +232,14 @@ class Parameter: #: Addressing a parameter keeps using the index. This says where a control #: is drawn, not what selects it. display_pos: int | None = None - #: Parameter indexes named by the catalog's conditional-editor metadata. - #: They are exposed as evidence, not interpreted as host-side behaviour. + #: Parameter indexes named by the catalog's conditional-editor metadata, + #: on 132 and 83 parameters. Inferred from the catalog's shape, not measured + #: on a unit: the Splitter is the clearest case, where the three options of + #: its ``TYPE`` switch partition the block - ``BALANCE`` on step 0, the two + #: ``LEVEL TO`` knobs on step 1, ``FREQUENCY`` and ``MODE`` on step 2. + #: Three Mono Synth parameters name their own index and are unexplained. toggle_on: tuple[int, ...] = () + #: The counterpart of :attr:`toggle_on`. toggle_off: tuple[int, ...] = () #: Option indexes named by ``toggleStep``. toggle_steps: tuple[int, ...] = () diff --git a/scripts/extract_editor_metadata_fixture.py b/scripts/extract_editor_metadata_fixture.py new file mode 100644 index 00000000..cd75017e --- /dev/null +++ b/scripts/extract_editor_metadata_fixture.py @@ -0,0 +1,162 @@ +#!/usr/bin/env python3 +"""Distil editor-layout evidence from a device ModelRepo. + + python scripts/extract_editor_metadata_fixture.py --payload model_repo.bin + +The full vendor catalog is not redistributed. The fixture contains only the +raw attributes needed to reproduce the midpoint, display-position, and +conditional-editor facts asserted by the offline suite. +""" + +import argparse +import collections +import json +import pathlib +import sys +import xml.etree.ElementTree as ET + +sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent.parent)) + +from pyquadcortex.protocol import catalog # noqa: E402 + + +EDITOR_ATTRIBUTES = { + "name", "min_string", "mid_string", "max_string", "skew", "displayPos", + "isplayPos", "toggleOn", "toggleOff", "toggleStep", +} + + +def _row(model, index, parameter): + return { + "model_id": int(model.get("id")), + "model": model.get("name"), + "index": index, + "raw": { + key: value for key, value in parameter.attrib.items() + if key in EDITOR_ATTRIBUTES + }, + } + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--payload", required=True) + parser.add_argument( + "--out", default="tests/fixtures/catalog/editor_metadata.json") + args = parser.parse_args() + + payload = pathlib.Path(args.payload).read_bytes() + root = ET.fromstring(catalog._extract_xml(payload)) + models = list(root.iter("Model")) + all_parameters = [ + (model, index, parameter) + for model in models + for index, parameter in enumerate(model.findall("Parameter")) + ] + + midpoint_rows = [ + _row(model, index, parameter) + for model, index, parameter in all_parameters + if parameter.get("mid_string") is not None + ] + + collision_rows = [] + gap_models = [] + display_carriers = 0 + for model in models: + positions = collections.defaultdict(list) + for index, parameter in enumerate(model.findall("Parameter")): + raw = parameter.get("displayPos") + if raw is None: + continue + display_carriers += 1 + try: + positions[int(raw)].append(_row(model, index, parameter)) + except ValueError: + continue + duplicates = { + str(position): rows for position, rows in positions.items() + if len(rows) > 1 + } + if duplicates: + collision_rows.append({ + "model_id": int(model.get("id")), + "model": model.get("name"), + "positions": duplicates, + }) + # Positions that begin at 11 are partial plugin layouts, not gaps in a + # complete editor. The remaining layouts start at 0 or 1; missing + # values through their maximum are the 18 gap models in this catalog. + if positions and min(positions) <= 1: + missing = sorted(set(range(max(positions) + 1)) - set(positions)) + if missing: + gap_models.append({ + "model_id": int(model.get("id")), + "model": model.get("name"), + "missing": missing, + }) + + toggle_rows = { + attribute: [ + _row(model, index, parameter) + for model, index, parameter in all_parameters + if parameter.get(attribute) is not None + ] + for attribute in ("toggleOn", "toggleOff", "toggleStep") + } + self_references = [] + for attribute in ("toggleOn", "toggleOff"): + for row in toggle_rows[attribute]: + indexes = { + int(part.strip()) for part in row["raw"][attribute].split(",") + if part.strip().lstrip("-").isdigit() + } + if row["index"] in indexes: + self_references.append({ + **row, "attribute": attribute, + }) + + typo = next( + _row(model, index, parameter) + for model, index, parameter in all_parameters + if parameter.get("isplayPos") is not None + ) + + fixture = { + "source": "Quad Cortex CorOS 4.0.1 ModelRepo payload", + "firmware": "CorOS 4.0.1", + "parameters": len(all_parameters), + "mid_string": { + "rows": midpoint_rows, + }, + "displayPos": { + "carriers": display_carriers, + "collision_models": collision_rows, + "gap_models": gap_models, + "device_typo": typo, + }, + "toggle": { + "counts": { + attribute: len(rows) + for attribute, rows in toggle_rows.items() + }, + "step_rows": toggle_rows["toggleStep"], + "all_step_carriers_have_on_or_off": all( + "toggleOn" in row["raw"] or "toggleOff" in row["raw"] + for row in toggle_rows["toggleStep"] + ), + "self_references": self_references, + }, + } + + out = pathlib.Path(args.out) + out.parent.mkdir(parents=True, exist_ok=True) + out.write_text(json.dumps(fixture, indent=2) + "\n", encoding="utf-8") + print( + f"wrote {len(midpoint_rows)} midpoint rows, " + f"{len(collision_rows)} collision models, and " + f"{len(self_references)} self-references to {out}") + + +if __name__ == "__main__": + main() diff --git a/tests/fixtures/catalog/editor_metadata.json b/tests/fixtures/catalog/editor_metadata.json index dec4be4b..b1452201 100644 --- a/tests/fixtures/catalog/editor_metadata.json +++ b/tests/fixtures/catalog/editor_metadata.json @@ -1,25 +1,1020 @@ { - "source": "Maintainer audit of the Quad Cortex CorOS 4.0.1 ModelRepo, reported in PR #46 on 2026-09-08.", + "source": "Quad Cortex CorOS 4.0.1 ModelRepo payload", "firmware": "CorOS 4.0.1", "parameters": 3809, - "mid_string": {"total": 36, "C": 35, "A/B": 1, "all_have_min_and_max_labels": true, "all_have_skew": 1.0}, + "mid_string": { + "rows": [ + { + "model_id": 3008, + "model": "Parallax", + "index": 17, + "raw": { + "displayPos": "11", + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN" + } + }, + { + "model_id": 3008, + "model": "Parallax", + "index": 25, + "raw": { + "displayPos": "15", + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN" + } + }, + { + "model_id": 7039, + "model": "Micro Processor (ST)", + "index": 14, + "raw": { + "displayPos": "5", + "max_string": "B", + "mid_string": "A/B", + "min_string": "A", + "name": "A/B PITCH MIX" + } + }, + { + "model_id": 11000, + "model": "Mixer", + "index": 1, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN A" + } + }, + { + "model_id": 11000, + "model": "Mixer", + "index": 3, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN B" + } + }, + { + "model_id": 12000, + "model": "Default Cabsim", + "index": 3, + "raw": { + "displayPos": "3", + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN" + } + }, + { + "model_id": 12000, + "model": "Default Cabsim", + "index": 11, + "raw": { + "displayPos": "7", + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN" + } + }, + { + "model_id": 12114, + "model": "PCOM Core Cabsim", + "index": 3, + "raw": { + "displayPos": "3", + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN" + } + }, + { + "model_id": 12114, + "model": "PCOM Core Cabsim", + "index": 11, + "raw": { + "displayPos": "7", + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN" + } + }, + { + "model_id": 12100, + "model": "PCOM Default Cabsim", + "index": 3, + "raw": { + "displayPos": "3", + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN" + } + }, + { + "model_id": 12100, + "model": "PCOM Default Cabsim", + "index": 11, + "raw": { + "displayPos": "7", + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN" + } + }, + { + "model_id": 32000, + "model": "Default Cabsim (ST)", + "index": 3, + "raw": { + "displayPos": "3", + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "BALANCE", + "skew": "1" + } + }, + { + "model_id": 32000, + "model": "Default Cabsim (ST)", + "index": 11, + "raw": { + "displayPos": "7", + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "BALANCE", + "skew": "1" + } + }, + { + "model_id": 32100, + "model": "PCOM Default Cabsim (ST)", + "index": 3, + "raw": { + "displayPos": "3", + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "BALANCE", + "skew": "1" + } + }, + { + "model_id": 32100, + "model": "PCOM Default Cabsim (ST)", + "index": 11, + "raw": { + "displayPos": "7", + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "BALANCE", + "skew": "1" + } + }, + { + "model_id": 16005, + "model": "Gain", + "index": 1, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN" + } + }, + { + "model_id": 18007, + "model": "Minivoicer", + "index": 8, + "raw": { + "displayPos": "4", + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "V1 PAN" + } + }, + { + "model_id": 18007, + "model": "Minivoicer", + "index": 12, + "raw": { + "displayPos": "9", + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "V2 PAN" + } + }, + { + "model_id": 23000, + "model": "LaneOutputControl", + "index": 1, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN" + } + }, + { + "model_id": 25000, + "model": "TempoControl", + "index": 5, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN", + "skew": "1" + } + }, + { + "model_id": 29001, + "model": "Single (M)", + "index": 6, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN", + "skew": "1" + } + }, + { + "model_id": 29001, + "model": "Single (M)", + "index": 14, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN", + "skew": "1" + } + }, + { + "model_id": 29002, + "model": "Single (ST)", + "index": 6, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN", + "skew": "1" + } + }, + { + "model_id": 29002, + "model": "Single (ST)", + "index": 14, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN", + "skew": "1" + } + }, + { + "model_id": 29003, + "model": "Dual (M)", + "index": 6, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN", + "skew": "1" + } + }, + { + "model_id": 29003, + "model": "Dual (M)", + "index": 14, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN", + "skew": "1" + } + }, + { + "model_id": 29004, + "model": "Dual (ST)", + "index": 6, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "BALANCE", + "skew": "1" + } + }, + { + "model_id": 29004, + "model": "Dual (ST)", + "index": 14, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "BALANCE", + "skew": "1" + } + }, + { + "model_id": 29005, + "model": "Single (M) Lite", + "index": 6, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN", + "skew": "1" + } + }, + { + "model_id": 29005, + "model": "Single (M) Lite", + "index": 14, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN", + "skew": "1" + } + }, + { + "model_id": 29006, + "model": "Single (ST) Lite", + "index": 6, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN", + "skew": "1" + } + }, + { + "model_id": 29006, + "model": "Single (ST) Lite", + "index": 14, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN", + "skew": "1" + } + }, + { + "model_id": 29007, + "model": "Dual (M) Lite", + "index": 6, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN", + "skew": "1" + } + }, + { + "model_id": 29007, + "model": "Dual (M) Lite", + "index": 14, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "PAN", + "skew": "1" + } + }, + { + "model_id": 29008, + "model": "Dual (ST) Lite", + "index": 6, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "BALANCE", + "skew": "1" + } + }, + { + "model_id": 29008, + "model": "Dual (ST) Lite", + "index": 14, + "raw": { + "max_string": "R", + "mid_string": "C", + "min_string": "L", + "name": "BALANCE", + "skew": "1" + } + } + ] + }, "displayPos": { "carriers": 1446, - "collision_models": 5, - "gap_models": 18, - "examples": [ - {"model": "Soldano SLO-100", "position": 11, "parameters": ["DEPTH", "MUTE TRIG"]}, - {"model": "Minivoicer", "positions": [3, 8, 18]} + "collision_models": [ + { + "model_id": 1170, + "model": "Soldano SLO-100\u00ae", + "positions": { + "11": [ + { + "model_id": 1170, + "model": "Soldano SLO-100\u00ae", + "index": 6, + "raw": { + "displayPos": "11", + "name": "DEPTH" + } + }, + { + "model_id": 1170, + "model": "Soldano SLO-100\u00ae", + "index": 10, + "raw": { + "displayPos": "11", + "name": "MUTE TRIG" + } + } + ] + } + }, + { + "model_id": 6004, + "model": "Tape Delay (ST)", + "positions": { + "11": [ + { + "model_id": 6004, + "model": "Tape Delay (ST)", + "index": 12, + "raw": { + "displayPos": "11", + "name": "TRAILS" + } + }, + { + "model_id": 6004, + "model": "Tape Delay (ST)", + "index": 14, + "raw": { + "displayPos": "11", + "name": "STEREO WIDTH", + "toggleOn": "5" + } + } + ] + } + }, + { + "model_id": 6008, + "model": "Slapback Delay (ST)", + "positions": { + "12": [ + { + "model_id": 6008, + "model": "Slapback Delay (ST)", + "index": 13, + "raw": { + "displayPos": "12", + "name": "TRAILS" + } + }, + { + "model_id": 6008, + "model": "Slapback Delay (ST)", + "index": 14, + "raw": { + "displayPos": "12", + "max_string": "Inf", + "name": "DYN DEPTH", + "skew": "0.6" + } + } + ], + "13": [ + { + "model_id": 6008, + "model": "Slapback Delay (ST)", + "index": 15, + "raw": { + "displayPos": "13", + "name": "DYN MODE" + } + }, + { + "model_id": 6008, + "model": "Slapback Delay (ST)", + "index": 22, + "raw": { + "displayPos": "13", + "name": "STEREO WIDTH", + "toggleOn": "4" + } + } + ] + } + }, + { + "model_id": 6010, + "model": "Analog Delay (ST)", + "positions": { + "12": [ + { + "model_id": 6010, + "model": "Analog Delay (ST)", + "index": 13, + "raw": { + "displayPos": "12", + "name": "TRAILS" + } + }, + { + "model_id": 6010, + "model": "Analog Delay (ST)", + "index": 14, + "raw": { + "displayPos": "12", + "max_string": "Inf", + "name": "DYN DEPTH", + "skew": "0.6" + } + } + ], + "13": [ + { + "model_id": 6010, + "model": "Analog Delay (ST)", + "index": 15, + "raw": { + "displayPos": "13", + "name": "DYN MODE" + } + }, + { + "model_id": 6010, + "model": "Analog Delay (ST)", + "index": 22, + "raw": { + "displayPos": "13", + "name": "STEREO WIDTH", + "toggleOn": "4" + } + } + ] + } + }, + { + "model_id": 18007, + "model": "Minivoicer", + "positions": { + "3": [ + { + "model_id": 18007, + "model": "Minivoicer", + "index": 7, + "raw": { + "displayPos": "3", + "name": "V1 INTER", + "toggleOff": "15" + } + }, + { + "model_id": 18007, + "model": "Minivoicer", + "index": 20, + "raw": { + "displayPos": "3", + "name": "V1 SEMIT", + "toggleOff": "15" + } + } + ], + "8": [ + { + "model_id": 18007, + "model": "Minivoicer", + "index": 11, + "raw": { + "displayPos": "8", + "name": "V2 INTER", + "toggleOff": "15" + } + }, + { + "model_id": 18007, + "model": "Minivoicer", + "index": 21, + "raw": { + "displayPos": "8", + "name": "V2 SEMIT", + "toggleOff": "15" + } + } + ], + "18": [ + { + "model_id": 18007, + "model": "Minivoicer", + "index": 17, + "raw": { + "displayPos": "18", + "name": "OUTPUT", + "skew": "LIN_SKEW" + } + }, + { + "model_id": 18007, + "model": "Minivoicer", + "index": 18, + "raw": { + "displayPos": "18", + "name": "V1 NOTE" + } + } + ] + } + } ], - "device_typo": {"model": "Analog Delay (ST)", "parameter_index": 20, "parameter": "FEEDBACK DEPTH", "attribute": "isplayPos", "value": 18} + "gap_models": [ + { + "model_id": 6010, + "model": "Analog Delay (ST)", + "missing": [ + 18 + ] + }, + { + "model_id": 7034, + "model": "Chief DC2W PCOM", + "missing": [ + 6 + ] + }, + { + "model_id": 8016, + "model": "Gojira REV", + "missing": [ + 0 + ] + }, + { + "model_id": 8018, + "model": "SLO-100\u00ae Reverb", + "missing": [ + 0 + ] + }, + { + "model_id": 8019, + "model": "Cory Wong The Wash", + "missing": [ + 0 + ] + }, + { + "model_id": 8021, + "model": "Nolly Reverb", + "missing": [ + 0 + ] + }, + { + "model_id": 12050, + "model": "Gojira Cab 1 (M)", + "missing": [ + 0, + 2, + 3, + 4 + ] + }, + { + "model_id": 12051, + "model": "Gojira Cab 2 (M)", + "missing": [ + 0, + 2, + 3, + 4 + ] + }, + { + "model_id": 12052, + "model": "Gojira Cab 3 (M)", + "missing": [ + 0, + 2, + 3, + 4 + ] + }, + { + "model_id": 12053, + "model": "Plini Cab (M)", + "missing": [ + 2, + 3 + ] + }, + { + "model_id": 12054, + "model": "SLO-100\u00ae Cab (M)", + "missing": [ + 0, + 2, + 3, + 4 + ] + }, + { + "model_id": 32050, + "model": "Gojira Cab 1 (ST)", + "missing": [ + 0, + 2, + 3, + 4 + ] + }, + { + "model_id": 32051, + "model": "Gojira Cab 2 (ST)", + "missing": [ + 0, + 2, + 3, + 4 + ] + }, + { + "model_id": 32052, + "model": "Gojira Cab 3 (ST)", + "missing": [ + 0, + 2, + 3, + 4 + ] + }, + { + "model_id": 32053, + "model": "Plini Cab (ST)", + "missing": [ + 2, + 3 + ] + }, + { + "model_id": 32055, + "model": "SLO-100\u00ae Cab (ST)", + "missing": [ + 0, + 2, + 3, + 4 + ] + }, + { + "model_id": 21007, + "model": "Parallax Cab (M)", + "missing": [ + 2, + 3 + ] + }, + { + "model_id": 33007, + "model": "Parallax Cab (ST)", + "missing": [ + 2, + 3 + ] + } + ], + "device_typo": { + "model_id": 6010, + "model": "Analog Delay (ST)", + "index": 20, + "raw": { + "isplayPos": "18", + "name": "FEEDBACK DEPTH" + } + } }, "toggle": { - "counts": {"on": 132, "off": 83, "step": 13}, + "counts": { + "toggleOn": 132, + "toggleOff": 83, + "toggleStep": 13 + }, + "step_rows": [ + { + "model_id": 7039, + "model": "Micro Processor (ST)", + "index": 7, + "raw": { + "displayPos": "13", + "name": "LFO RATE", + "skew": "0.3", + "toggleOn": "6", + "toggleStep": "0,1" + } + }, + { + "model_id": 7039, + "model": "Micro Processor (ST)", + "index": 9, + "raw": { + "displayPos": "14", + "name": "ENV GAIN", + "skew": "LIN_SKEW", + "toggleOn": "6", + "toggleStep": "2,3" + } + }, + { + "model_id": 10004, + "model": "Splitter", + "index": 2, + "raw": { + "name": "BALANCE", + "toggleOn": "0", + "toggleStep": "0" + } + }, + { + "model_id": 10004, + "model": "Splitter", + "index": 3, + "raw": { + "min_string": "OFF", + "name": "LEVEL TO A", + "toggleOn": "0", + "toggleStep": "1" + } + }, + { + "model_id": 10004, + "model": "Splitter", + "index": 4, + "raw": { + "min_string": "OFF", + "name": "LEVEL TO B", + "toggleOn": "0", + "toggleStep": "1" + } + }, + { + "model_id": 10004, + "model": "Splitter", + "index": 5, + "raw": { + "name": "FREQUENCY", + "skew": "0.17722914651016206", + "toggleOn": "0", + "toggleStep": "2" + } + }, + { + "model_id": 10004, + "model": "Splitter", + "index": 6, + "raw": { + "name": "MODE", + "toggleOn": "0", + "toggleStep": "2" + } + }, + { + "model_id": 16016, + "model": "Phase Doctor", + "index": 2, + "raw": { + "name": "\u00d8 CENTER", + "toggleOn": "1", + "toggleStep": "1,2" + } + }, + { + "model_id": 16016, + "model": "Phase Doctor", + "index": 3, + "raw": { + "name": "\u00d8 SHIFT", + "skew": "LIN_SKEW", + "toggleOn": "1", + "toggleStep": "1,2" + } + }, + { + "model_id": 16016, + "model": "Phase Doctor", + "index": 7, + "raw": { + "name": "\u00d8 CENTER R", + "toggleOff": "4", + "toggleOn": "6", + "toggleStep": "1,2" + } + }, + { + "model_id": 16016, + "model": "Phase Doctor", + "index": 8, + "raw": { + "name": "\u00d8 SHIFT R", + "skew": "LIN_SKEW", + "toggleOff": "4", + "toggleOn": "6", + "toggleStep": "1,2" + } + }, + { + "model_id": 18009, + "model": "Gojira WOW", + "index": 0, + "raw": { + "name": "FATSO MIX", + "skew": "LIN_SKEW", + "toggleOn": "11", + "toggleStep": "2" + } + }, + { + "model_id": 18013, + "model": "Pitch Correction", + "index": 0, + "raw": { + "name": "ROOT", + "toggleOff": "1", + "toggleStep": "2" + } + } + ], "all_step_carriers_have_on_or_off": true, "self_references": [ - {"model": "Mono Synth", "index": 15, "parameter": "OSC2 WAVE", "attribute": "toggleOn"}, - {"model": "Mono Synth", "index": 24, "parameter": "SLOPE", "attribute": "toggleOn"}, - {"model": "Mono Synth", "index": 48, "parameter": "FREE RATE", "attribute": "toggleOff"} + { + "model_id": 30001, + "model": "Mono Synth", + "index": 15, + "raw": { + "name": "OSC2 WAVE", + "toggleOn": "15" + }, + "attribute": "toggleOn" + }, + { + "model_id": 30001, + "model": "Mono Synth", + "index": 24, + "raw": { + "displayPos": "28", + "name": "SLOPE", + "toggleOn": "24" + }, + "attribute": "toggleOn" + }, + { + "model_id": 30001, + "model": "Mono Synth", + "index": 48, + "raw": { + "displayPos": "15", + "name": "FREE RATE", + "skew": "0.3", + "toggleOff": "48" + }, + "attribute": "toggleOff" + } ] } } diff --git a/tests/test_catalog.py b/tests/test_catalog.py index 94fa2f95..b11b44e5 100644 --- a/tests/test_catalog.py +++ b/tests/test_catalog.py @@ -5,6 +5,7 @@ synthetic XML fixture, so they run offline and ship no vendor data. """ +import collections import gzip import io import json @@ -162,23 +163,37 @@ def test_real_catalog_editor_metadata_evidence_is_pinned(): facts = json.loads(path.read_text(encoding="utf-8")) assert facts["firmware"] == "CorOS 4.0.1" - assert facts["mid_string"] == { - "total": 36, "C": 35, "A/B": 1, - "all_have_min_and_max_labels": True, "all_have_skew": 1.0, - } + midpoint_rows = facts["mid_string"]["rows"] + assert len(midpoint_rows) == 36 + assert collections.Counter( + row["raw"]["mid_string"] for row in midpoint_rows + ) == {"C": 35, "A/B": 1} + assert all( + "min_string" in row["raw"] and "max_string" in row["raw"] + for row in midpoint_rows) + assert all(float(row["raw"].get("skew", 1.0)) == 1.0 + for row in midpoint_rows) assert facts["displayPos"]["carriers"] == 1446 - assert facts["displayPos"]["collision_models"] == 5 - assert facts["displayPos"]["gap_models"] == 18 + assert len(facts["displayPos"]["collision_models"]) == 5 + assert len(facts["displayPos"]["gap_models"]) == 18 assert facts["displayPos"]["device_typo"] == { - "model": "Analog Delay (ST)", "parameter_index": 20, - "parameter": "FEEDBACK DEPTH", "attribute": "isplayPos", "value": 18, + "model_id": 6010, "model": "Analog Delay (ST)", "index": 20, + "raw": {"isplayPos": "18", "name": "FEEDBACK DEPTH"}, } - assert facts["toggle"]["counts"] == {"on": 132, "off": 83, "step": 13} + assert facts["toggle"]["counts"] == { + "toggleOn": 132, "toggleOff": 83, "toggleStep": 13} + assert len(facts["toggle"]["step_rows"]) == 13 + assert all( + "toggleOn" in row["raw"] or "toggleOff" in row["raw"] + for row in facts["toggle"]["step_rows"]) assert facts["toggle"]["all_step_carriers_have_on_or_off"] is True - assert facts["toggle"]["self_references"] == [ - {"model": "Mono Synth", "index": 15, "parameter": "OSC2 WAVE", "attribute": "toggleOn"}, - {"model": "Mono Synth", "index": 24, "parameter": "SLOPE", "attribute": "toggleOn"}, - {"model": "Mono Synth", "index": 48, "parameter": "FREE RATE", "attribute": "toggleOff"}, + assert [ + (row["model"], row["index"], row["raw"]["name"], row["attribute"]) + for row in facts["toggle"]["self_references"] + ] == [ + ("Mono Synth", 15, "OSC2 WAVE", "toggleOn"), + ("Mono Synth", 24, "SLOPE", "toggleOn"), + ("Mono Synth", 48, "FREE RATE", "toggleOff"), ] @@ -192,6 +207,8 @@ def test_self_referencing_toggle_metadata_is_preserved_not_interpreted(): parameter = catalog.parse_model_repo(make_payload(xml))[1].parameters[0] assert parameter.toggle_on == (0,) + + 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. From fe83a5042347264f627f54e5282623b28fa8cdd0 Mon Sep 17 00:00:00 2001 From: Antoni Ivanov <262547018+tony-xmelon@users.noreply.github.com> Date: Wed, 23 Sep 2026 00:21:40 +0300 Subject: [PATCH 4/7] Ground editor metadata in extracted catalog evidence --- docs/ADR.md | 2 +- docs/domain-model.md | 14 ++++-- docs/protocol.md | 6 ++- scripts/extract_editor_metadata_fixture.py | 8 ++-- tests/fixtures/catalog/editor_metadata.json | 51 +++++++++++++++++++++ tests/test_catalog.py | 14 ++++-- 6 files changed, 81 insertions(+), 14 deletions(-) diff --git a/docs/ADR.md b/docs/ADR.md index ee610752..ef2ecd83 100644 --- a/docs/ADR.md +++ b/docs/ADR.md @@ -250,7 +250,7 @@ Records are append-only once `Decided` and built upon: a shipped decision is nev - **(a) The catalog wins; measurements become tests - chosen.** The table shrinks from 44 entries over 19 models to 14 numbers covering all 533, including models nobody has ever placed on a grid. - **(b) Keep `MEASURED_SPANS` as an override.** Safer against a lying catalog, but carries two tables that must agree, and the hand-measured one covers a twentieth of the models. - **(c) Trust the catalog without checking it.** Rejected. The formula was verified on hardware in both directions before anything was built on it, and `LOG_SKEW` turned out not to mean what its name says. -- **Open Questions:** Whether `toggleOn` / `toggleOff` / `toggleStep`, on 212 parameters, describe a footswitch toggle's two values. They are recorded in `docs/domain-model.md`'s appendix rather than guessed at. Also whether `expAssignable` governs the unit's own assignment UI - it demonstrably does not govern a host write, and what it does govern has not been established. +- **Open Questions:** Catalog shape now indicates `toggleOn` / `toggleOff` name a conditional-visibility driver and `toggleStep` its option (Splitter partitions cleanly by `TYPE`), but three Mono Synth parameters point to themselves and remain unexplained. Also whether `expAssignable` governs the unit's own assignment UI - it demonstrably does not govern a host write, and what it does govern has not been established. - **Rationale:** A measurement is evidence about a device; a catalog is that device's own description of itself. When both exist, the description is the better source and the evidence is the better test, and this project had them the wrong way round. Inverting it also fixes the coverage problem for free: a hand-measured table only ever covers what somebody happened to drive. The formula was confirmed before it was trusted, over three unrelated blocks in two different units - a cab `LEVEL` at skew 4.9594844, a Low-High Cut's HPF `FREQ` at 0.3, and the same block's `OUTPUT` with no skew - because applying an untested exponent to 615 parameters is exactly the guess this project's rules exist to prevent. `LOG_SKEW` justified that caution: it is a power law at skew 0.3, not the logarithmic sweep its name promises, and two readings on an Envelope Filter proved it independently. - **Consequences:** diff --git a/docs/domain-model.md b/docs/domain-model.md index 5f373098..07be07f3 100644 --- a/docs/domain-model.md +++ b/docs/domain-model.md @@ -1193,18 +1193,26 @@ hardware, host concerns or reference text with nothing for a host API to model. ## Catalog attributes -The unit puts 24 distinct attributes on its `` elements. Seventeen are +The unit puts 24 distinct attributes on its `` elements. Twenty are parsed. What follows is what is known about the ones that matter to a caller, and -the seven that are not yet explained. Counts are from the CorOS 4.0.1 catalog, +the four that are not yet explained. Counts are from the CorOS 4.0.1 catalog, 3,809 parameters. Nothing here is guessed at: a control we do not understand is omitted with the reason written down. +### Conditional editor metadata + +`toggleOn`, `toggleOff`, and `toggleStep` occur on 132 / 83 / 13 fields, +212 parameters between them. They are exposed as `toggle_on`, `toggle_off`, +and `toggle_steps` without assigning host behaviour. The catalog shape indicates +that the first two name a conditional-visibility driver and the last names its +option: Splitter's controls partition cleanly by `TYPE`. Three Mono Synth +parameters self-reference, so those cases remain unexplained. + ### Unexplained | 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 | Exposed as `toggle_on`, `toggle_off`, and `toggle_steps` without assigning behaviour. `toggleOn` carries a number on `float` parameters such as a tremolo's `LEVEL`, and `toggleStep` sometimes carries a pair (`"0,1"`); three Mono Synth parameters self-reference, so the obvious visibility-driver reading is not universal | | `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 | diff --git a/docs/protocol.md b/docs/protocol.md index 1b92e1f5..bc0ec0ec 100644 --- a/docs/protocol.md +++ b/docs/protocol.md @@ -2197,7 +2197,11 @@ wire, with no independent read-back. touchscreen's own assignment menu is the candidate and has not been checked. Whether the unit acts on an assignment stored against such a parameter needs audio, not a wire read. -- **What `toggleOn`, `toggleOff` and `toggleStep` mean**, on 212 parameters. +- **Three self-referencing conditional metadata entries** remain unexplained: + Mono Synth indexes 15 and 24 point `toggleOn` to themselves, and index 48 + points `toggleOff` to itself. Elsewhere, CorOS 4.0.1 catalog shape indicates + `toggleOn` / `toggleOff` name a conditional-visibility driver and + `toggleStep` its option: Splitter's controls partition cleanly by `TYPE`. - **Whether a capture id denotes different content on a different unit** needs a second unit. - **Whether host writes are honoured during standby.** diff --git a/scripts/extract_editor_metadata_fixture.py b/scripts/extract_editor_metadata_fixture.py index cd75017e..42e8d82c 100644 --- a/scripts/extract_editor_metadata_fixture.py +++ b/scripts/extract_editor_metadata_fixture.py @@ -84,10 +84,10 @@ def main(): "model": model.get("name"), "positions": duplicates, }) - # Positions that begin at 11 are partial plugin layouts, not gaps in a - # complete editor. The remaining layouts start at 0 or 1; missing - # values through their maximum are the 18 gap models in this catalog. - if positions and min(positions) <= 1: + # Use the explicit all-parameter basis: every missing integer in + # 0..max(displayPos) is a gap. This produces 21 models on CorOS 4.0.1; + # a different origin or visibility filter produces a different count. + if positions: missing = sorted(set(range(max(positions) + 1)) - set(positions)) if missing: gap_models.append({ diff --git a/tests/fixtures/catalog/editor_metadata.json b/tests/fixtures/catalog/editor_metadata.json index b1452201..b71e0278 100644 --- a/tests/fixtures/catalog/editor_metadata.json +++ b/tests/fixtures/catalog/editor_metadata.json @@ -672,6 +672,57 @@ 18 ] }, + { + "model_id": 6016, + "model": "PCOM Tape Delay (ST)", + "missing": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ] + }, + { + "model_id": 6018, + "model": "Plini Delay", + "missing": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ] + }, + { + "model_id": 6019, + "model": "Gojira DLY", + "missing": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ] + }, { "model_id": 7034, "model": "Chief DC2W PCOM", diff --git a/tests/test_catalog.py b/tests/test_catalog.py index b11b44e5..d0d04d1c 100644 --- a/tests/test_catalog.py +++ b/tests/test_catalog.py @@ -175,7 +175,7 @@ def test_real_catalog_editor_metadata_evidence_is_pinned(): for row in midpoint_rows) assert facts["displayPos"]["carriers"] == 1446 assert len(facts["displayPos"]["collision_models"]) == 5 - assert len(facts["displayPos"]["gap_models"]) == 18 + assert len(facts["displayPos"]["gap_models"]) == 21 assert facts["displayPos"]["device_typo"] == { "model_id": 6010, "model": "Analog Delay (ST)", "index": 20, "raw": {"isplayPos": "18", "name": "FEEDBACK DEPTH"}, @@ -198,15 +198,19 @@ def test_real_catalog_editor_metadata_evidence_is_pinned(): def test_self_referencing_toggle_metadata_is_preserved_not_interpreted(): + preceding = "".join( + f'' + for index in range(15)) xml = """ - + %s + - """ + """ % preceding - parameter = catalog.parse_model_repo(make_payload(xml))[1].parameters[0] + parameter = catalog.parse_model_repo(make_payload(xml))[1].parameters[15] - assert parameter.toggle_on == (0,) + assert parameter.toggle_on == (15,) def test_a_labelled_end_control_carries_the_span_the_unit_draws(): From 200864c3782cacadccba5efaf40b64f8711d8294 Mon Sep 17 00:00:00 2001 From: Antoni Ivanov <262547018+tony-xmelon@users.noreply.github.com> Date: Sat, 26 Sep 2026 19:03:43 +0300 Subject: [PATCH 5/7] Address editor metadata review feedback --- docs/ADR.md | 2 +- docs/STEERING.md | 3 ++- docs/domain-model.md | 4 ++++ pyquadcortex/protocol/catalog.py | 13 ++++++++----- scripts/extract_editor_metadata_fixture.py | 5 +++-- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/docs/ADR.md b/docs/ADR.md index ef2ecd83..ee610752 100644 --- a/docs/ADR.md +++ b/docs/ADR.md @@ -250,7 +250,7 @@ Records are append-only once `Decided` and built upon: a shipped decision is nev - **(a) The catalog wins; measurements become tests - chosen.** The table shrinks from 44 entries over 19 models to 14 numbers covering all 533, including models nobody has ever placed on a grid. - **(b) Keep `MEASURED_SPANS` as an override.** Safer against a lying catalog, but carries two tables that must agree, and the hand-measured one covers a twentieth of the models. - **(c) Trust the catalog without checking it.** Rejected. The formula was verified on hardware in both directions before anything was built on it, and `LOG_SKEW` turned out not to mean what its name says. -- **Open Questions:** Catalog shape now indicates `toggleOn` / `toggleOff` name a conditional-visibility driver and `toggleStep` its option (Splitter partitions cleanly by `TYPE`), but three Mono Synth parameters point to themselves and remain unexplained. Also whether `expAssignable` governs the unit's own assignment UI - it demonstrably does not govern a host write, and what it does govern has not been established. +- **Open Questions:** Whether `toggleOn` / `toggleOff` / `toggleStep`, on 212 parameters, describe a footswitch toggle's two values. They are recorded in `docs/domain-model.md`'s appendix rather than guessed at. Also whether `expAssignable` governs the unit's own assignment UI - it demonstrably does not govern a host write, and what it does govern has not been established. - **Rationale:** A measurement is evidence about a device; a catalog is that device's own description of itself. When both exist, the description is the better source and the evidence is the better test, and this project had them the wrong way round. Inverting it also fixes the coverage problem for free: a hand-measured table only ever covers what somebody happened to drive. The formula was confirmed before it was trusted, over three unrelated blocks in two different units - a cab `LEVEL` at skew 4.9594844, a Low-High Cut's HPF `FREQ` at 0.3, and the same block's `OUTPUT` with no skew - because applying an untested exponent to 615 parameters is exactly the guess this project's rules exist to prevent. `LOG_SKEW` justified that caution: it is a power law at skew 0.3, not the logarithmic sweep its name promises, and two readings on an Envelope Filter proved it independently. - **Consequences:** diff --git a/docs/STEERING.md b/docs/STEERING.md index f48c53a3..caa19638 100644 --- a/docs/STEERING.md +++ b/docs/STEERING.md @@ -93,7 +93,8 @@ ADR-0012. - `examples/` - runnable scripts - `docs/` - the documents listed in [`writing.md`](writing.md) - `scripts/` - `compile_protos.sh`, `check_artifacts.py`, the three generators - and `_snapshots.py`, `extract_scale_fixture.py` + and `_snapshots.py`, `extract_scale_fixture.py`, + `extract_editor_metadata_fixture.py` - `.github/workflows/` - CI ## 5. Patterns in Use diff --git a/docs/domain-model.md b/docs/domain-model.md index 07be07f3..0ff7b7a9 100644 --- a/docs/domain-model.md +++ b/docs/domain-model.md @@ -1366,6 +1366,10 @@ On ``, `blob` is unexplained: a same-length string that changes between reads, on 338 models and no others across the three lab captures. A per-read token, not content. +`linkedSceneMode` appears 44 times in the contributed CorOS 4.1.0 catalog and +zero times in 4.0.1. Its meaning and relationship, if any, to preset +`scene_mode` are unknown, so it is recorded here and not exposed as shared API. + On `