Skip to content

refactor(deployments): remove unreachable try/catch in README parsing - #219

Merged
jackchuma merged 1 commit into
mainfrom
toshi/cleanup-deployments.ts-dead-try/catch-cf698742
Oct 30, 2026
Merged

jackchuma merged 1 commit into
mainfrom
toshi/cleanup-deployments.ts-dead-try/catch-cf698742

Conversation

@jackchuma

@jackchuma jackchuma commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

What changed? Why?

Removes dead error handling in src/lib/deployments.ts:

  • extractDescription and parseExecutionStatus wrapped pure string operations (replace, match, split, trim, toUpperCase, includes) in try/catch. Their only input is the UTF-8 string from fs.readFileSync(readmePath, 'utf-8'), so the catches (log + DEFAULT_DESCRIPTION / {}) could not run. Both blocks are removed.
  • parseExecutionStatus returned { status?: TaskStatus } only to carry an optional value. It now returns TaskStatus | undefined, and its single caller in getUpgradeOption reads it directly.
  • The try/catch around readFileSync in getUpgradeOption stays, since filesystem reads can throw.

Interfaces removed: none. parseExecutionStatus and extractDescription are module-private; grep -rnw parseExecutionStatus finds one caller. The returned Upgrade objects are identical for every input, including status: undefined when no status line exists.

Notes to reviewers

Parsing rules, regexes, and output are unchanged; the diff is mostly re-indentation. The catches date to the initial commit and the later refactor (#89); neither marks them for future work.

How has it been tested?

  • Added one test pinning the DEFAULT_DESCRIPTION fallback when a README has no descriptive text (previously unpinned). Existing tests already pin all four status outcomes; their assertions are unchanged.
  • npx tsc --noEmit, npm test (155 passed), npm run lint, and prettier --check on changed files pass.

Why this cleanup

  • Production (src/lib/deployments.ts): +34 / -44, net -10 (mostly re-indentation). Tests: +10 / -0.
  • Interfaces removed: none (both helpers are module-private).
  • A reader no longer has to work out whether these string helpers can fail, why one logs with warn and the other with error, or why parseExecutionStatus returns an object holding one optional field (left over from when it also parsed execution links, removed in chore: refactor deployments.ts #89).
  • Keep gate judge: behavior is identical for every input; it bundles two unreachable catch blocks and one leftover wrapper in the same file, which matches the dead-code and forwarding-wrapper rules.

Co-authored-by: Toshi <toshi-noreply@coinbase.com>
J-Engine-Session: toshi:48730781-0550-4f0a-b9b4-4e8202fae8a7
@cb-heimdall

cb-heimdall commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Heimdall Review Status

Requirement Status More Info
Reviews ✅ 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@jackchuma
jackchuma marked this pull request as ready for review October 30, 2026 00:51
@jackchuma
jackchuma requested review from 0xth4nh and xenoliss October 30, 2026 00:51
@jackchuma
jackchuma merged commit 2addf67 into main Oct 30, 2026
6 checks passed
@jackchuma
jackchuma deleted the toshi/cleanup-deployments.ts-dead-try/catch-cf698742 branch October 30, 2026 14:17
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.

3 participants