Files
PSProxmoxVE/docs/decisions/0012-magic-strings-are-extracted-to-named-constants.md
T
goodolclint-claude[bot] b90791e2bf docs: migrate DECISIONS.md to house-format ADRs, and retire the review folder (#131)
D001-D021 become ADR 0001-0021 in docs/decisions/, one decision per file.
D017's PESTER_VERSION amendment was a second decision in one entry and becomes
ADR 0022. ADR 0023 records the migration and reverses the lane2-change-plan
ruling that deliberately kept DECISIONS.md until the CI lane work landed.

DECISIONS.md is reduced to a stub with a D-to-ADR redirect table, so the four
released CHANGELOG entries and older issue bodies that cite it degrade to a
redirect rather than a dead reference.

docs/review/ and docs/lane2-change-plan.md are deleted (ADR 0024). Of 91
findings, 83 were resolved and six of the seven still open were already GitHub
issues; F021 was the exception and is now #130.

CLAUDE.md's Key Conventions list gains the two rules it was missing and becomes
the checklist, with the ADRs carrying rationale.
2026-09-02 14:49:07 +00:00

1.0 KiB

ADR 0012 — Magic strings are extracted to named constants

  • Status: Accepted
  • Date: 2026-03-22
  • Deciders: unrecorded; adopted during review scan 2026-03-22
  • Context source: docs/review/findings.json F049

Context

The auth header names PVEAPIToken= and CSRFPreventionToken appeared as inline literals at several call sites. A typo in one of them fails at runtime as an authentication error, which is a long way from the cause.

Decision

String literals used in more than one place — auth header names, token prefixes and the like — are const string fields with names, such as ApiTokenPrefix and CsrfHeaderName.

Rejected alternatives

None recorded. This is a maintainability convention adopted during review scan 2026-03-22, not a choice between competing designs.

Consequences

The rule is about repeated literals with protocol meaning. It is not an instruction to hoist every string in the module into a constants class, and it has no mechanical test — a new inline literal is caught by review or not at all.