Skip to content

refactor(wallet): remove code that removed features left unused - #2032

Merged
alejoamiras merged 1 commit into
devfrom
quality-lows-c-a1
Nov 26, 2026
Merged

alejoamiras merged 1 commit into
devfrom
quality-lows-c-a1

Conversation

@alejoamiras

Copy link
Copy Markdown
Contributor

What changed

Retirements and moves left symbols that nothing calls. The reference sweep was re-run on dev at 93394e1e7 (the whole tree: scripts/, e2e helpers and fixtures, stories, the landing and playground, vi.mock factories, string lookups); each item below had no production reference.

  • Removed, with the tests that existed only for them: maskAddress (components/composite/send/masked-address.ts, the file goes), getChainColor (components/ui/utils.ts), readSendSlots (utils/fee-picks.ts), remapByMap (utils/full-backup-helpers.ts), humanizeErrorKind (utils/journal-state.ts), scopesEqual (packages/wallet-core/src/activity/scope.ts), OFFSCREEN_KEEPALIVE (wallet/utils/offscreen.ts; the messaging package's own private constant stays), and the unused address and symbol fields of the private AssetPricing record in utils/fee-estimation.ts (the issue named address; symbol was equally unread).
  • Auto-import typings regenerated by the Chrome build: only the three removed globals drop out of auto-imports.d.ts and .eslintrc-auto-import.json.
  • TokenSeeder's getVersion is required. Every constructor already passes one, so the never-taken chrome.runtime.getManifest() fallback goes.
  • The retired network and fpc slices' restore-error field lists go from RESTORE_ERROR_FIELDS_BY_SERVICE. normalizeBackupData refuses any backup carrying either slice (pinned by backup-migration-registry.test.ts), and no restore path records errors under either name, so no backup reaches them. Both pinned backups (stored-shapes/backups/) carry neither slice and pass unedited.
  • Tests kept on live behaviour: the Send-picks parse tests now read through the live reader readSendPicks with whole-map expectations; the restore-error projection tests that used "network" as a stand-in now use "token", which has the same field list, expectations unchanged. The one test of a network row's endpoint URL went with the entry.
  • Comments and docs: the stale "six" comments in composables/full-backup-restore.ts now name the slice-client loop without a count; wallet/services/execution/README.md says what service.ts holds (the estimate envelopes, the held-send fee question, display decoding, the create-authwit message hash). The type-roles scanner's doc comment drops the removed example name.

Left out, as the issue allows: the optional slice-name test. npm-staged @nulo-sh/* entries are untouched.

Proofs

  • No removed symbol is reached from apps/extension/tests/e2e, so no local e2e ran; the four e2e lanes in CI are the gate of record.
  • Review: one Codex pass (gpt-6.1-sol, high, read-only) over the diff, asked whether a removed symbol is still reached, whether an older backup reads differently, whether a layer or a published entry is crossed, and whether a test lost live coverage. Verdict: approve, one README nit (the authwit hash's binding differs by intent kind), fixed and verified on resume.

Validation

At b6198d28f (the head, f65151456, differs by one README line), retry 0, one at a time: bun run lint, bun run typecheck:all, bun run test (1066 files passed), bun run test:ci-gating (784 pass), packages/wallet-core tests (361 passed). The Chrome build leaves apps/extension/src/types/ clean after the regeneration.

No visible change.

Closes #1983

🤖 Generated with Claude Code

Retirements left symbols nothing calls: `maskAddress`, `getChainColor`,
`readSendSlots`, `remapByMap`, `humanizeErrorKind`, `scopesEqual`,
`OFFSCREEN_KEEPALIVE`, the restore-error field lists of the retired
network and fpc slices, and the unused fields of the fee pricing record.
The token seeder's version reader is now required, so its never-taken
manifest fallback goes. The Send-picks parse tests read through the live
reader, and the restore-error projection tests use a live service.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Extension preview build — f651514

Version 1.3.0-pr.2032 · workflow run · artifacts expire after 7 days.

Load it
  1. Download and unzip (GitHub wraps the dist/ folder in a zip).
  2. Chrome: chrome://extensions → Developer mode → Load unpacked → pick the unzipped folder.
    Firefox: about:debugging#/runtime/this-firefox → Load Temporary Add-on… → pick manifest.json.

@alejoamiras
alejoamiras merged commit 8a90f14 into dev Nov 26, 2026
65 checks passed
@alejoamiras
alejoamiras deleted the quality-lows-c-a1 branch November 26, 2026 20:13
alejoamiras added a commit that referenced this pull request Nov 26, 2026
…entry (#2033)

## What changed

The route snapshot half of #1976; the proving-backend half shipped in
#1989.

`RouteSnapshotSchema` existed twice, in
`packages/aztec-runtime/src/pxe/schemas.ts` (the PXE client's parse) and
in `apps/extension/src/wallet/services/network/spec.ts` (the network
service's RPC result). Each value list was tied to its type by `as const
satisfies readonly T[]`, which accepts a narrower list, so widening
`EndpointState` or `TransportFailure` compiled while both copies refused
the new value. #1989 could not import the schema from the
`@nulo/aztec-runtime/pxe` barrel: the popup reaches `network/spec.ts`,
and that import put the PXE and its kernel artifacts in the popup's
graph.

- **One home in a leaf entry.**
`packages/aztec-runtime/src/pxe/route-snapshot.ts`, exported as
`@nulo/aztec-runtime/pxe/route-snapshot`, holds the lists and the schema
and imports only zod and types. `pxe/schemas.ts` re-exports it, so the
client and its test keep their import. `network/spec.ts` imports it from
the leaf, and its copy goes. Nothing imported the schema from
`network/spec.ts`.
- **The schema is unannotated**, so its inferred type is exact.
`route-snapshot.test.ts` pins `z.output<typeof RouteSnapshotSchema>` to
`RouteSnapshot | null` with `expectTypeOf`. A state or failure that only
one side lists is now a compile error in `bun run typecheck:all`.
- The comment at `network/spec.ts`'s type-only barrel import now says
why values come from leaf entries. `packages/aztec-runtime/README.md`
names the entry.

## Proofs

- **Premise, at base `93394e1e7`.** With `EndpointState` widened by
`"stale"`, `tsc --noEmit` in `packages/aztec-runtime` and `vue-tsc
--noEmit` in `apps/extension` both exit 0, and both schemas refuse
`state: "stale"` while accepting `"ready"`.
- **Fix, at this head.** Widening `EndpointState` (`"stale"`) or
`TransportFailure` (`"throttled"`) makes aztec-runtime's `tsc --noEmit`
fail at `route-snapshot.test.ts` (TS2344). Unwidened, it passes. At run
time, `pxe/schemas.ts`'s export and
`NetworkMethodSchemas.getRouteSnapshot.result` are the leaf's schema
object.
- **The popup's graph does not grow.** Measured on the Chrome build: the
module scripts in `dist/chrome/src/popup/index.html`, and the bytes of
their files.

  | | module scripts | bytes |
  |---|---|---|
  | base `93394e1e7` | 177 | 4,017,361 |
  | head | 177 | 4,017,559 |

The chunk names are the same, content hashes aside, except for one
shared chunk, now named `route-snapshot` instead of `rpc-url`.
- **Stored shapes.** The route snapshot is not a stored shape.
`stored-shapes/snapshot.test.ts` passes with no new stamp.
- **Layering.** Extension → aztec-runtime is allowed by `biome.json`'s
`noRestrictedImports`. The leaf imports nothing from another workspace.
- **Review.** One Codex pass (`gpt-6.1-sol`, high, read-only) over the
diff. It was asked whether the popup's graph grows, whether a schema
accepts or refuses anything new, whether a layer is crossed and whether
the type test can pass vacuously. Verdict: approve, no findings. It
compared both base schemas with the head schema on 27 boundary cases,
and they agreed on every one.

## Validation

At this head, `81556e22a` (rebased on `dev` after #2032), retry 0, one
at a time: `bun run lint`, `bun run typecheck:all`, `bun run test` (1067
files passed), `bun run test:ci-gating` (784 pass). Before the rebase,
at the same change: both Chrome builds above and `bun run --cwd
apps/extension build-storybook`, all exit 0. No local e2e, since no
behaviour changes. The e2e lanes in CI are the gate of record.

No visible change.

Closes #1976

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

Dead code left by retirements: about ten unused functions, fields and constants

1 participant