Skip to content

refactor: drop channel number from internal model (assign at export) #53

Description

@pskillen

Problem

Channel.number maps to OpenGD77 Channel Number — a vendor CPS concept (1–1023, used for direct-access in the radio's All-channels zone). It has no meaning in our vendor-neutral internal model: channels are identified by stable internal id and referenced by name at export boundaries.

Storing number in the model leaks OpenGD77 semantics into CRUD UI and persistence, and will not generalise to other radios (DM32 uses No. with different rules).

Intended outcome

Remove number from the internal Channel model and apply channel numbering only at export time per target vendor.

Data model

  • Drop number from Channel in src/models/codeplug.ts.
  • Bump CODEPLUG_SCHEMA_VERSION; migrate loaded projects (discard imported number values — they can be re-derived on next export).
  • Update docs/features/data-model/README.md.

Import

  • OpenGD77: stop mapping Channel NumberChannel.number. Optionally ignore on import or stash in vendorExtras temporarily during transition (prefer discard once export assigns fresh numbers).
  • Update docs/features/import/opengd77.md mapping table.

Export

  • OpenGD77: assign Channel Number when serialising Channels.csv — e.g. sequential 1…n in export row order, or preserve stable ordering by channel list position. Document the assignment rule.
  • Respect OpenGD77 constraints (1–1023, unique). Surface export warning if channel count exceeds limit.
  • Update export docs.

UI

Remove channel number from:

  • Channel edit (src/routes/channels/edit.tsxChannel number TextInput in Identity section)
  • Channel detail (src/routes/channels/detail.tsx — Identity field)
  • Channel list (not currently shown; verify no column/filter references)

Affected

  • src/models/codeplug.ts + schema migration
  • src/lib/import/opengd77/parse.ts, columns.ts
  • src/lib/export/opengd77/serialise.ts
  • src/routes/channels/edit.tsx, detail.tsx
  • Tests and fixtures referencing channel.number
  • docs/features/data-model/, import/export docs

Notes / dependencies

  • OpenGD77 skill: channel number is "Unique; direct-access in All-channels zone" — export assignment must produce valid unique integers.
  • Independent of the broader field-type refactor issue — can land first as a focused change.
  • Round-trip import → edit → export will not preserve original channel numbers (acceptable; numbers are a radio indexing aid, not operator identity).

Out of scope

  • Letting operators pin a preferred channel number in the UI (future vendor-specific export option if needed).
  • DM32 No. column rules (defer until DM32 export ships).

Workflow note

Branch from origin/main, atomic conventional commits, PR linking Closes #.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions