Skip to content

[tests] parser diff harness — parser-ts vs parser-native AST equality on fixture corpus #656

@cs01

Description

@cs01

Goal

Catch AST divergence between `src/parser-ts/` (TS compiler API, node compiler) and `src/parser-native/` (tree-sitter, self-hosted). Standalone regression gate. Pre-req for eventually retiring parser-ts.

Scope (~300-400 LOC)

  • `tests/parser-diff.test.ts` (~150) — iterate `tests/fixtures/**/*.ts`, parse with both, deep-equal normalized JSON
  • `src/parser-diff/normalize.ts` (~100) — strip `loc`/`range`, canonicalize field order, drop parser-specific metadata
  • `src/parser-diff/allowlist.ts` (~50) — known divergences w/ reason + linked issue

Behavior

  • Fail on new divergence
  • Allowlisted entries logged, not failed
  • `npm run test:parser-diff` standalone target

Expected outcome

First run likely surfaces 5-20 real divergences. Each becomes either a parser-native fix or allowlist entry linking a new bug issue.

Non-goals

  • Translation layer between parsers
  • Rewriting either parser
  • Codegen changes

Risk

Low — pure test infrastructure.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions