fix(ci): resolve pre-existing CI breakages on main - #1418
Open
olathedev wants to merge 2 commits into
Open
Conversation
…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.
|
@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.
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.
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-levelGITLEAKS_LICENSEsecret, which isn't something a PR can supply).What was actually broken
SDK (
packages/sdk)submit.tspassed the raw@stellar/stellar-sdkrpc.Server(whose methods take parsedTransactionobjects) directly asTransactionQueue'srpc: RpcClient(a string-XDR interface) — a real type error that failedtsc --noEmitandbuild, and made every test file importingclient.tsfail to even compile.createRpcClientAdapter()inqueue.ts: wraps a real RPC server behind the string-XDRRpcClientshape (parses XDR viaTransactionBuilder.fromXDR, mapsApi.SimulateTransactionResponse/SendTransactionResponse/GetTransactionResponseto the simpler shapeTransactionQueueexpects).LinkoraClient.createRpcClient()next to the existingcreateRpcServer()as the public entry point;submit.tsnow uses it.write.test.tsmockedAccount: jest.fn()with no implementation, sonew Account(...)returned{}instead of an object carrying_accountId—prepareCreatePostTx/prepareFollowTxassertions 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, butbuildMultiOpTx's own validation (added in Validate multi-op auth simulation results #1409) requires one array entry per operation. Updated the mock toresult: [{ 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.tswas a corrupted, UTF-16-encoded file containing only a self-referencingimport { extractTags } from './utils'(introduced by commit91c15b0), unused anywhere else, and unparseable by ESLint ("File appears to be binary"). Deleted.ratelimit.test.tsused inlinerequire()forwsMaxMessageBytesFromEnv/DEFAULT_WS_MAX_MESSAGE_BYTES, tripping@typescript-eslint/no-var-requires. Switched to a static import.db.ts'sDatabase.searchPostsinterface still declaredq: string(required) after91c15b0added optional tag-based search toPostgresDatabase's implementation (q?: string; tag?: string), sosearch.ts's route handler failed to typecheck against the interface. Updated the interface to match the implementation.Contracts (
packages/contracts)cargo fmt --checkfailed on unformatted code from recent commits (the upgrade-timelock changes inlib.rs, aget_pool_adminstest assertion). Rancargo fmt.cargo check/clippy -D warningsfailed:lib.rscalledvalidate_reporter_can_reportwithout importing it from thevalidationmodule — added to theuselist.name.len() > 0/symbol.len() > 0intoken-factory(clippy::len_zero) — switched to!name.is_empty()/!symbol.is_empty().as u32cast inlib.rs(author_posts.len()is alreadyu32) — removed it.token-factory'stest.rsused an all-zerodummy_wasm_hash()as the "valid" fixture for happy-path tests, butinitialize()/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-Nodeorg needs aGITLEAKS_LICENSEsecret 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-existingno-explicit-anywarnings 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.