Skip to content

Use TSX grammar for JSX syntax precheck - #9

Merged
loong10k merged 1 commit into
mainfrom
feat/rust-hook-prompt-guidance
Sep 29, 2026
Merged

loong10k merged 1 commit into
mainfrom
feat/rust-hook-prompt-guidance

Conversation

@loong10k

Copy link
Copy Markdown
Contributor

lint typescript accepted .tsx files but passed them to the plain TypeScript grammar, so valid JSX could appear as a suspected syntax issue. The opt-in WASM precheck now uses the pinned TSX grammar for .tsx, reports its separate 0.4.0 schema and grammar identity, and keeps the existing TypeScript 0.3.0 path for .ts/.mts/.cts. Candidate reports also reject a source path whose extension disagrees with the claimed grammar dialect.

The TSX bytes come from the same fixed CodeGraph commit as the existing candidates; their SHA-256, upstream version, shared MIT license and ABI are pinned. This remains a local, unqualified candidate: native ESLint still has priority, zero recoveries still mean incomplete, and no release or delivery approval is claimed.

Validation: valid and invalid JSX fixtures, forged dialect rejection, pinned asset tests, Rust offline WASM load, feature-gated CLI regression, grammar status contract, Clippy with warnings denied, layering, OpenSpec strict validation, and format/diff checks passed locally. Full workspace CI is pending.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T04:30:45.847640Z ac8cfce PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@loong10k
loong10k merged commit 8c51f3d into main Sep 29, 2026
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac8cfceabb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"typescript" => [".ts", ".mts", ".cts"]
.iter()
.any(|suffix| path.ends_with(suffix)),
"tsx" => path.ends_with(".tsx"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add TSX to the candidate report schema

When a TSX syntax_precheck_candidate report is produced, this reader now explicitly accepts the tsx language and the added test treats that as valid, but schemas/syntax-precheck-candidate.schema.json still restricts both backend.language and backend.dialect to java or typescript (lines 25–26). Consequently, every TSX candidate report accepted by the Rust contract is rejected by consumers validating against the published schema; extend those schema enums to include tsx.

Useful? React with 👍 / 👎.

.unwrap_or("source.ts");
let mut report = json!({
"schema_version": "0.3.0",
"schema_version": if language == "tsx" { "0.4.0" } else { "0.3.0" },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Document the separate TSX feedback version

For a .tsx request without native context, this branch now emits eslint_local_feedback 0.4.0, but the public command documentation still says that lint typescript <file> returns TypeScript feedback 0.3.0 (README.md:184, docs/Codeguard-Command-Reference.md:13, and its Chinese counterpart). A consumer following those documented contracts will select eslint-local-feedback-v0.3.schema.json, whose version and language constants reject this output; update the command-facing documentation to distinguish .tsx 0.4.0 from .ts/.mts/.cts 0.3.0.

Useful? React with 👍 / 👎.

Comment on lines +17 to +18
"minItems": 3,
"maxItems": 3,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Version the expanded grammar manifest contract

This changes the grammar-asset-manifest:1.0.0 contract from exactly two assets to exactly three while leaving both the schema ID and schema_version at 1.0.0. The previous parse_grammar_asset_manifest implementation also required that same version with exactly two assets, so an older consumer presented with the new same-version manifest rejects it rather than recognizing a new contract; publish the expanded shape under a new version (and retain the old schema if historical manifests remain supported).

Useful? React with 👍 / 👎.

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