Repository navigation
refactor(api): flatten upgrade-config fallback and trim redundant route tests - #216
Merged
jackchuma merged 1 commit intoOct 28, 2026
Conversation
…te tests J-Engine-Session: toshi:6ddd4be7-2725-4140-9861-5e9f2e3a3e59
Collaborator
✅ Heimdall Review Status
|
Collaborator
Author
Review round 1Reviewers: cbhq-openai/gpt-6.1-sol (spec check: anthropic/claude-opus-5-5)
🤖 Reply generated with Toshi |
jackchuma
marked this pull request as ready for review
October 27, 2026 20:13
0xth4nh
reviewed
Oct 27, 2026
0xth4nh
left a comment
Contributor
There was a problem hiding this comment.
Looks Good to Thanh's Toshi
xenoliss
approved these changes
Oct 28, 2026
jackchuma
deleted the
toshi/cleanup-upgrade-config-fallback-and-api-tests-e5d83a63
branch
October 28, 2026 11:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed? Why?
Behavior-preserving cleanup of the
/api/upgrade-configand/api/upgradesroutes and their tests.upgrade-config/route.ts: the per-file map built the{ fileName, displayName, ledgerId }object twice (success return inside thetry, fallback withledgerId: 0after it). It now starts withledgerId = 0, sets it on a successful parse, warns in anelsebranch on a parse failure, keeps the read-error warn incatch, and returns one object. Warn messages,ledgerIdvalues, and response shape are unchanged.upgrades/route.ts: dropped.map(upgrade => ({ ...upgrade, network })).getUpgradeOptioninsrc/lib/deployments.tsbuilds everyUpgradefrombaseInfo, which already setsnetworkto the requested network on every return path, so the spread was a no-op in production.upgrade-configtests: the four invalid-network cases (..,foo/bar,main net,.) are oneit.eachwith all four inputs and identical assertions. Added a test for the read-error fallback (previously untested), and the parse-failure test now also checks its warn message.upgradestests: removed theincludes zeronet when aggregatingtest and itsbeforeEachdefault mock. The sort test already returns a Zeronet task and asserts it in the aggregate; its HTTP 200 assertion moved into the sort test so a success-status check remains. The tagging test now asserts only the ready-to-sign filter, since the route no longer overridesnetwork.Interfaces removed: none.
Notes to reviewers
Found by the cleanup scanner. The duplicated returns came from
7c8298a; the network spread fromdbe7f9eand was kept by4bdeedd. Nothing suggests either was added for future work.How has it been tested?
npm test(14 suites, 172 tests),npm run lint,npx tsc --noEmit,npx prettier --check srcall pass.catchwarn is removed.Why this cleanup
beforeEachmock used by one test or a tagging test implying the upgrades route rewritesnetwork.getUpgradeOptionreturn builds onbaseInfo; nothing removed points at future work; the related cleanups in two routes plus new read-error coverage are worth a quick review.