Skip to content

feat(player): add Amiga filename-style display toggle#39

Merged
indigo423 merged 2 commits into
mainfrom
feat/add-amiga-prefix-filenames
May 18, 2026
Merged

feat(player): add Amiga filename-style display toggle#39
indigo423 merged 2 commits into
mainfrom
feat/add-amiga-prefix-filenames

Conversation

@indigo423
Copy link
Copy Markdown
Collaborator

@indigo423 indigo423 commented May 18, 2026

Closes #36

Summary

Adds a Sound-pane preference that controls how module filenames render across all catalog surfaces (Mod Archive, Library, Local drop). Three modes:

  • Auto (default) — render filenames verbatim from disk
  • Amiga — Amiga-native formats (.mod / .med / .okt / .ahx / .thx) in scene prefix form (e.g. echoing.modmod.echoing). .thx canonicalizes to ahx. (same engine identity).
  • Amiga everywhere — extends the prefix transform to PC-era formats (.xm / .it / .s3m / .mptm / .stm / .mtm / .669 / .ult) for visual consistency.

Display-only: download filenames, player title, document title, and sourceKey are untouched. Title tooltips preserve the canonical on-disk basename so it stays copyable for search/share. TFMX pair rows render as <base> (TFMX) style-independently — the (TFMX) suffix already conveys format identity and a single hardcoded prefix label would misrepresent the various on-disk pair shapes.

Implementation

  • lib/filename/amiga-style.ts — pure 4-step transform with native + all prefix tables, idempotency guard for base-equals-prefix-letters inputs (Mod.Mod family), and a recognition-alias map that canonicalizes thx.ahx. on read. Step 3 alias matching is gated on suffix-derived format identity (a name with prefix + unrelated allow-list extension keeps the extension's format, not the alias's).
  • lib/filename/context.tsx — React Context Provider + useFilenameStyle() hook. Safe defaults so consumers rendered outside the Provider degrade silently to auto mode rather than throw.
  • components/SoundPane.tsx — radio group below "Stereo separation"; stays interactive when audio controls are disabled (TFMX) via a :not(.filenameStyleSection) CSS exemption.
  • Call-sites updated: LibraryCatalog (file rows + mod search rows with path-split + TFMX pair rows), LocalCatalog (file rows + pair rows), and the three Mod Archive list components (ChartList, GenreMods, PersonMods) with title= tooltip carrying the canonical name.
  • Preference persists under display.filenameStyle in localStorage; falls back to "auto" on any invalid value.

Vitest coverage: 73 cases across the transform, alias canonicalization, idempotency guard, format-identity gate, amiga-all mode, and the TFMX label.

Test plan

  • npm test — 106/106 pass
  • npm run typecheck — clean
  • npm run lint — stays at 35-baseline warnings (zero new)
  • Manual UI smoke: toggle exists in Sound pane with three options; flipping Auto → Amiga → Amiga everywhere updates every catalog row; TFMX rows stay <base> (TFMX) in all modes; tooltip shows canonical name; player title and downloads unchanged; preference persists across reload
  • Two-pass adversarial code review (3-layer: Blind Hunter + Edge Case Hunter + Acceptance Auditor) — round 1 surfaced THX canonicalization + Mod.Mod idempotency fixes; round 2 surfaced and patched the format-identity gate on step 3; all deferred items recorded in _bmad-output/implementation-artifacts/deferred-work.md

🤖 Generated with Claude Code

indigo423 added 2 commits May 18, 2026 17:49
Adds a Sound-pane preference that controls how module filenames render
across all catalog surfaces (Mod Archive, Library, Local drop).

Three modes:
- Auto (default) — render filenames verbatim from disk
- Amiga — Amiga-native formats (.mod/.med/.okt/.ahx/.thx) in scene
  prefix form (e.g. echoing.mod -> mod.echoing); .thx canonicalizes
  to ahx. (same engine identity)
- Amiga everywhere — extends the prefix transform to PC-era formats
  (.xm/.it/.s3m/.mptm/.stm/.mtm/.669/.ult) for visual consistency

Display-only: download filenames, player title, document title, and
sourceKey are untouched. Title tooltips preserve the canonical on-disk
basename so it stays copyable. TFMX pair rows render as
`<base> (TFMX)` style-independently — the (TFMX) suffix already
conveys format identity and a single hardcoded label would
misrepresent the various on-disk pair shapes.

Implementation:
- lib/filename/amiga-style.ts — pure 4-step transform with native +
  all prefix tables, idempotency guard for base-equals-prefix-letters
  inputs (Mod.Mod family), THX -> AHX alias canonicalization
- lib/filename/context.tsx — React context Provider + useFilenameStyle()
  hook with safe default for consumers outside the Provider
- Vitest coverage: 64 cases across the transform, alias, idempotency,
  amiga-all mode, and TFMX label

Preference persists under display.filenameStyle in localStorage and
falls back to "auto" on any invalid value.

Assisted-by: ClaudeCode:claude-opus-4-7
Signed-off-by: Ronny Trommer <ronny@no42.org>
When a name carries an unrelated allow-list suffix (e.g. `thx.foo.mod`,
`med.foo.mod`), step 2 strips the suffix and remembers the implied
canonical prefix, then step 3 used to fire on any matching alias in
the working string regardless. That silently dropped the format
identity carried by the actual extension:

  thx.foo.mod -> ahx.foo  (lost .mod identity)
  med.foo.mod -> med.foo  (lost .mod identity)

Fix: gate the step 3 alias loop with `(impliedPrefix === null || to ===
impliedPrefix)` so the alias only fires when its canonical output
agrees with the suffix's canonical format, or no suffix was stripped.
After the gate:

  thx.foo.mod -> mod.thx.foo  (preserves .mod identity)
  med.foo.mod -> mod.med.foo  (preserves .mod identity)
  thx.foo.ahx -> ahx.foo      (alias agrees with suffix, fires)
  thx.dexter  -> ahx.dexter   (no suffix, fires)
  mod.echoing.mod -> mod.echoing  (matching prefix+suffix collapses)

9 new Vitest cases cover the gate, including f(f(x)) round-trips for
both flagged inputs to lock in idempotency.

Found in second-pass adversarial code review of PR #39.

Assisted-by: ClaudeCode:claude-opus-4-7
Signed-off-by: Ronny Trommer <ronny@no42.org>
@indigo423 indigo423 merged commit 6ebc769 into main May 18, 2026
3 checks passed
@indigo423 indigo423 deleted the feat/add-amiga-prefix-filenames branch May 18, 2026 16:24
indigo423 added a commit that referenced this pull request May 18, 2026
Ships the Amiga filename-style display toggle (PR #39, closes #36).
A user-toggleable Sound-pane preference that renders Amiga-native
module filenames in scene prefix form (`mod.echoing` instead of
`echoing.mod`) across all catalog surfaces. Three modes:
auto / amiga / amiga-everywhere. Display-only — downloads and
internal identity unchanged.

Assisted-by: ClaudeCode:claude-opus-4-7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Authentic Amiga-style filename display (mod.echoing instead of echoing.mod)

1 participant