Skip to content

test(config): guard F_* index symmetry with sanity and round-trip tests#50

Merged
roramirez merged 1 commit into
mainfrom
chore/07-f-index-sanity
Jun 30, 2026
Merged

test(config): guard F_* index symmetry with sanity and round-trip tests#50
roramirez merged 1 commit into
mainfrom
chore/07-f-index-sanity

Conversation

@roramirez

@roramirez roramirez commented Jun 30, 2026

Copy link
Copy Markdown
Owner

What

The TUI config editor keeps the F_* constants, the field order in from_config(), and the index reads in build_config() in sync by hand. There was no validation: a desync silently reads/writes the wrong field (a critical invariant called out in CLAUDE.md).

Changes

  • field_index_sanity(): validates contiguity of all F_* slots (including the 16 palette slots) and equality with fields.len().
  • Full round-trip build_config(from_config(cfg)) == cfg over a config whose every field is distinct.
  • Derive PartialEq on the config structs to enable the equality check.

Card

plan-todo/07-mant-indices-f-tui-config.md

…p tests

The TUI config editor keeps the F_* field-index constants, the field order
in from_config(), and the index reads in build_config() in sync by hand,
with no runtime validation — a desync silently reads/writes the wrong
field. Add field_index_sanity() (contiguity of all F_* slots, including the
16 palette slots, and equality with fields.len()) and a full round-trip
test build_config(from_config(cfg)) == cfg over a config whose every field
is distinct. Derive PartialEq on the config structs to enable the equality.
@roramirez roramirez merged commit 5c69785 into main Jun 30, 2026
2 checks passed
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.

1 participant