Skip to content

fix: degrade instead of crashing on malformed issue-list JSON in find-issue#24

Merged
wei18 merged 1 commit into
mainfrom
fix/issue-19-find-issue-degradation
Jul 7, 2026
Merged

fix: degrade instead of crashing on malformed issue-list JSON in find-issue#24
wei18 merged 1 commit into
mainfrom
fix/issue-19-find-issue-degradation

Conversation

@wei18

@wei18 wei18 commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Fixes the last remaining finding from self-audit #19 (the other 5 were fixed in #23).

src/find-issue.ts parsed its input with a bare JSON.parse(readFileSync(...)), diverging from the repo's "degradation over crashing" convention (readJsonOrNull in src/finalize.ts). CI currently masks this (the report action writes [] on gh failure), but a malformed local input would throw.

  • Extracted exported findIssueNumber(input: unknown): string — non-array/null input degrades to '' (same as "not found")
  • CLI now routes through readJsonOrNull
  • TDD: 5 new tests in test/find-issue.test.ts (failing first), suite now 27 files / 144 tests green
  • CLI exercised end-to-end via tsx: malformed → '' exit 0, missing → '' exit 0, valid → issue number

Closes #19

🤖 Generated with Claude Code

…-issue

find-issue.ts parsed its input with a bare JSON.parse, diverging from the
repo's degradation-over-crashing convention. Route it through readJsonOrNull
and an exported findIssueNumber() that treats missing/malformed/non-array
input as "no marked issue" (empty output), with tests.

Closes #19

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@wei18
wei18 merged commit 0d23979 into main Jul 7, 2026
2 checks passed
@wei18
wei18 deleted the fix/issue-19-find-issue-degradation branch July 7, 2026 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🔍 Upkeep Report

1 participant