Skip to content

fix: propagate diagnostic codes through analyze and MCP surfaces - #1210

Closed
jonkwheeler wants to merge 1 commit into
octanejs:mainfrom
jonkwheeler:fix/diagnostic-code-propagation
Closed

jonkwheeler wants to merge 1 commit into
octanejs:mainfrom
jonkwheeler:fix/diagnostic-code-propagation

Conversation

@jonkwheeler

@jonkwheeler jonkwheeler commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Slice O1 of the typed-native-styling decomposition (tracked in #1204). Re-cut from #1195 as a standalone bugfix — no dependencies.

octane analyze's thrown-failure path flattened every thrown tsrx-style-*/OCTANE_* code to OCTANE_COMPILE_ERROR (or OCTANE_PARSE_ERROR for loc-carrying analyzer errors, also misreported at 1:1), and MCP octane_compile dropped code from its diagnostic JSON entirely. The code is a diagnostic's identity — agents filter findings (--code) and search docs on it — so flattening orphans every error.

  • thrownFailure now preserves the thrown error.code and normalizes acorn-style loc.start positions.
  • octane_compile diagnostics carry code on each entry.
  • docs-meta registers kebab + SCREAMING spellings so docs search resolves a diagnostic code under either form.

Test plan

  • packages/cli/tests/analyze.test.js (10 tests)
  • website-mcp/tests/compile-tool.test.ts, website-mcp/tests/search.test.ts (website-mcp-unit project)
  • pnpm typecheck:files, pnpm format:files on touched files, pnpm sync (no output changes)
  • CI

One test from the source commit (reports collected style diagnostics under their kebab codes) moves to the O3 slice — it asserts a code the O3 analyzer emits.

Provenance

  • An agent produced this diff (agent-authored)

Re-cut mechanically from the validated diff in #1195; no redesign.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Note

Low Risk
Surfacing-only change to CLI analyze, MCP compile JSON, and docs search metadata; compiler behavior is unchanged.

Overview
Thrown compile failures now keep their real diagnostic codes instead of being collapsed to OCTANE_PARSE_ERROR / OCTANE_COMPILE_ERROR. In octane analyze, thrownFailure reads error.code when present and normalizes both acorn-style (loc.start) and flat loc so line/column stay accurate for style and other semantic throws.

MCP octane_compile error payloads include an optional code on each diagnostic, matching what agents need for --code filtering and doc lookup.

Docs search registers styling diagnostic codes in both kebab (compiler) and SCREAMING (docs) forms so queries like tsrx-style-standalone-outside-template or OCTANE_CSS_UNKNOWN_PROPERTY resolve to the styling diagnostics section.

Reviewed by Cursor Bugbot for commit fd2b13f. Bugbot is set up for automated code reviews on this repo. Configure here.

octane analyze's thrown-failure path flattened every tsrx-style-* code
to OCTANE_COMPILE_ERROR (or worse, OCTANE_PARSE_ERROR for loc-carrying
analyzer errors, also reported at 1:1); MCP octane_compile's diagnostic
JSON omitted code entirely. Agents could not see the code they need to
self-correct. Now the real code and real location propagate on both
surfaces, and docs-meta registers kebab + SCREAMING spellings so search
resolves a diagnostic under either form.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

Closing this slice draft for now: the typed-styling work is moving to an RFC first so the approach can be discussed with maintainers before asking for slice review. The branch and this re-cut remain intact; slices may be reopened or re-cut once the RFC settles the direction. Still tracked in the decomposition index (#1204).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant