Skip to content

chore(ci): generate the contract clients before the JS checks - #421

Merged
hpmaxi merged 18 commits into
feedbackfrom
chore/ci-clients-before-tests
Nov 2, 2026
Merged

hpmaxi merged 18 commits into
feedbackfrom
chore/ci-clients-before-tests

Conversation

@hpmaxi

@hpmaxi hpmaxi commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #420

The JavaScript checks ran before any contract was built, so the console's tests ran against a stub client, and nothing type-checked the app against the contracts. Now CI builds the Wasm and the clients first, and the JavaScript checks use them.

Changes

  • A contracts job builds the Wasm, checks it embeds no build path, and generates the clients; js downloads them, then lints, type-checks app/, app-lib/ and the harness, and tests.
  • One generator, the SDK's: npm run build:clients and the harness deploy write each client's src/ from the Wasm and compile its dist/, with no network. The asset's client comes from the SDK's built-in spec.
  • The vitest alias and vitest.clients.ts are gone.
  • npm run test and npm run typecheck stop and name any missing client source or dist/.

Numbers

Before After
Test files / tests 92 / 2,273 94 / 2,282
Whole CI run 8m22s–10m24s (5 runs) 9m29s–11m46s (5 runs)

Every earlier test name still runs. network still sets the run's length and only lost steps; it does not wait for contracts, since Scaffold rebuilds the clients there anyway. Its time moves with npm ci and the guards suite.

Test plan

  1. CI on this pull request passes.
  2. Locally: npm ci, stellar contract build && npm run build:clients, then npm run lint, npm run format:check, npm run typecheck, npm run test, npm run build -w app and npm run test:unit -w scripts/harness. All pass.
  3. Run npm run build --workspaces, then npm run typecheck again: it still passes.
  4. Delete app-lib/clients/nav_oracle/dist and run npm run typecheck: it stops and names the missing dist/index.js.

Breaking changes

None for the app. Developers run stellar contract build && npm run build:clients once before npm run test.

Drop the vitest alias that swapped every generated client for a stub.
`npm run build:clients` now writes all six clients from the local Wasm with
no network: `src/` from the SDK's generator, which the app's own build uses,
and `dist/` from the CLI's bindings for the harness. The asset's client comes
from the SDK's Stellar Asset Contract spec. `npm run test` stops with the
command to run when any client is missing.

Refs #420
Add a root `npm run typecheck` over the three workspaces. The app's script ran
plain `tsc` on a tsconfig that only references other projects, so it checked
nothing; it now runs `tsc -b`. app-lib gets its own TypeScript and a global
`Buffer` type like the app's, and its multisig tests now match the types they
use.

Refs #420
A new `contracts` job builds the Wasm, checks it embeds no build path, and
generates the TypeScript clients from it. The `js` job waits for it, downloads
that output, and adds a type check before the tests. The harness type check
moves there from the `network` job, which keeps its own Scaffold build and
does not wait.

Refs #420
@vercel

vercel Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
strata-vault-kit-app Ready Ready Preview Nov 2, 2026 8:27pm UTC

Request Review

TypeScript 6 in app-lib's own folder also became the compiler for the
generated client packages, which the network job builds and which TypeScript 6
rejects. The app's `tsc -b` now type-checks app-lib as a referenced project
instead, so app-lib needs no TypeScript of its own. The type check generates
the addresses module first, as the tests do, and both share the clients guard.

Refs #420
Every test that mocked `config/clients` built its own client object by hand.
They now mock it with one module whose fakes take their call names, arguments
and results from the generated clients, so each test names the calls it uses
and a wrong name or result shape fails the type check. The stricter types
caught a few fixtures that no longer matched the contracts: enum values, pending
changes and holder arguments.

Refs #420
The modal's 2,158-line file held the copy and status text for every action.
That content now lives in one module per section (investor, cycle,
emergency, configuration, governance, compliance) beside the shared failure
text, the admin copy helpers, the step tracker and the action types.
`TransactionModal.tsx` keeps the component and `ShareLink`, and re-exports
what callers already import from it. The code moved unchanged.

Refs #420
The 3,300-line test file now follows the component: the modal's own
behaviour stays in `TransactionModal.test.tsx`, and each section's describe
blocks move to a test file beside its module. The render helpers move to one
shared module. Test names and assertions moved unchanged; each file mocks
the same app-lib helpers the original did.

Refs #420
`build:clients` and the harness deploy now write each client's sources with
the SDK's generator, pin its stellar-sdk, and compile them to the `dist/`
the harness imports. The stellar CLI's bindings, which typed an empty
`Option` differently, are no longer generated. The guard before tests and
the type check also requires each contract client's `dist/`.

Refs #420
A client compiled by an older TypeScript can declare a reference to the
node types, which then clash with app-lib's own `Buffer` type.

Refs #420
A faked call now resolves either to a result of the contract's type or to a
transaction a write can sign, so an empty object or a missing result no
longer type-checks. Three vault roles faked as `undefined` now use the
`null` the client returns, and the test title says what it fakes.

Refs #420
Nothing downstream reads the Wasm, so the artifact carries the generated
clients alone. The harness report upload uses the same upload-artifact
release as the clients.

Refs #420
@hpmaxi
hpmaxi marked this pull request as ready for review November 2, 2026 18:12
@hpmaxi
hpmaxi requested a review from luchobonatti November 2, 2026 18:30
Comment thread scripts/lib/clients.mjs Outdated
[
...crateClients(root).flatMap((name) => [
`app-lib/clients/${name}/src/index.ts`,
`app-lib/clients/${name}/dist/index.js`,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm run test now requires each client's dist/, but generate-clients.mjs writes only src/, so that path fails the guard. Suggest checking dist/ only before typecheck, or naming build:clients in the error.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ae1aad6: npm run test now checks only src/; npm run typecheck also needs dist/, and both errors name npm run build:clients.

…t helpers

This reverts commit df89ed1. The TransactionModal split moves to its own
issue.

Refs #420
This reverts commit 908a78b. The shared typed fake moves to its own issue.

Refs #420
This reverts commit d1d371b, and removes its render helpers at the path they
were later moved to. The split moves to its own issue.

Refs #420
This reverts commit 80acc8e. The split moves to its own issue.

Refs #420
This reverts commit c9c75ec. The shared typed fake moves to its own issue.

Refs #420
`npm run test` imports only each client's `src/`, which the app's own client
generator also writes, so its guard checks only that. The guard before
`npm run typecheck` also requires each contract client's `dist/`, which the
harness imports. Both errors name `npm run build:clients`.

Refs #420
@luchobonatti
luchobonatti added this pull request to stack #430 November 2, 2026 20:50
@hpmaxi
hpmaxi merged commit a354cb5 into feedback Nov 2, 2026
10 checks passed

This branch was successfully deployed

1 active deployment
Preview — ae1aad69 Deployed Nov 2, 2026 by vercel[bot]
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.

2 participants