Skip to content

fix(parsers): keep each ParseFailure constructor's kind in its return type - #10746

Merged
morluto merged 1 commit into
mainfrom
fix/parse-failure-kind-types
Nov 15, 2026
Merged

morluto merged 1 commit into
mainfrom
fix/parse-failure-kind-types

Conversation

@morluto

@morluto morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Summary

main fails typecheck: src/javascript/sourceMaps/SourceMapFormat.ts(95,3): error TS2375: Type 'ParseFailureError<ParseFailureKind>' is not assignable to type 'ParseFailureError<"malformed">'. #10690 (source maps through ParseFailure) relies on malformedInput returning ParseFailureError<"malformed">; #10602, merged after it, widened every ParseFailure constructor's return type to ParseFailureError when it added the cause option. Each PR was green on its own base.

This restores the kind in the owner's return types: failureWith is generic over the failure kind, and malformedInput, truncatedInput, unsupportedInput and decodeLimit each return ParseFailureError of their own kind.

Problem and expected behavior

A constructor that always builds one kind should say so in its type, so callers that type a result by kind (as sourceMapSectionOverlap does) compile. Expected: npm run check:fast passes on main.

Change and scope

  • src/domain/parseFailure.ts only. No runtime change; the narrower types are assignable wherever ParseFailureError was expected.
  • Not included: any change to SourceMapFormat.ts; its declared type was correct.
  • Contribution scope: not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/domain/parseFailure.ts constructor types.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Base reproduction: npm run check:fast on origin/main fails with the TS2375 error above.
  • Tests added or updated: none; the typecheck is the regression check.

Validation performed

  • npm run check:fast on origin/main: failed with TS2375 at SourceMapFormat.ts(95,3).
  • npm run check:fast with this change: passed.
  • npm run test:local -- src/domain/parseFailure.test.ts: 14 passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: none.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T02:08:02.011488Z 4a74fc0 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.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

Preserves each parser failure constructor’s specific kind in its return type.

  • Parse-failure constructors keep their own kind in the return type.

Reviews (1) · Last reviewed commit: "fix(parsers): keep each ParseFailure con..." · Reviewed by Greptile

@morluto
morluto merged commit 59cd555 into main Nov 15, 2026
7 checks passed
@morluto
morluto deleted the fix/parse-failure-kind-types branch November 15, 2026 02:14
@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant