fix(parked-tasks): reject enqueue for networks not active in networks.json - #2192
fix(parked-tasks): reject enqueue for networks not active in networks.json#2192gvladika wants to merge 2 commits into
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 3 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
WalkthroughThe parked-task enqueue paths now normalize network names and accept only networks marked active in ChangesActive network enqueue validation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
script/deploy/safe/parked-tasks.test.ts (1)
317-334: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winParameterize the two rejection cases.
Both tests create the same fake collection, assert the same error, and verify zero stored rows. Use one parameterized test table for
evmosandlocalanvil, while keeping a descriptive case label in the test name.As per coding guidelines, use parameterized tests to reduce code duplication when testing multiple scenarios.
Example table-driven form
- it('throws when the network is not in config/networks.json', async () => { - const coll = createFakeCollection() - await expectRejects( - enqueueParkedTask(coll, buildInput({ network: 'evmos' })), - /not an active network/ - ) - expect(coll.rows).toHaveLength(0) - }) - - it('throws when the network exists but is not active', async () => { - const coll = createFakeCollection() - await expectRejects( - enqueueParkedTask(coll, buildInput({ network: 'localanvil' })), - /not an active network/ - ) - expect(coll.rows).toHaveLength(0) - }) + it.each([ + ['unknown network', 'evmos'], + ['configured inactive network', 'localanvil'], + ])('rejects a %s without inserting a task', async (_caseName, network) => { + const coll = createFakeCollection() + await expectRejects( + enqueueParkedTask(coll, buildInput({ network })), + /not an active network/ + ) + expect(coll.rows).toHaveLength(0) + })🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@script/deploy/safe/parked-tasks.test.ts` around lines 317 - 334, The two rejection tests duplicate setup, assertions, and cleanup; combine them into one parameterized test covering network values evmos and localanvil. Use a table-driven test with descriptive case labels, while preserving the existing error assertion and zero-row verification for each case.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@script/deploy/safe/parked-tasks.ts`:
- Around line 320-327: Extract a pure shared network-validation helper that
normalizes the input, returns the normalized active network, and distinguishes
unknown networks from configured inactive ones with appropriate rejection
messages. In script/deploy/safe/parked-tasks.ts lines 320-327, invoke it before
building or inserting the parked-task document; in
script/deploy/safe/enqueue-parked-task.ts lines 123-136, invoke the same helper
before getParkedTasksCollection() and reuse its normalized return value.
Preserve the CLI validation before any MongoDB access and reuse existing network
utilities.
---
Nitpick comments:
In `@script/deploy/safe/parked-tasks.test.ts`:
- Around line 317-334: The two rejection tests duplicate setup, assertions, and
cleanup; combine them into one parameterized test covering network values evmos
and localanvil. Use a table-driven test with descriptive case labels, while
preserving the existing error assertion and zero-row verification for each case.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 3633f471-362f-455f-8bf4-5d308c039b60
📒 Files selected for processing (4)
.agents/commands/deprecate-contract.mdscript/deploy/safe/enqueue-parked-task.tsscript/deploy/safe/parked-tasks.test.tsscript/deploy/safe/parked-tasks.ts
…absent vs inactive Addresses CodeRabbit review on PR #2192. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Addressed in b915de5. Extracted a shared @coderabbitai review |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
git show --stat --oneline --decorate --no-renames b915de590
git diff b915de590^ b915de590 -- \
script/deploy/safe/parked-tasks.ts \
script/deploy/safe/enqueue-parked-task.ts \
script/deploy/safe/parked-tasks.test.ts \
.agents/commands/deprecate-contract.md
printf '\n== Symbol outline ==\n'
ast-grep outline script/deploy/safe/parked-tasks.ts --items all --view expanded
ast-grep outline script/deploy/safe/enqueue-parked-task.ts --items all --view expanded
ast-grep outline script/deploy/safe/parked-tasks.test.ts --items all --view expanded
printf '\n== Helper call sites ==\n'
rg -n -C 4 '\bassertActiveNetwork\s*\(' \
script/deploy/safe/parked-tasks.ts \
script/deploy/safe/enqueue-parked-task.ts \
script/deploy/safe/parked-tasks.test.tsLength of output: 15917
If you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit!
|
Which Linear task belongs to this PR?
Fixes EXSC-764
Why did I implement it this way?
The scheduled
reconcile-parked-tasksworkflow crashed withChain evmos does not exist in config/networks.jsonand aborted the entire run. The cause is a source-of-truth mismatch: the parked-task enqueue path (driven by/deprecate-contract) enumerates target networks from the deploy logs (deployments/<network>.json), which outlive a network's removal fromconfig/networks.json. A deprecated network likeevmos(a 2022 deployment) keeps its deploy log, so a facet-removal task was parked for it — but the reconcile/drain path resolves chains vianetworks.json, whereevmosno longer exists, so it threw and blocked reconciliation for every other network.evmosis one of 9 orphaned networks that have deploy logs but nonetworks.jsonentry.The fix makes
networks.jsonauthoritative at write time. The guard lives inenqueueParkedTask— the single enqueue chokepoint that already validatesprUrl/facetName— so every caller (CLI,/deprecate-contract, the future drain) is covered; it throws unless the network isstatus: 'active'inconfig/networks.json. A matching fail-fast pre-check in theenqueue-parked-task.tsCLI gives a clean exit before the Mongo connect, mirroring the existingprUrl/facetNamebelt-and-suspenders pattern. The predicate reuses the canonicalnetworksmap fromviemScriptHelpers(the samestatus === 'active'definitiongetAllActiveNetworksuses), so no new config reader is introduced. The already-parkedevmostask was separately cancelled to unblock the current run; two follow-ups (reconcile skip-and-warn resilience, and cleaning up the 9 orphaned deploy logs) are noted on the ticket and left out of this PR to keep it single-concern.Checklist before requesting a review
Checklist for reviewer (DO NOT DEPLOY and contracts BEFORE CHECKING THIS!!!)