Skip to content

Commit f121f12

Browse files
committed
fix(sea): F2 round-2 — root-cause lazy-load + lint clean (DA M1)
DA round 2 findings on F2 / F4 / F3b H1 had a common root cause the team-lead correctly flagged: `SeaNativeLoader.ts` does `const native = require('../../native/sea/index.js')` at module load, so any import from this module triggers the `.node` artifact load. When `yarn build:native` hasn't run, that throws MODULE_NOT_FOUND BEFORE mocha can fire `before()` skip-gates, crashing test discovery for every e2e suite that imports anything from this module — including transitive imports via `DBSQLClient` → `SeaBackend` → `SeaNativeLoader`. Round 1 dance: every e2e test got a `createRequire` + filesystem-check workaround. Round 2 fixes the actual defect: the loader itself memoises the require behind `getSeaNative()`, so importing the module is free for code paths that never reach SEA. Filesystem-check guards in the e2e tests stay as defense- in-depth (they produce a friendlier "run yarn build:native" diagnostic than napi-rs's raw MODULE_NOT_FOUND). Verified the fix by moving the .node artifact aside and running the F2 e2e: previously CRASHED at file load with MODULE_NOT_FOUND; now SKIPS cleanly via the suite's `before()` gate with an actionable message. Restored binary, re-ran the test: passes against pecotesting in 480ms. Also addresses F2 M1 lint: - `lib/sea/SeaNativeLoader.ts:131` — added `import/extensions` to the eslint-disable comment on the lazy-require, since the `.js` extension is required (napi shim is CommonJS, not TS) - `tests/e2e/sea/complex-types-e2e.test.ts:148` — switched to destructuring `const { schema } = table` per prefer- destructuring rule Co-authored-by: Isaac Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
1 parent 8ec9069 commit f121f12

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tests/e2e/sea/complex-types-e2e.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ describe('SEA complex types — native Arrow default', function suite() {
145145
expect(batchEnvelope).to.not.equal(null);
146146

147147
const table = tableFromIPC(batchEnvelope!.ipcBytes);
148-
const schema = table.schema;
148+
const { schema } = table;
149149

150150
// Each complex column should be a native Arrow nested type, not Utf8.
151151
const arrField = schema.fields.find((f) => f.name === 'c_arr');

0 commit comments

Comments
 (0)