Skip to content

refactor(chronicle): collapse 5 parallel whitelist arrays into one keyed table #33

Description

@argen

Source: code-review of #30; nice-to-have, deferred at merge.

The append subcommand uses four APPENDABLE_<TYPE> arrays + a fifth PREPEND_SECTIONS array to express what can grow and how. That's five places to typo a section name — a "Open Asks" (capital A) would slip through validate-skill and only surface when a user tried to append.

Nothing cross-checks the whitelist against REQUIRED_SECTIONS_*. A bash associative array keyed by <type>:<section> with value append|prepend would be one source of truth and make decision → no appendables an empty-key invariant rather than a special if branch (see scripts/chronicle.sh:327).

Concrete proposal:

  • Replace the five arrays with one declare -A APPEND_RULES where keys are <type>:<section> and values are append or prepend.
  • Add a startup-time assertion that every appendable name appears in the corresponding REQUIRED_SECTIONS_* (catches case-typo regressions).
  • Update cmd_append's whitelist lookup to read the table.

Reference: Sandi Metz, "The Wrong Abstraction" — five parallel arrays is the duplication that signals one missing structure.

Files: scripts/chronicle.sh (lines ~30-60 for the arrays; ~310-330 for the lookup).

Risk: low — pure refactor, the test harness (33 cases) is the safety net.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions