Skip to content

fix(provider): count directive-malformation and enum-increment as syntaxError - #588

Merged
e54-bot merged 2 commits into
mainfrom
fix/validate-edits-script-invalid-enum
Oct 18, 2026
Merged

e54-bot merged 2 commits into
mainfrom
fix/validate-edits-script-invalid-enum

Conversation

@e54-bot

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

Copy link
Copy Markdown
Contributor

Summary

Second review follow-up to #578 (after #587). Audited script-invalid and the enum-* codes against their emit sites:

  • script-invalid is document-local — all three emit sites judge the directive line's own text: #!postCompileHook without a quoted path (preprocess/directives.rs:105) and a malformed __script__(...) body in #!define (preprocess/macros.rs:141,150). The verdict is about the line's shape, not the script file — matching sibling directive-malformation codes already listed (directive-invalid, define-invalid, macro-invalid). Before this change, #!postCompileHook junk returned {"valid": true} where pre-fix(provider): scope lpp/validateEdits syntaxError to document-local malformation #578 returned syntaxError.
  • enum-increment is document-local — EnumCounter::Other keys only on the previous initializer's literal shape inside the same single-file enum block (lower/declarations.rs:246).
  • enum-type-without-member stays deferred — enum_visible consults the project-merged declaration table, so a bare name may resolve through a sibling declaration; deferral is now documented explicitly in the allowlist comment.

Test plan

  • Three new validate_edits_applies_normative_rules cases (unquoted postCompileHook, malformed __script__, non-numeric enum predecessor) — verified failing without the allowlist entries
  • cargo test -p opy-provider --test lpp — 69/69 pass (run locally)
  • cargo fmt --all -- --check, cargo clippy -p opy-provider --all-targets -- -D warnings

…taxError

Second review follow-up to #578: script-invalid (unquoted #!postCompileHook path, malformed __script__ body in #!define) is a verdict on the directive line's own text, and enum-increment only needs the same-block predecessor — both document-local, matching the list's directive-malformation siblings (directive-invalid, define-invalid, macro-invalid). enum-type-without-member stays deferred: enum_visible consults the project-merged table, so a bare name may resolve through a sibling declaration. New normative-rules cases cover all three emit sites and fail without the 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 — emit-site audit holds: all three script-invalid sites judge the directive line's own text, enum-increment needs only the same-block predecessor. enum-type-without-member correctly stays deferred (enum_visible reads the project-merged table). New cases verified failing without the entries.

@e54-bot
e54-bot merged commit e273027 into main Oct 18, 2026
6 checks passed
@e54-bot
e54-bot deleted the fix/validate-edits-script-invalid-enum branch October 18, 2026 22:28
Teakowa added a commit that referenced this pull request Oct 19, 2026
…eEdits respec (#590)

opy-rs#578's DOCUMENT_SYNTAX_CODES allowlist merged with omissions;
opy-rs#587 and #588 each found more document-local codes silently
returning valid:true. Same class twice in one day - escalated.

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