Skip to content

Add CI gate: LANGUAGE_REGISTRY ↔ NATIVE_SUPPORTED_EXTENSIONS consistency #1121

@carlos-alm

Description

@carlos-alm

Background

Follow-up to #1071. The 11 WASM-only language extractors have all been ported to Rust, and a drift guard exists between the JS-side NATIVE_SUPPORTED_EXTENSIONS Set and Rust's parser_registry.rs::from_extension (see tests/parsers/native-drop-classification.test.ts — the NATIVE_SUPPORTED_EXTENSIONS drift guard describe block).

However, the gate is one layer removed from the literal acceptance criterion in #1071:

A CI gate prevents future drift: a test that fails when a JS LANGUAGE_REGISTRY entry has no corresponding Rust extractor (or an explicit allowlist of intentionally WASM-only languages).

The gap

NATIVE_SUPPORTED_EXTENSIONS in src/domain/parser.ts:434 is hand-maintained, not derived from LANGUAGE_REGISTRY. The chain looks like this:

  • LANGUAGE_REGISTRY (JS source of truth for supported languages, drives WASM parsing)
  • NATIVE_SUPPORTED_EXTENSIONS (JS-side hand-maintained mirror of the Rust enum)
  • parser_registry.rs::from_extension (Rust source of truth for native extractor coverage)

The existing drift guard covers links 2 ↔ 3. Link 1 ↔ 2 has no test. If someone adds a new WASM-only language to LANGUAGE_REGISTRY without also adding the extensions to NATIVE_SUPPORTED_EXTENSIONS and without porting a Rust extractor, no test fires — those files would silently be classified as unsupported-by-native on the native engine and only the JS WASM backfill (#967, #1068) would parse them. That's exactly the regression class #1071 was meant to prevent.

Proposal

Add a drift test that asserts every extension in LANGUAGE_REGISTRY is present in NATIVE_SUPPORTED_EXTENSIONS, with an explicit WASM_ONLY_ALLOWLIST for any intentional exceptions (currently empty). When the allowlist is empty, the test is equivalent to LANGUAGE_REGISTRY ↔ Rust extractor parity.

Suggested location: extend tests/parsers/native-drop-classification.test.ts with a new describe block, e.g. LANGUAGE_REGISTRY ↔ NATIVE_SUPPORTED_EXTENSIONS parity.

Acceptance criteria

  • New test fails if a LANGUAGE_REGISTRY entry's extensions are missing from NATIVE_SUPPORTED_EXTENSIONS (and not on the allowlist).
  • Existing tests still pass on main without modification.
  • The allowlist is documented in-code so future contributors know when to use it vs. when to port to Rust.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions