Skip to content

Restore the missing matched text derivation regression from PR 133 #151

Description

@shouze

Parent epic: #146

Context and problem

Pull request 133 introduced a helper to derive the matched segment text from the fragment and its indices when GitHub omits the text field in a text match segment. The current code in src/api.ts still defaults to an empty string in that case, suggesting this fix was lost or never merged on this branch.

Solution

  • Reintroduce the segment text derivation helper in src/api.ts and use it in the mapping performed by fetchAllResults().
  • Add the corresponding regression test.

Acceptance criteria

  • A test in src/api.test.ts simulates a text match segment without a text field and asserts the derived value equals the fragment sliced at the given indices.
  • The matched text appears correctly in the JSON output for this case, covered in src/output.test.ts.

Definition of done

  • bun test passes, including the new regression test
  • bun run lint, bun run format:check, bun run knip pass
  • bun run build.ts compiles

Files

  • src/api.ts
  • src/api.test.ts

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions