Skip to content

style(editor): dark-theme syntax palette + multi-issue validation report - #111

Merged
falbany merged 2 commits into
mainfrom
fix/editor-dark-syntax-and-multi-issue-validator
Nov 4, 2026
Merged

falbany merged 2 commits into
mainfrom
fix/editor-dark-syntax-and-multi-issue-validator

Conversation

@falbany

@falbany falbany commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Two independent editor fixes found while using the config editor on main.

1. Dark-theme syntax palette (f7c97d3, follows up #98)

Root cause of the bad dark-theme colors: the editor inherited CodeMirror's defaultHighlightStyle through basicSetup (fallback: true) — a light-background palette (#940 browns, #164 teals, #00c navy, #708 purple) that is nearly unreadable on the dark #1e1e1e canvas. Every YAML key, string and comment on the dark canvas was drawn with washed-out dark-on-dark colors.

Fix: a NON-fallback HighlightStyle mapping the tags the YAML parser actually emits (@lezer/yaml styleTags) onto new --app-editor-syntax-* tokens, defined in both theme blocks like every --app-editor-* token (issue #98 pattern):

Token Dark+ Light+ Applies to
--app-editor-syntax-key #9cdcfe #0451a5 keys (propertyName + definition)
--app-editor-syntax-string #ce9178 #a31515 quoted strings and plain/block scalars (tags.content)
--app-editor-syntax-comment #6a9955 #008000 comments
--app-editor-syntax-keyword #569cd6 #0000ff directives, YAML tags
--app-editor-syntax-label #4ec9b0 #267f99 anchors & aliases

var() references make the palette follow the light/dark switch automatically. @codemirror/language and @lezer/highlight are now declared direct dependencies. dist rebuilt.

2. Multi-issue validation report (01ce306)

Investigation result: the editor showed only the first error because everything was exception-based and fail-fast — validate_issues() caught a single ValueError from ConfigReader.from_content, whose pipeline (strict parse → semantic validate → Pydantic schema) raises at the first violation. Fix one error, and the next one appeared on the next Test.

Fix: new core module profiles.core.config.diagnostics — collect_config_issues(text) reports every problem without raising:

  • YAML syntax error → single issue (the ruamel parser stops there — no tree exists to validate until it's fixed; documented limitation)
  • semantic issues collected exhaustively — every unknown top-level key, every unknown extends, every cycle (validator.collect_issues; validate() keeps its fail-fast contract, implemented on top of it — DRY)
  • every Pydantic schema error with its dotted path

/api/config/validate, /save and /save-as gates now receive the full issue list; the drop-overlay path keeps from_content unchanged.

Before → after for one draft (relese: typo, bad extends, an a↔b cycle, wrong theme, search_dir: 42, negative depth):

error | relese: unknown top-level key 'relese'
error | configs.prod.extends: unknown config 'ghost'
error | configs.b.extends: inheritance cycle: a -> a -> b -> a
error | defaults.theme: Input should be 'light', 'dark' or 'auto'
error | defaults.search_dir: Input should be a valid string
error | defaults.max_search_depth: Input should be greater than or equal to 0

— previously only the first of these was displayed.

Verification

  • Web: 242 tests passed (14 files) — new syntax-palette test; tsc -b clean; dist rebuilt.
  • Python: 40 passed in the touched areas (new collect_issues + collect_config_issues suites + /validate multi-issue test). Full suite: failures unchanged in touched areas; the delta vs the Windows baseline (test_save_image_delegates_to_core_and_reports_path path separators, test_build_env_falls_back_to_node_dirs node PATH) is environmental and unrelated.
  • ruff check + ruff format clean; AGENTS.md and tests/AGENTS.md trees updated for the new module.

f.albany added 2 commits November 4, 2026 17:40


The editor inherited CodeMirror's defaultHighlightStyle through basicSetup
(fallback) - a LIGHT-background palette: dark browns (#940), teals (#164),
navy blues (#00c) and purples (#708) that are nearly unreadable on the
dark #1e1e1e canvas.

Fix: configure a NON-fallback HighlightStyle mapping the tags the YAML
parser actually emits (@lezer/yaml styleTags) onto new --app-editor-syntax-*
tokens, defined in both theme blocks like every --app-editor-* token:
- keys (propertyName + definition) -> key blue
- quoted strings + plain/block scalars (tags.content) -> string color
- comments -> comment green
- directives and YAML tags -> keyword blue
- anchors/aliases -> teal
Punctuation inherits the base text color; var() references make the
palette follow the light/dark switch automatically.

Test: syntax-highlighting token-backed test (mounted style rules carry
var(--app-editor-syntax-*), source configures the non-fallback style,
tokens defined in both theme blocks). @codemirror/language and
@lezer/highlight declared as direct dependencies. dist rebuilt. Full
web suite: 242 passed.
The editor's validator surfaced only the FIRST problem in a draft:
validate_issues() caught a single ValueError from ConfigReader.from_content,
whose exception-based pipeline (strict parse -> semantic validate ->
Pydantic schema) fails fast at the first violation. A draft with several
mistakes showed one error, was fixed, then revealed the next one.

New core module profiles.core.config.diagnostics:
- collect_config_issues(text) reports EVERY problem as
  {"severity": "error", "message": ...}, never raising:
  - YAML syntax error -> single issue (the ruamel parser stops there;
    no tree exists to validate until it is fixed)
  - semantic issues collected exhaustively (validator.collect_issues:
    every unknown top-level key, every unknown extends, every cycle)
  - every Pydantic schema error, formatted with its dotted path
    (e.g. 'defaults.search_dir: Input should be a valid string')
- validator.validate() keeps its fail-fast contract, now implemented on
  top of collect_issues (DRY); the cycle DFS also guards non-dict config
  entries instead of raising AttributeError.

server/routes/config.py: validate_issues() delegates to the collector
(display_name dropped - the editor header already names the file; the
drop-overlay path keeps ConfigReader.from_content unchanged). /validate,
/save and /save-as gates now see the full issue list.

Tests: collect_issues suite, collect_config_issues suite, /validate
multi-issue endpoint test. AGENTS.md + tests/AGENTS.md trees updated.
Subset: 40 passed; full suite green in the touched areas.
@falbany
falbany merged commit 4d8b0c1 into main Nov 4, 2026
1 check passed
@falbany
falbany deleted the fix/editor-dark-syntax-and-multi-issue-validator branch November 4, 2026 23:29
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