Skip to content

fix(provider): count string-entity lexer errors as validateEdits syntaxError - #587

Merged
e54-bot merged 1 commit into
mainfrom
fix/validate-edits-string-entities
Oct 18, 2026
Merged

e54-bot merged 1 commit into
mainfrom
fix/validate-edits-string-entities

Conversation

@e54-bot

@e54-bot e54-bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Review follow-up to #578 (#576): DOCUMENT_SYNTAX_CODES omitted invalid-string-entity and unknown-string-entity, the lexer/parser verdicts for malformed \&entity; escapes (crates/opy-rs/src/lexer.rs, parser/expressions.rs). The entity table is fixed vocabulary — no project context is needed — matching the constant's own criterion. Before this change, an edit introducing "\&bogus;" returned {"valid": true} where amended spec §16.3 requires syntaxError.

Also documents the intentionally deferred code classes on the allowlist (binding verdicts, merged-table duplicates, macro/script verdicts, external-file verdicts, catalog/environment verdicts) so future document-local codes are triaged consciously rather than silently absorbed by the fail-open list.

Deferred codes were audited against their emit sites: settings-not-found/translations-invalid read external files, rule-prefix-template-*/replacement-duplicate/post-compile-hook-duplicate test tables merged across includes, settings-expression evaluates constants possibly defined in siblings, script-* executes external script files, and macro-* verdicts can involve include-provided definitions.

Test plan

  • New validate_edits_applies_normative_rules assertions: unknown entity and unterminated entity both produce syntaxError; verified they fail without the allowlist entries (stash + rerun)
  • cargo test -p opy-provider --test lpp — 69/69 pass
  • cargo fmt --all -- --check, cargo clippy -p opy-provider --all-targets -- -D warnings

…axError

Review follow-up to #578: invalid-string-entity and unknown-string-entity are lexer verdicts on the document's own text — the entity table is fixed vocabulary needing no project context — so their omission from DOCUMENT_SYNTAX_CODES made an edit introducing "\&bogus;" return valid:true instead of syntaxError. Adds both codes, documents the intentionally deferred code classes on the allowlist, and covers both entity error kinds in the normative-rules test. The new assertions fail without the allowlist entries.

@Teakowa Teakowa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — the two entity codes are fixed-vocabulary lexer verdicts (lexer.rs:310-330), and the deferred-class inventory documents why binding/macro/script/external-file verdicts stay out. New assertions verified to fail without the allowlist entries.

@e54-bot
e54-bot merged commit 6dfa66f into main Oct 18, 2026
6 checks passed
@e54-bot
e54-bot deleted the fix/validate-edits-string-entities branch October 18, 2026 21:42
e54-bot added a commit that referenced this pull request Oct 19, 2026
…#593)

The DOCUMENT_SYNTAX_CODES allowlist shipped incomplete twice (#587, #588): every omission silently returned valid:true for malformed documents. Adds EXCLUDED_CODES plus NON_DIAGNOSTIC_LITERALS and a unit test scanning all kebab-case literals in ../opy-rs/src — every diagnostic code must appear in exactly one list, so a new code fails until a reviewer classifies it. The deferred classes are documented on the list itself. Fixes #591

Co-authored-by: Teakowa <git@teakowa.dev>
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.

2 participants