Skip to content

New rule setting (C011): a bolt.bend setting that names no rule or group (BOLT-CFG-7) #113

Description

@ngngardner

SPEC.md's BOLT-CFG-7 says "A setting in a bolt.bend whose name is no rule or group is a finding." Nothing implements it today: bolt/config.bend reads every def <name>() and grading only ever looks names up, so an unknown name is silently ignored. This issue proposes the rule that makes CFG-7 true, so it can then be proved like the other CFG rows (#107).

Why

A typo in a bolt.bend fails open. def wrp() -> String: "off" leaves wrap at its group level, and nothing says so. CFG-3 already made an unknown level word fail closed ("a typo makes a rule stricter, never silently off"); an unknown name is the same mistake one token to the left. Retired names hit it too: def quantify() (L004) and def shadow() (C001) are now dead settings, and def law() is the trap bolt/README.md already warns about.

Proposal

slug setting
code C011, the next correctness code (C001 stays retired)
group correctness, default error, like the rest of the group: a setting that does nothing is a config bug, and CFG-3 already chose fail-closed
message `wrp` names no rule or group, so it sets nothing. plus, when one slug or group is one edit away, Did you mean `wrap`? (optional; drop it if it costs more than it earns)
position the def line of the setting in the bolt.bend: bolt.bend:L:1

Known names are exactly Codes.table()'s slugs plus the five group names. A retired slug (quantify, shadow) is unknown, and gets the finding.

Where it runs. A bolt.bend is read, never linted (BOLT-SCOPE-5), so this cannot be a per-file rule over Src. It belongs where the config is read: the grader already finds the nearest bolt.bend per file, so the natural home is a check over each bolt.bend that grading reads, reported once per bolt.bend in the run, after the per-file findings and before coverage/unsafe (BOLT-OUT-3's order gains one slot; the row would say so). The LSP, which runs per-file rules only, would report it when the open document is a bolt.bend, which today gets no lint (BOLT-LSP-4's "an open bolt.bend gets no lint" would change to "gets only setting").

Its own level. setting is graded like any rule, by the bolt.bend it reports on, so def setting() -> String: "off" turns it off, and def correctness() sets it with its group.

Files it touches

  • bolt/codes.bend: a setting/C011/correctness row (and the one-per-row proof arm OUT-1's laws in bolt/PROOF.bend need, test(output): prove the code table one-to-one and the finding format (BOLT-OUT-1, BOLT-OUT-2) #112).
  • bolt/config.bend: a pure unknown(cfg: Config) -> List<(name, line)> over the parsed settings, which needs the settings to keep their line.
  • bolt/lint.bend (and bolt/lsp/ for the open-bolt.bend case): report it.
  • bolt/README.md: the group table, the code table, the rule's entry.
  • SPEC.md: BOLT-CFG-7 cites the law; BOLT-OUT-3 and BOLT-LSP-4 wording as above; a BOLT-RULE-C011 row.

The law (CFG-7)

Over every list of settings: unknown(Config{sets}) holds exactly the settings whose name is neither a slug of Codes.table() nor one of the five groups, in file order, one each. Stated against a spec function in bolt/LAWS.bend, proved in bolt/PROOF.bend, next to the CFG laws.

Open questions

  1. Correctness/error, or style/warn (S005) so existing projects with a stale def quantify() get a warning, not a failing gate, on upgrade?
  2. Keep the "did you mean" suggestion, or leave it out of the first version?

Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions