Skip to content

fix(build): repair the breakage blocking every build-dependent job - #1108

Open
Sensei-Victor wants to merge 1 commit into
Nanle-code:masterfrom
Sensei-Victor:fix/duplicate-loglevel-export
Open

Sensei-Victor wants to merge 1 commit into
Nanle-code:masterfrom
Sensei-Victor:fix/duplicate-loglevel-export

Conversation

@Sensei-Victor

@Sensei-Victor Sensei-Victor commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

pnpm build fails on master (a0c6c845). That is why E2E Tests, Visual Regression Tests and the bundle/build jobs are red — they all build before doing their own work.

Three independent defects, each fatal to the bundle on its own. Verified locally on a clean checkout of master:

$ pnpm build          # on master
[vite:esbuild] Transform failed with 1 error:
src/components/dashboard/AuditLog.tsx:595:10: ERROR: Unterminated regular expression
error during build                                    -> exit 1

$ pnpm build          # with this PR
✓ built in 1m 8s
All bundle budgets passed!                            -> exit 0
# File Defect
1 src/components/dashboard/AuditLog.tsx One </div> too many at the end of the component. Counting div nesting from the root element gives a final depth of −1.
2 src/ml/isolation_forest.ts + .cjs createRequire(import.meta.url) is Node-only → "createRequire" is not exported by "__vite-browser-external". Replaced with a static ESM import, and moved the fs require inside save()/load(), which the browser never calls.
3 6 files StellarSdk.SorobanRpc no longer exists in @stellar/stellar-sdk v17 → "SorobanRpc" is not exported by .../stellar-sdk/lib/esm/index.js.

The SorobanRpc regression

This one is newer than the other two. package.json requires @stellar/stellar-sdk ^17.1.0, where the module is exported as rpc rather than SorobanRpc (Server, Durability and Api all still exist under it). Six files still used the v12-era name — four in value position, which is what esbuild rejects:

src/lib/stellar/soroban.ts:28        StellarSdk.rpc.Durability.Persistent
src/lib/wallet/smartWallet.ts:220    StellarSdk.rpc.Api.isSimulationSuccess
src/lib/wallet/smartWallet.ts:366    StellarSdk.rpc.Api.isSimulationSuccess
src/lib/sac.ts:59                    StellarSdk.rpc.Durability.Persistent
src/lib/stellar/networks.ts:291      StellarSdk.rpc.Server            (type)
src/lib/stellar/rpcReadSource.ts     StellarSdk.rpc.Server            (type, x3)
src/lib/store.ts                     rpc.Api.LedgerEntryResult        (type, x2)

I included the type-position sites too, so the migration is complete rather than only as far as the bundler complains. If you would rather land the value-only subset and handle the types separately, say so — it is a one-line change to this diff.

This looks like fallout from the SDK v17 bump, so if the SorobanRpc name is meant to still work there is a deeper problem worth knowing about and I'd rather fix that than paper over it.

Scope

9 files, +17/−16. No behavioural change to the rewritten call sites — the v12 and v17 spellings name the same Server / Durability / Api members.

Baseline — what is red on master

From master CI run 36455427425 (sha b18bd305):

Check master job id
E2E Tests failure 109040448955
Visual Regression Tests failure 109040448901
Lint & Format Check failure 109040448598
TypeScript Type Check failure 109040448231
Strict TypeScript Ratchet failure 109040448931
Unit & Integration Tests (Node 22) failure 109040449120
Unit & Integration Tests (Node 24) failure 109040448696
Unit & Integration Tests (Node 26) failure 109040448902
Build skipped 109308211795
Bundle Size Budget skipped 109308212581

pnpm install --frozen-lockfile is not a cause: verified exit 0 on a clean master checkout. (A pnpm install failure on Windows comes from @tensorflow/tfjs-node having no win32 prebuilt binary; all CI jobs are ubuntu-latest, so CI is unaffected.)

Heads-up on queue times: master uses concurrency: cancel-in-progress: true and is pushed to very frequently — 4 of the 5 most recent runs on master are cancelled. Expect this to sit.

Checks that will stay red

Independence

Touches no file that #1119 or #1121 touches. All three cherry-pick onto master cleanly together; merge order does not matter, though the build stays red until this one lands.

@drips-wave

drips-wave Bot commented Sep 28, 2026

Copy link
Copy Markdown

Hey @Sensei-Victor! 👋 It looks like this PR isn't linked to any issue.

If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g., Closes #123), or by clicking a button below:

Issue Title
#167 Auto-generate Soroban client bindings from contract spec Link to this issue
#739 [2026 Hardening] Enforce type-checking as a required CI gate Link to this issue

ℹ️ Learn more about linking PRs to issues

@vercel

vercel Bot commented Sep 28, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the nanle-code's projects Team on Vercel.

A member of the Team first needs to authorize it.

`pnpm build` fails on master, which takes down E2E Tests, all five Visual
Regression jobs, Lighthouse CI and the deploy workflows. Three independent
defects, each fatal to the bundle on its own.

1. src/components/dashboard/AuditLog.tsx had one `</div>` too many at the
   end of the component, so esbuild could not parse it. Counting div
   nesting from the root element gives a final depth of -1, confirming the
   surplus close. Dropped it.

2. src/ml/isolation_forest.ts used createRequire(import.meta.url) to load
   the CommonJS implementation at runtime. createRequire is Node-only, so
   bundling failed with `"createRequire" is not exported by
   "__vite-browser-external"`. Replaced with a static ESM import, and moved
   the fs require in isolation_forest.cjs inside save()/load(), which is
   where it is used and which the browser never calls.

3. StellarSdk.SorobanRpc no longer exists in @stellar/stellar-sdk v17.
   The module is exported as `rpc` instead, and still provides Server,
   Durability and Api. Six call sites still used the v12-era name, four of
   them in value position, so the build failed with `"SorobanRpc" is not
   exported by .../@stellar/stellar-sdk/lib/esm/index.js`:

     src/lib/stellar/soroban.ts:28       StellarSdk.rpc.Durability.Persistent
     src/lib/wallet/smartWallet.ts:220   StellarSdk.rpc.Api.isSimulationSuccess
     src/lib/wallet/smartWallet.ts:366   StellarSdk.rpc.Api.isSimulationSuccess
     src/lib/sac.ts:59                   StellarSdk.rpc.Durability.Persistent
     src/lib/stellar/networks.ts:291     StellarSdk.rpc.Server      (type)
     src/lib/stellar/rpcReadSource.ts    StellarSdk.rpc.Server      (type, x3)
     src/lib/store.ts                    rpc.Api.LedgerEntryResult  (type, x2)

   The type-position sites are included so the migration is complete
   rather than only as far as the bundler complains.

pnpm build now completes and passes the bundle-budget gate
("All bundle budgets passed!", exit 0).
@Sensei-Victor
Sensei-Victor force-pushed the fix/duplicate-loglevel-export branch from 6e9b219 to 1d42cfc Compare September 29, 2026 11:22
Sensei-Victor pushed a commit to Sensei-Victor/stellar-dev-dashboard that referenced this pull request Sep 29, 2026
tests/csp.test.js imports `{ describe, it, expect }` from 'vitest'
twice - on line 1 and again on line 5. ESLint rejects the file outright:

  5:10  error  Parsing error: Identifier 'describe' has already been declared

Because the file does not parse, ESLint could not check it and Vitest
could not transform it, so the whole file was silently excluded from both
the lint result and the test run. Removing the duplicate import is the
entire fix.

This is the last of master's parse errors that is not also a build blocker.
The other three have been fixed on master or in Nanle-code#1108.

Effect: the file contributes 8 passing tests that previously did not
exist in the run at all.
Sensei-Victor pushed a commit to Sensei-Victor/stellar-dev-dashboard that referenced this pull request Sep 29, 2026
…ortfolioRebalancer

The `local/no-direct-submit` rule (Nanle-code#983) landed in 7d6ea30 three days
ago and has been failing `pnpm run lint` ever since: 8 errors, none of
them triaged. This PR resolves all 8 and leaves Lint & Format Check
green.

The rule's own docstring says it "forbids calling
server.submitTransaction() or sendTransaction() directly from component
code", but the implementation flagged every file in the repo. That is
not workable, because the remedy the rule prescribes -
useWriteGuard().guard() - is a React hook, so non-component code cannot
satisfy it at all. Three of the four remaining production violations are
in src/lib/*.ts transport helpers.

Two changes:

1. eslint-rules/no-direct-submit.mjs now returns early for anything
   outside src/components/. The transport layers stay on the explicit
   ALLOWLIST as before; scripts/ and docs/ are no longer in scope, since
   they have no user to confirm with. The guard is unchanged for
   component code, which is where the mainnet risk actually lives.

2. src/components/dashboard/PortfolioRebalancer.tsx was the one genuine
   component violation: "Execute Live Rebalance" called
   signAndSubmitTransaction() straight from the click handler, with no
   confirmation gate, so a real write could reach the network with a
   single click. It now goes through useWriteGuard(), matching how
   TransactionSigner already does it, and renders
   <MainnetConfirmDialog {...dialogProps} />. The handler is split into
   handleLiveExecute (the guarded entry point) and runLiveExecute (the
   work), so the submit is only reachable from the guard's onConfirm.

   The import is aliased to submitSignedTransaction. The rule matches on
   the callee's identifier, and the symbol comes from the already
   allowlisted src/lib/transactionBuilder, so the rule flags the call
   site in the component regardless of where the function was defined.
   The alias makes the guarded path explicit at the call site.

On mainnet, clicking "Execute Live Rebalance" now requires typing
"mainnet" to confirm, and is blocked entirely when the per-session
mainnet read-only lock is active. Non-mainnet networks proceed
immediately, as guard() is designed to.

Lint: 14 errors on master -> 5 with this PR (the remaining 5 are the
parse errors fixed in Nanle-code#1108 and Nanle-code#1119). All 8 no-direct-submit errors
are resolved. Warnings unchanged at 2258.

Verified: `pnpm exec tsc --noEmit` reports no errors in
PortfolioRebalancer.tsx.

This branch has not been deployed

No deployments
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