Skip to content

WASM check() silently accepts unsupported sourceMap option — add parse_check_options validation to match napi surface #212

Description

@dean0x

Background

crates/mds-wasm/src/lib.rs:429 exposes a check() binding that accepts a JS options object but has no parse_check_options allow-list. This means passing sourceMap: true to WASM check() is silently ignored — the option is accepted without error and has no effect.

Ledger ID: #41 (consistency-mds-wasm/src/lib.rs:429-check_accepts_sourcemap)
File: crates/mds-wasm/src/lib.rs:429, 719-741
Originating reviewer: Consistency

Problem

Why deferred from PR #196

Adding a parse_check_options allow-list on the WASM check binding introduces a new rejection path that would break direct WASM consumers currently passing sourceMap (expecting it to work or unaware it is unsupported). This is a behavior change on a binding surface that should not land immediately before a publish. The documentation half (#40) was the correct in-scope fix for this PR.

Proposed change

Add parse_check_options(opts: JsValue) -> CheckOptions in mds-wasm/src/lib.rs modeled on parse_lint_options, with an allow-list matching the documented set from packages/mds-wasm/README.md. Throw TypeError on unknown keys. Wire it into check().

Acceptance Criteria

  • parse_check_options implemented in mds-wasm/src/lib.rs with allow-list matching the documented option surface
  • Passing sourceMap: true to WASM check() throws a TypeError with a clear message
  • WASM check tests cover the rejection path
  • CHANGELOG [Unreleased] notes this as a breaking change for direct WASM consumers (if applicable)
  • @mdscript/mds universal package behavior unchanged (it already routes through napi's assertKnownKeys)

Deferred from: PR #196

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    architectureArchitectural refactoringbugSomething isn't workingecosystemBindings, packages, and integrations

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions