Skip to content

HardcodedLiteralShouldBeConfigProphet (#163 #11) — deferred: literal==config-value is FP-prone #180

@jessegall

Description

@jessegall

Part of the value-flow family (#163). #11 was prototyped and deferred — it cannot clear the zero-FP bar with the spec's "a literal repeated ≥N sites that also equals a config leaf value" rule.

Evidence (smart-farmers proving ground)

A LiteralCensus + ConfigReadIndex leaf-value map were prototyped. Even gated on a distinctive compound token (-/:-separated, len ≥5), the sweep produced 14 hits, all coincidental:

  • 'Y-m-d' ×32 — a ubiquitous date-format string (->format('Y-m-d')) that merely equals a report-editor config default. Unrelated.
  • 'google-drive' ×3 — a disk identifier (Storage::disk('google-drive')), equal to a filesystems.disks.google-drive.driver value. Not a value to "read from config".

The "literal == config value" signal is fundamentally too weak: identifiers, format strings, and driver names coincidentally match config values. A zero-FP version would need semantic matching (the literal feeds the same API the config feeds), which is fragile.

What exists

The would-be substrate (LiteralCensus, ConfigReadIndex::pathForValue) was reverted to avoid dead code. ConfigReadIndex (key tree + env-leaf marking) and the rest of the family shipped.

To revisit

A future design could require the literal to appear in an argument position that a config() read of the matching path also feeds (true value-flow congruence), rather than bare value equality.

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