Canary --dry-run mode, list-wasm-hashes unit tests, safe dependency bumps - #809
Open
omarima-10 wants to merge 1 commit into
Conversation
|
Deployment failed with the following error: Learn More: https://vercel.com/docs/concepts/projects/project-configuration |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@omarima-10 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
- verify-upgrade.ts: add --dry-run flag that simulates the canary deposit_collateral/withdraw_collateral calls via simulateTransaction instead of submitting them, mirroring rotate-admin.ts's dry-run pattern. Extract the canary cycle into a runCanaryCycle helper so both the live and dry-run paths are independently unit-testable. CanaryResult gains an optional simulated flag so the on-disk report records which mode produced it. - list-wasm-hashes.ts: extract the inline filtering/fallback/sort/ selection logic into pure functions in scripts/lib/list-wasm-hashes- logic.ts (filterDeployments, sortByDeployedAtDescending, selectPreviousDeployment, loadHistory), with main() reduced to a thin read-call-print wrapper. Add scripts/__tests__/list-wasm- hashes.test.ts covering env-var filtering, the zero-match fallback to full history, descending sort + previous-deployment selection, and the missing-file/empty-history process.exit(1) paths. - Bump patch/minor dependency versions flagged safe-now in the vjuliaife#461 triage: postcss (direct dep in apps/web) 8.5.14 -> 8.5.25, form-data 4.0.5 -> 4.0.6, fast-uri 3.1.2 -> 3.1.4, brace-expansion (top-level entry only) 5.0.6 -> 5.0.8, shell-quote 1.9.0 -> 1.10.0, via root-level npm overrides plus a lockfile refresh scoped to those packages. sharp is intentionally left untouched: the CVE fix requires the 0.35.x line, which falls outside next@16.2.6's declared `^0.34.5` optionalDependency range, so bumping it would force an unsupported combination rather than a clean patch. axios, next, the opentelemetry family, and the npm/pacote/sigstore/tar tooling cluster are unchanged, per the triage.
omarima-10
force-pushed
the
feat/canary-dryrun-wasm-hash-tests-safe-dep-bumps-774-776-461
branch
from
July 31, 2026 22:08
916aa87 to
b87e996
Compare
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.
closes #774
closes #776
closes #461
Summary
Three independent pieces of work, bundled into one PR since they're small and non-overlapping.
#776 —
--dry-runmode forscripts/verify-upgrade.tsAdded a
--dry-runflag to the canary deposit/withdraw cycle. SinceTariffShieldClient.depositCollateral/withdrawCollateralbuild+sign+submit in one shot with no simulate-only path,--dry-runinstead builds thedeposit_collateral/withdraw_collateraltransactions manually viaTransactionBuilder+Contract.call(...)and runs them throughSorobanRpc.Server#simulateTransaction, usingscValToNativeto read the resultingcollateral_balanceoff the simulated return value — mirroring the pattern already used byrotate-admin.ts's own--dry-run. No funds move and nothing is signed or broadcast in this mode.The balance-comparison assertions (before → after-deposit → after-withdraw) are unchanged in shape; they just run against simulated results instead of on-chain reads.
CanaryResultgained an optionalsimulated: booleanfield so the JSON report on disk records which mode produced it.Extracted the whole canary cycle (both live and dry-run branches) into an exported
runCanaryCycle(...)helper, matching howdiffAccountFields/determineOverallStatuswere already pulled out ofmain()for testability.--dry-runcombined with--skip-canarybehaves the same as--skip-canaryalone (canary doesn't run either way). Usage header comment documents the new flag.Tests added to
scripts/__tests__/verify-upgrade.test.ts: live-path pass/fail cases (deposit/withdraw balance mismatches, a rejectingdepositCollateralcall) plus dry-run-path cases (simulate pass withdepositCollateral/withdrawCollateralasserted never called, a simulated-balance-mismatch failure, asimulateTransactionerror viaisSimulationError, and the guard error whenserver/contractId/networkPassphraseare missing underdryRun: true).#774 — unit tests for
scripts/list-wasm-hashes.tsThe filtering/fallback/sort/selection logic previously lived entirely inline in
main(), with no exported seam to test against. Extracted it into pure functions in newscripts/lib/list-wasm-hashes-logic.ts:loadHistory(path)— reads + parseshistory.json, throwingDeploymentHistoryNotFoundError/EmptyDeploymentHistoryErrorinstead of callingprocess.exitdirectly (mirrors thescripts/lib/upgrade-logic.tscustom-error-class pattern already used in this repo).filterDeployments(history, { contractId, network })— filters by both, falling back to the full unfiltered history when the filter yields zero matches (existing behavior, preserved as-is).sortByDeployedAtDescending(deployments)— non-mutating descending sort.selectPreviousDeployment(sorted)— index-1 selection (index 0 is "current"),undefinedwhen fewer than 2 deployments.list-wasm-hashes.tsis now a thin wrapper: read the file, call the pure functions, print.main()is exported and gained the sameimport.meta.url === file://...direct-invocation guard the other scripts use.scripts/__tests__/list-wasm-hashes.test.tscovers: filtering bycontractIdonly,networkonly, and both combined; the fallback-to-full-history path (both when the combined filter matches nothing and when only one filter is set); descending sort correctness and non-mutation;selectPreviousDeploymentfor 0/1/2/3+ deployments;loadHistoryagainst a real temp-file fixture for the happy path, missing-file, and empty-array cases; andmain()'sprocess.exit(1)paths for both error conditions, exercised by mockingprocess.exit(not calling the real one) and pointingprocess.cwd()at a scratch temp directory viamock.method.#461 — safe-category dependency bumps
Applied the triage's category-(a) "safe now" bumps, re-verified against the actual lockfile and each dependent's declared semver range before applying (a couple didn't hold up under that check — see below):
postcss(direct dep,apps/web)^8.4.49range — lockfile refresh onlyform-dataoverridesfast-urioverrides— see note belowbrace-expansion(top-level entry only)npm update, no overrideshell-quoteoverridesTwo notes on what changed from the original triage list:
fast-uritargeted 3.1.4, not 4.1.1. The triage's proposed 4.1.1 is a major bump thatajv@8.20.0(a@commitlint/config-validatortransitive, used only by commitlint) pins to^3.0.1—4.1.1doesn't satisfy that range.3.1.4is the latest 3.x release, still satisfies ajv's range, and clears the same advisory (3.0.0 - 3.1.3) without a major-version jump.sharpis excluded from this PR. The fix requires the 0.35.x line (0.34.x has no patched release — 0.34.5 is the last one on that line), butnext@16.2.6declaressharp: "^0.34.5"as anoptionalDependency, which does not admit 0.35.x. Forcing it via override would runnext's bundled image-optimization pipeline against asharpversion outside its own declared-compatible range. Flagging as a follow-up: either wait fornextto bump its ownsharprange, or take this as a separate, deliberately-reviewed override once someone can smoke-testnext/imageagainst 0.35.x specifically.brace-expansionwas applied narrowly — only the single top-level lockfile entry (the onenpm auditactually flags at<=5.0.7) moved to 5.0.8. The several nested copies undereslint/@typescript-eslint/typescript-estree/@redocly/openapi-core/rimraf/npmstayed on their own 1.x/2.x lines untouched — those are separate major-version lines pinned by their respective parents (e.g.minimatch@3.1.5needsbrace-expansion@^1.1.7, an entirely different, incompatible API shape from the 5.x line), and a blanket override would have forced them onto 5.x and brokeneslint/lint tooling.npm audit's<=5.0.7range check is a version-string match against the package name as a whole and papers over the fact that this package has multiple concurrently-maintained major lines — those nested 1.x/2.x copies still show up innpm auditoutput post-bump, but that's an audit-noise artifact, not a real unpatched vulnerability in those lines.axios,next, the@opentelemetry/*family, and thenpm/@npmcli/*/pacote/sigstore/tartooling cluster are untouched, per the triage — those need their own scoped follow-ups.Verification
npm run test:scripts— 70/70 passing (up from 62 onmain; +8 newrunCanaryCycletests, +18 newlist-wasm-hashestests, offset by test-file consolidation elsewhere).rollback-upgrade.test.ts's 3 tests remain skipped, pre-existing and unrelated (blocked on Fix syntax error in scripts/rollback-upgrade.ts that breaks the entire rollback path #767, a syntax error inrollback-upgrade.tsthat predates this branch).npm run build—packages/sdkbuilds clean.apps/api'stscandapps/web'snext buildboth fail onmainbefore this branch too (confirmed via a stash/rebuild comparison):apps/apifails on a pre-existingsrc/migrate.tstop-level-await/module issue and a pre-existingS3_DOCUMENTS_BUCKETtype error insrc/routes/importers.ts(unrelated to thesurety_admincode path touched while investigating Optimize GET /importers surety_admin Query with JOIN to Eliminate N+1 #250);apps/webfails on a missing nativelightningcss.darwin-arm64.nodebinary in this environment, unrelated to the dependency bumps in this PR (reproduces identically withpostcssat its pre-bump version). Neither failure touches any file changed here.packages/sdklint passes clean.apps/apiandapps/weblint both have pre-existing failures onmain(unused-var errors inhealth.ts/importers.ts/kyc.ts/etc., and anext lint --max-warnings 0CLI-flag incompatibility) — confirmed pre-existing via the same stash comparison, none in files this PR touches.npm audit's raw vulnerability count is noisy across this change (it attributes advisory "effects" across whatever's in a package's dependency tree, so re-resolving a subtree can make the count jump even when nothing regresses) — the reliable signal is per-package:postcss's top-level entry,brace-expansion's top-level entry, andpicomatch's top-level entry no longer appear in any advisory'snodeslist;form-dataandfast-uriare fully clear.#250 — investigated, no code change
Re-verified the N+1 claim in #250 with a fresh read of
apps/api/src/routes/importers.ts(thesurety_adminbranch, lines 184-201) andapps/web/app/surety/page.tsx. Confirmed there's a singleJOINquery with no per-importer follow-up queries, and the frontend makes exactly two top-level requests (listImporters(),getStats()), not one per row. The existing comment on the issue already documents this accurately with file/line references: #250 (comment) — no further action needed, and no#250files are touched by this PR.