Skip to content

Mapping import, export, reset and check #24

Closed

Description

@Skeyelab

Parent

#12

What to build

The DJ can fix a PROVISIONAL value for their unit without a new build, and typos are caught before they play.

Acceptance criteria

  • Import goes through the open panel, and the file is copied into the app container. Export writes the current merged mapping. Reset returns to the default. This needs the user-selected read-write entitlement.
  • The check runs on the merged mapping. It finds unknown keys, wrong types, out-of-range numbers (notes and CCs 0–127, channels 1–16, decks 1–4) and duplicate assignments. Every error is listed at once, with the key and what was expected.
  • A rejected import leaves the working mapping unchanged. An accepted import calls release-all, then resync.
  • Written test-first with /tdd, at the agreed seams (the Coordinator with fakes, and OSC packet bytes). The check is tested as a mapping document going in and readable errors coming out.

Blocked by

Activity

  1. added this to the v1.0: native Mac app milestone on Nov 16, 2026
  2. Skeyelab commented on Nov 16, 2026

    @Skeyelab
    MemberAuthor

    From the #31 review (#32, item 4): Mapping.Notes.init(from:) turns every notes key except pads into a button, so a typo like "paly": 11 in an override is accepted and does nothing. The mapping check here should reject unknown notes keys (and unknown keys in every section). #32 adds MappingError.invalid([String]) and Mapping.problems (MIDI channel 1-16 only for now). Extend that list rather than adding a second error path.

  3. Skeyelab commented on Nov 16, 2026

    @Skeyelab
    MemberAuthor

    From #43: mapping import now imports a controller profile, not a bare mapping. A profile file is { "id", "name", "device_hints": [...], "mapping": { ...today's mapping body... } }, decoded by ControllerProfile(decoding:), which already runs Mapping.problems on the body. The bundled one is Resources/Profiles/denon-lc6000-prime.json. The override merge (Mapping.bundledDefault(overriddenBy:)) still applies to the mapping body. Whether an imported file may change id/device_hints, or only override the body of an existing profile, is a decision for this ticket.

  4. added a commit that references this issue on Nov 16, 2026
  5. Skeyelab commented on Nov 16, 2026

    @Skeyelab
    MemberAuthor

    Post-merge review of PR #74 (agent1). Most of it matches the plan: unknown keys with paths, kinds, ranges, namespaced duplicates, document order, release-all followed by one Resend, deck, channel and LEDs kept, the container copy plus the entitlement, and the export round-trip. Real problems are filed as #92 (files that crash the app), #93 (values that silently do nothing) and #94 (schema per profile, and missing tests). Smaller notes:

    • Double-reported values: an out-of-range value is also reported as a duplicate (notes.play: 200, notes.cue: 200 gives 3 problems). known() should drop out-of-range values, as it drops wrong-kind ones.
    • Duplicate JSON keys aren't refused. Two "mapping" keys are both checked, but only the first is applied. Report "duplicate key".
    • The number grammar is lax: +5 and 0005 are accepted.
    • null on an optional key gives "expected true or false, got null". Treating null as absent would be friendlier.
    • Problem sorting splits on the first :, so a key like "a:b" sorts in the wrong place.
    • Two merge implementations: Mapping.bundledDefault(overriddenBy:) still uses a JSONSerialization merge next to OrderedJSON's. Consolidate them.
    • MappingStore.remove() swallows errors. If the delete fails, the window says "Bundled default", but the import comes back at the next launch.
    • importMapping reads the chosen file on the main thread with no size cap. Cap it, for example at 1 MB.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions