Skip to content

fix(ci): resolve pre-existing CI breakages on main - #1418

Open
olathedev wants to merge 2 commits into
Epta-Node:mainfrom
olathedev:fix/ci-pre-existing-breakages
Open

fix(ci): resolve pre-existing CI breakages on main#1418
olathedev wants to merge 2 commits into
Epta-Node:mainfrom
olathedev:fix/ci-pre-existing-breakages

Conversation

@olathedev

Copy link
Copy Markdown
Contributor

Context

While working on #1179 (stream circuit breaker), CI on that PR failed on 4 checks: JS/TS typecheck, Lint TypeScript Packages, Secret Scanning (gitleaks), and Unit Tests. Checking main's own HEAD (eb2405b) confirmed all 4 were already failing there, unrelated to that PR. This PR fixes everything that's fixable from code (3 of the 4 — gitleaks needs an org-level GITLEAKS_LICENSE secret, which isn't something a PR can supply).

What was actually broken

SDK (packages/sdk)

  • submit.ts passed the raw @stellar/stellar-sdk rpc.Server (whose methods take parsed Transaction objects) directly as TransactionQueue's rpc: RpcClient (a string-XDR interface) — a real type error that failed tsc --noEmit and build, and made every test file importing client.ts fail to even compile.
    • Added createRpcClientAdapter() in queue.ts: wraps a real RPC server behind the string-XDR RpcClient shape (parses XDR via TransactionBuilder.fromXDR, maps Api.SimulateTransactionResponse/SendTransactionResponse/GetTransactionResponse to the simpler shape TransactionQueue expects).
    • Added LinkoraClient.createRpcClient() next to the existing createRpcServer() as the public entry point; submit.ts now uses it.
  • Fixing that compile error unblocked 7 previously-uncompilable test suites, which exposed two genuine, previously-hidden test failures:
    • write.test.ts mocked Account: jest.fn() with no implementation, so new Account(...) returned {} instead of an object carrying _accountIdprepareCreatePostTx/prepareFollowTx assertions failed. Fixed the mock to return { _accountId, sequence }.
    • simulation.test.ts's "should build a transaction with multiple operations" test used a single-object simulation result, but buildMultiOpTx's own validation (added in Validate multi-op auth simulation results #1409) requires one array entry per operation. Updated the mock to result: [{ auth: [] }, { auth: [] }] — the shape the code has required since Validate multi-op auth simulation results #1409, matching the sibling test added in that same PR.

Indexer (services/indexer)

  • utils.ts was a corrupted, UTF-16-encoded file containing only a self-referencing import { extractTags } from './utils' (introduced by commit 91c15b0), unused anywhere else, and unparseable by ESLint ("File appears to be binary"). Deleted.
  • ratelimit.test.ts used inline require() for wsMaxMessageBytesFromEnv/DEFAULT_WS_MAX_MESSAGE_BYTES, tripping @typescript-eslint/no-var-requires. Switched to a static import.
  • db.ts's Database.searchPosts interface still declared q: string (required) after 91c15b0 added optional tag-based search to PostgresDatabase's implementation (q?: string; tag?: string), so search.ts's route handler failed to typecheck against the interface. Updated the interface to match the implementation.

Contracts (packages/contracts)

  • cargo fmt --check failed on unformatted code from recent commits (the upgrade-timelock changes in lib.rs, a get_pool_admins test assertion). Ran cargo fmt.
  • cargo check/clippy -D warnings failed:
    • lib.rs called validate_reporter_can_report without importing it from the validation module — added to the use list.
    • clippy flagged name.len() > 0 / symbol.len() > 0 in token-factory (clippy::len_zero) — switched to !name.is_empty() / !symbol.is_empty().
    • clippy flagged a redundant as u32 cast in lib.rs (author_posts.len() is already u32) — removed it.
  • token-factory's test.rs used an all-zero dummy_wasm_hash() as the "valid" fixture for happy-path tests, but initialize()/update_token_wasm() reject the all-zero hash by design — 3 tests failed with "token_wasm_hash must not be zero" once the compile error above was fixed and they actually ran. Changed the fixture to a non-zero placeholder ([0xAB; 32]).

Not fixed here

Secret Scanning (gitleaks) fails with "missing gitleaks license" — the Epta-Node org needs a GITLEAKS_LICENSE secret configured (see gitleaks-action's breaking-change announcement). That's an org/repo settings change, not something fixable from a PR.

Test plan

All run locally against this branch:

  • packages/sdk: pnpm typecheck, pnpm build, pnpm lint, pnpm test → 308/308 tests pass.
  • services/indexer: pnpm typecheck, pnpm lint (0 errors, pre-existing no-explicit-any warnings only), pnpm test → 332/332 tests pass (2 pre-existing skips).
  • packages/contracts: cargo fmt --check, cargo clippy -- -D warnings, cargo build --target wasm32v1-none --release -p linkora-contracts, cargo test (full suite including fuzz/invariant/model tests) → all pass.

…ature PR

These were failing on main's own HEAD (eb2405b) before this branch, silently
blocking the "typecheck, test, build" and "Unit Tests" CI jobs for every PR.

SDK (packages/sdk):
- submit.ts passed the raw @stellar/stellar-sdk rpc.Server (Transaction-typed
  methods) directly as TransactionQueue's `rpc: RpcClient` (string-XDR typed),
  a type error that made tsc --noEmit and the build fail, and made every test
  file that imports client.ts fail to even compile. Added
  createRpcClientAdapter() (queue.ts) that wraps a real RPC server behind the
  string-XDR RpcClient interface, and LinkoraClient.createRpcClient() as the
  public entry point.
- Fixing that compile error unblocked the previously-uncompilable test
  suites, which exposed two real, previously-hidden failures:
  - write.test.ts mocked `Account: jest.fn()` with no implementation, so
    `new Account(...)` returned `{}` instead of an object carrying
    `_accountId` — prepareCreatePostTx/prepareFollowTx assertions failed.
  - simulation.test.ts's "should build a transaction with multiple
    operations" test used a single-object simulation result even though
    buildMultiOpTx's own validation (added in Epta-Node#1409) requires one array
    entry per operation — updated the mock to the shape the code expects.

Indexer (services/indexer):
- utils.ts was a corrupted, UTF-16-encoded file containing only a
  self-referencing `import { extractTags } from './utils'` (introduced by
  91c15b0), unused anywhere else, and unparseable by ESLint. Deleted.
- ratelimit.test.ts used inline require() for wsMaxMessageBytesFromEnv /
  DEFAULT_WS_MAX_MESSAGE_BYTES, tripping @typescript-eslint/no-var-requires.
  Switched to a static import.
- db.ts's Database.searchPosts interface still declared `q: string`
  (required) after 91c15b0 added optional tag-based search to
  PostgresDatabase's implementation (`q?: string; tag?: string`), so
  search.ts's route handler failed to typecheck against the interface.
  Updated the interface to match.

Contracts (packages/contracts):
- cargo fmt --check failed on unformatted code from recent commits
  (upgrade-timelock lib.rs changes, a get_pool_admins test assertion).
  Ran cargo fmt.
- cargo check/clippy failed: lib.rs called validate_reporter_can_report
  without importing it from the validation module, and clippy flagged
  `.len() > 0` (token-factory) plus a redundant `as u32` cast (lib.rs)
  under -D warnings. Fixed the import and both lints.
- token-factory's test.rs used an all-zero dummy_wasm_hash() as the "valid"
  fixture for happy-path tests, but initialize()/update_token_wasm() reject
  the all-zero hash by design — 3 tests failed with "token_wasm_hash must
  not be zero". Changed the fixture to a non-zero placeholder.

Verified locally: sdk (308/308 tests, typecheck, build, lint), indexer
(332/332 tests, typecheck, lint), contracts (cargo fmt --check, clippy -D
warnings, wasm32v1-none release build, full cargo test including fuzz/
invariant suites) all pass.
@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

@olathedev is attempting to deploy a commit to the Jaja's projects Team on Vercel.

A member of the Team first needs to authorize it.

… cleared

Turborepo's task graph reached apps-web's own typecheck/test only once the
prior commit's fixes let it get that far — these are separate, apps-web-only
issues, also pre-existing on main's HEAD:

- profile/[address]/page.tsx called addToBlockedList/removeFromBlockedList
  (from lib/blockedStore.ts) without importing them, added by 4a6f8a5's
  discarded-XDR fix — a real typecheck failure (TS2304).
- lib/tx.test.ts, added by the same commit, was written against vitest
  (`from "vitest"`, `vi.mock`, `vi.fn()`) but apps-web uses Jest, which
  doesn't provide a `vitest` module — TS2307 plus three more errors from the
  untyped fallout. Converted to Jest: swapped `vi.*` for `jest.*`, and
  `jest.mock`'s synchronous factory for vitest's async
  `importOriginal`-based one (using `jest.requireActual` instead).
  Fixing the compile error surfaced two more bugs in the same file, now that
  it actually ran:
  - the `rpc.Server` mock returned a fresh mock object on every `new
    Server(...)` call, so the object tx.ts constructs internally was never
    the same one the test configured via `mockServer.sendTransaction
    .mockResolvedValue(...)` — made it return one shared instance instead.
  - `TransactionBuilder` was mocked as `{ fromXDR: jest.fn() }`, a
    non-constructable plain object, so `buildSignAndSubmit`'s `new
    TransactionBuilder(...)` threw "is not a constructor" — subclassed the
    real class instead so `new` keeps working, overriding only the static
    `fromXDR` method.
  - the test data used syntactically invalid Stellar addresses/contract ID
    ("GABC123", "CDUMMY") and a plain `{ sequence }` object standing in for
    an `Account`, all rejected by the real (unmocked) `Address`/`Contract`/
    `TransactionBuilder` once construction started working — swapped in a
    real `Keypair.random()`-derived address pair, a valid StrKey contract
    ID, and a real `Account` instance.
- jest.config.js had no rule to strip the ".js" extension from relative
  imports, so linkora-sdk's ESM-style `from "./generated/client.js"` (which
  resolves to a sibling ".ts" file at build time) failed to resolve under
  Jest, breaking every test that transitively imports the SDK client
  (Sidebars.test.tsx, DashboardPage.test.tsx). Added the standard
  `^(\.{1,2}/.*)\.js$` → `$1` moduleNameMapper rule.

Verified locally: root `pnpm typecheck` (8/8 packages), `pnpm test` (7/7
tasks, including apps-web's full 202/202 test suite and the contracts fuzz/
invariant suites), and `pnpm build` (7/7 tasks, including a full Next.js
production build) all pass.
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.

1 participant