Skip to content

Docs: fix uncopyable config examples, phantom defaults keys, pc_hostname advice (#44) - #67

Merged
falbany merged 1 commit into
mainfrom
fix/issue-44-config-docs
Oct 31, 2026
Merged

falbany merged 1 commit into
mainfrom
fix/issue-44-config-docs

Conversation

@falbany

@falbany falbany commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Closes #44

1. Unquoted *-leading globs are YAML aliases — examples didn't parse

Quoted every glob item in README.md, README.fr.md, docs/configuration-profile.{en,fr}.md and docs/performance-metrics-guide.md, and added a warning callout in the Glob Exclusion section of both configuration-profile guides ([*backup*] → found undefined alias 'backup*').

While verifying, I found and fixed the remaining unparseable blocks in the same guides:

  • filters: [, prod, specific]-style sequences in the French guide (empty first item = YAML null, breaks filters typing) — 4 occurrences
  • Search-expression examples like filters: ["Production Program" OR "Test Suite" -deprecated] (quoted+plain mix doesn't parse) — now single-quoted strings, en+fr
  • Inline # comments that swallowed a flow sequence's closing bracket: extensions: [.lnk, .pdf # comment] — comment moved outside, en+fr

Verification: scripted yaml.safe_load over every ```yaml block in the 5 edited files: 0 failures (8 before).

2. Phantom keys under defaults:

The "Complete Multi-Machine Setup" example (en+fr) showed columns: + column_widths: inside defaults: — Defaults (core/config/schema.py) has no such keys and silently ignored them, so users copying it got no columns and no error. Replaced with a real top-level columns: mapping (File/Version/Classification/Date, widths preserved from the old example) plus a comment explaining why keys under defaults: would do nothing.

Root cause hardened as the issue suggested: extra="forbid" on Defaults — unknown keys now raise a clear pydantic ValidationError instead of being silently dropped. Regression test TestDefaults.test_unknown_key_raises added. ⚠️ Note: this is the one behavior change in the PR — configs that previously carried junk under defaults: will now fail fast with an explicit message.

3. Dead pc_hostname advice in every generated config

core/config/template.py CONFIGS header claimed pc_hostname: All acts as a catch-all ("place it LAST") — the schema has no pc_hostname; auto-selection is match.hostname/ip/path. Rewrote the header to teach match.hostname: ["*"] + the place-last rule (matching the docs). The example blocks in the template body already used match: and are unchanged.

Test suite

1336 passed / 245 skipped / coverage 87.94%. The single failure (test_main_without_npm) reproduces on unmodified main and is unrelated to this PR.

…_hostname advice (#44)

1. Unquoted *-leading globs parse as YAML aliases and fail to load. Quoted
   every glob list in README.md, README.fr.md, configuration-profile (en/fr,
   2 blocks each) and performance-metrics-guide, and added a warning callout
   in the glob-exclusion section of both configuration-profile guides.
   Also fixed in the same spirit: filters: [, ...] sequences (null first
   item), quoted filter search-expression examples, and # comments that
   swallowed a flow sequence's closing bracket.

2. The Complete Multi-Machine Setup example put columns:/column_widths:
   under defaults: — Defaults has no such keys and silently ignored them.
   Replaced with a real top-level columns: mapping (en+fr) with a comment
   explaining why keys under defaults: would do nothing.

3. template.py still advised pc_hostname: All as catch-all; the schema has
   no such key (auto-selection is match.*). Rewrote the CONFIGS header to
   describe match.hostname: ["*"] + place-last rule. Schema examples in the
   template body already used match and are unchanged.

4. extra="forbid" on Defaults (schema.py) so unknown keys — the root cause
   of (2) — now raise a clear ValidationError instead of being silently
   ignored; regression test in tests/core/config/test_schema.py.

Verification: every yaml code block in the 5 edited docs parses (0 failures,
previously 8); full suite 1336 passed, 245 skipped, coverage 87.9%; the one
failure (test_main_without_npm) pre-exists on main and is unrelated.
@falbany
falbany merged commit 157ed40 into main Oct 31, 2026
1 check passed
@falbany
falbany deleted the fix/issue-44-config-docs branch October 31, 2026 23:15
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.

Docs: config examples with unquoted YAML globs fail to parse; phantom defaults.columns keys are silently ignored

1 participant