Skip to content

Check the keys of the PALS root node#77

Merged
DavidSagan merged 1 commit into
mainfrom
pals-root-keys
Jul 24, 2026
Merged

Check the keys of the PALS root node#77
DavidSagan merged 1 commit into
mainfrom
pals-root-keys

Conversation

@DavidSagan

Copy link
Copy Markdown
Member

The problem

A misspelled key in the PALS root node was silent. From a real file:

PALS:
  extension_names:      # should be extension_labels
    names:
      Bmad

Nothing is registered, so the first sign of the mistake was a complaint about the data the extension was meant to cover, an element away:

element 'beginning_b1': unknown parameter 'Bmad'

Now:

PALS node: unknown key 'extension_names'; did you mean 'extension_labels'?

The fix

  • known_pals_keys — the root's closed vocabulary: the six of fundamentals.md s:palsroot, plus phase_space_coordinates (coordinates.md) and the two ways a file names another, include and load.

  • check_pals_root — checks the PALS node's own keys, called from check_pals_names alongside the existing walk. A key registered as an extension label is skipped as it is everywhere else. Only this node's keys are checked: anything outside PALS is outside the standard and ignored (fundamentals.md).

  • suggest gained an optional edit cap, default 2, so every existing caller is unchanged. extension_names is four edits from extension_labels, past the usual cap; the root vocabulary is nine names with nothing in common, so a looser cap there cannot match at random.

Tests

Three new cases in test_check.cpp (suite: 224 cases, all passing):

  • the misspelled root key is reported, with the suggestion;
  • every documented root key passes clean, and a registered name still covers the element data it was registered for;
  • a root key matching a registered prefix is left alone.

The first is verified as a real regression by stubbing out the call: that case fails, the rest pass. Every file in lattice_files/ was run through the checker as well -- no new reports, so the vocabulary is not missing anything the examples use.

🤖 Generated with Claude Code

A misspelling in the root node was silent. `extension_names` for
`extension_labels` registers no extension at all, and the only sign of it
was a complaint about whatever the extension was meant to cover -- an
element away from the actual mistake.

check_pals_root checks the node's own keys against s:palsroot, plus
phase_space_coordinates (coordinates.md) and the two file-reference
commands, include and load. A key registered as an extension label is
skipped as it is everywhere else, and nothing outside the PALS node is
looked at, since that is outside the standard (fundamentals.md).

suggest() gained an optional edit cap, default 2, so every existing
caller is unchanged. `extension_names` is four edits from
`extension_labels`, past the usual cap; the root vocabulary is nine names
with nothing in common, so a looser cap there cannot match at random.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@DavidSagan
DavidSagan merged commit 877f6fd into main Jul 24, 2026
3 checks passed
@DavidSagan
DavidSagan deleted the pals-root-keys branch July 24, 2026 20:35
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