Commit Graph
13 Commits
Author SHA1 Message Date
Lauri Ojansivu 495a6faa63 Source test mode starts again: meteor/<package>/main resolves.
build.sh's source test mode (scripts/dev-source) stopped at startup with
"Cannot find module 'meteor/aldeed:collection2/main'". server/main.js loads
collection2's main module before the models (2699f4deea), and the source
runtime resolved only a bare meteor/<package>. It now maps
meteor/<package>/main to the same package exports, which image.load has
already run. tests/devSourceMainModule.test.cjs checks every such import in
the server entry resolves, and that other sub-paths are not taken for it.

Thanks to xet7 !
2026-11-16 16:46:06 +02:00
Lauri Ojansivu 15877dd1bc Source server: a local package fork that a prebuilt package implies is loaded first.
ecmascript implies the local dynamic-import fork, so compiling ddp-server,
listed before it in .meteor/versions, stopped the source-loaded server
with "isopack dynamic-import not yet loaded". The loader now loads the
local package asked for and retries. The source server still stops later,
on "Cannot find module 'meteor/accounts-base'"; the bundle server is what
the browser tests ran against.

Thanks to xet7 !
2026-11-02 00:24:55 +02:00
Lauri Ojansivu 9a118c83b2 Meteor in .tools/.meteor no longer springboards forever.
A build from the menu printed uname -p and sysctl hw.cpu64bit_capable
over and over and never reached its first package. With
METEOR_WAREHOUSE_DIR set and no SANDBOX, Meteor takes the running tool
to be wherever the warehouse's "meteor" link points - 3.5.4, the release
it was installed with - so with .meteor/release at 3.6-rc.1 every start
springboarded to 3.6.0-rc.1, found itself the wrong tool again and
springboarded again: 28 times in 20 seconds of meteor --version. The
earlier 1.1 GB build log was the same loop, its module trace printed
anew on every exec.

tools-env.sh and tools-env.bat now set SANDBOX=true beside the
warehouse, as Meteor's own self-test does; that one check is all it
changes. The Nextcloud test scripts and the dev-source runner, which set
the warehouse themselves, do the same. meteor --version now springboards
once, from the linked 3.5.4 to 3.6.0-rc.1.

tests/meteorSpringboardLoop.test.cjs checks both env scripts, that
nothing sets the warehouse without SANDBOX, and runs the installed
Meteor to count its springboards.

Thanks to xet7 !
2026-10-31 13:23:24 +02:00
Michael Nutt 22d7d23118 Measure Sandstorm startup and signal database and HTTP readiness
Add launcher timings and a local production-path profiling runner. Replace
the fixed database delay with listener readiness and notify the waiting
page through a held request. Include tests and profiling documentation.
2026-10-11 23:30:56 -04:00
Lauri Ojansivu f5836c3a37 Update pbkdf2 to 3.1.7 for GHSA-477h-4r7f-fvrx.
pbkdf2 <= 3.1.6 hashes an over-long password again on every iteration, so a
1 MiB password costs a full hash per round (CVE-2026-102414, denial of
service). 3.1.7 hashes it once.

meteor-node-stubs 1.2.30 bundles pbkdf2 3.1.3 inside its own tarball, where
npm overrides cannot reach it, and no meteor-node-stubs release bundles 3.1.7.
Instead of forking meteor-node-stubs again, WeKan now depends on pbkdf2
^3.1.7 directly and the new postinstall script
scripts/patch-meteor-node-stubs-pbkdf2.cjs removes the bundled copy, so
crypto-browserify resolves the patched top-level package, and drops the
bundled entries from package-lock.json. It fails the install if the patched
package is missing.

The vendored jade lockfile moves from pbkdf2 3.1.5 to 3.1.7.

tests/dependencySecurityUpdates.test.cjs fails when any tracked lockfile
holds pbkdf2 <= 3.1.6, flags a synthetic 3.1.3 bundled entry, and drives the
postinstall script against fixture trees.

Thanks to dependabot and xet7 !
2026-10-07 17:05:40 +03:00
Lauri Ojansivu 721805b800 Fix source development startup warnings and browser fixture cleanup
Cache Meteor package transforms, make development DEBUG logging opt-in, and replace legacy CAS URL parsing while preserving callback encoding and custom HTTPS ports. Clean attachment metadata during browser fixture teardown, including failure paths.

Verify six focused Node suites, nine sequential browser checks across Chromium, Firefox and WebKit, and live HTTP requests with deprecation tracing. Document the package cache and verification limits.

Thanks to xet7.
2026-09-20 12:25:56 +03:00
Lauri Ojansivu b104edeef1 Add source-loaded development server and sequential EVERYTHING testing
Add Dev server nobuild to both build menus with shared URL and port options. Load checkout JavaScript and templates in memory using the installed Meteor toolchain; start its bundled MongoDB on the next port and wait for owned database shutdown.

Run server, Node, import, E2E and all supported Chromium, Firefox and WebKit regressions sequentially, stopping on failure. Preserve CommonJS semantics, native fetch, dynamic import namespaces and client source access boundaries. Document verified results and the remaining Windows and intermittent Firefox limits.

Thanks to xet7 !
2026-09-20 05:37:00 +03:00
Lauri Ojansivu ec26abdc91 Bundle portable PDFKit in every release target 2026-08-30 22:40:33 +03:00
Lauri Ojansivu f4d05feb0a patch-yargs-dirname: also patch yargs-parser; register new server tests
The Mocha (server-side) test bundle crashed at boot with 0 tests run because
yargs and its ESM dependencies are dragged into the Meteor test server bundle,
where Meteor 3 wraps every module in a CommonJS function and their native-ESM
constructs (import.meta, `const __dirname`, `const require = createRequire(...)`)
are illegal and crash the bundle before any test runs.

Two gaps remained in scripts/patch-yargs-dirname.cjs:

- The `const require = createRequire(...)` removal (and its trigger) only matched
  the direct-call form. yargs-parser/build/lib/index.js uses the guarded ternary
  `const require = createRequire ? createRequire(import.meta.url) : undefined;`,
  which slipped through and crashed at boot with "Identifier 'require' has already
  been declared". Generalized the match to line-wise `const require = ...createRequire...;`.

- The scan only walked node_modules/yargs, so yargs-parser (the actual offender)
  was never patched. Broadened the scan to yargs and its ESM dependency packages.

Also register the three server test files that were present but missing from the
curated server/lib/tests/index.js (they never ran): the MimeBleed file-validation
bypass regression, the import/export privacy settings, and the impersonation report
query. Server suite now boots and runs (411 passing).

CHANGELOG Upcoming documents the bug and the two-stage debugging journey.
2026-07-14 21:02:26 +03:00
Lauri Ojansivu c21f3d86ef patch-yargs-dirname: fix createRequire mangling that broke the Mocha test build
The yargs postinstall patch expanded import.meta.url -> require('url').pathToFileURL(...)
BEFORE removing the const require = createRequire(...) call. The paren-naive removal
regex createRequire([^)]*) then stopped at the first ) of the injected require('url'),
replacing only part of the statement and leaving a dangling
  /* Meteor: use wrapper require */.pathToFileURL(__filename).href));
in yargs' esm.mjs. That is invalid JS (a leading .pathToFileURL after a comment), so
Meteor's reify parser threw 'Unexpected token (19:33)' when the test server bundle pulled
yargs in -- meteor test reported 0 tests, even though every repo source file was fine.

Fix: remove the createRequire call BEFORE expanding import.meta.url (so the injected
parens can't break the match), and add a repair rule + trigger so re-running the script
collapses the dangling leftover in already-corrupted node_modules/yargs files back to the
marker. Fresh and already-broken files both end valid.
2026-07-14 20:43:01 +03:00
Lauri Ojansivu a4c1ce3d41 meteor test: patch ALL yargs files' import.meta, not just esm.mjs
The crash moved from yargs/lib/platform-shims/esm.mjs to yargs/build/lib/utils/
apply-extends.js (import.meta.resolve(config.extends)) — yargs' ESM build has more than
one file using import.meta. Rewrite the workaround to scan the whole node_modules/yargs
tree and rewrite every ESM-only construct (import.meta.url/.resolve/.dirname/.filename,
const require = createRequire(...), and yargs' own const __dirname) to the CommonJS
wrapper equivalents in one pass, so a new yargs file can't reintroduce the boot crash.
yargs is never executed at runtime here, so only valid CommonJS parsing matters.

Thanks to xet7.
2026-07-13 14:46:01 +03:00
Lauri Ojansivu 5b0ad4d334 meteor test: also rewrite yargs esm.mjs import.meta / require for the CommonJS wrapper
Renaming only __dirname was not enough: yargs' esm.mjs also uses import.meta.url (invalid
in Meteor's CommonJS module wrapper -> 'Cannot use import.meta outside a module') and
redeclares require via createRequire(import.meta.url) (collides with the wrapper's
require). reify rewrites the file's import statements but not import.meta. Rewrite all
three to use the wrapper's __filename / __dirname / require, which yargs never actually
exercises here (it is only bundled, never called). Idempotent; also patches a file left
half-rewritten by the previous version of this script.

Thanks to xet7.
2026-07-13 14:39:17 +03:00
Lauri Ojansivu 6b409c5dad meteor test: postinstall patch renames yargs esm.mjs __dirname (fixes Mocha boot crash)
.meteorignore does not apply to node_modules under Meteor 3 / rspack (verified: the
rebuilt Mocha bundle still contained node_modules/yargs), so revert that no-op rule and
fix the actual crash instead.

Root cause (pre-existing, unrelated to app code): the whole yargs package gets pulled
into the server bundle as a transitive devDependency, and its ESM shim
node_modules/yargs/lib/platform-shims/esm.mjs declares a top-level
'const __dirname = fileURLToPath(import.meta.url)'. Meteor wraps that .mjs in a CommonJS
module function that already provides __dirname, so it collides —
'SyntaxError: Identifier __dirname has already been declared' — crashing the server
bundle at boot, which is why Mocha reported 0 tests.

Add scripts/patch-yargs-dirname.cjs, run from a package.json postinstall, which renames
yargs' local __dirname (and its .substring/.lastIndexOf uses) to __dirnameYargs so it can
no longer collide with the wrapper's. Idempotent and best-effort (never fails install);
yargs is not used at runtime here so the rename is inert for the app.

Thanks to xet7.
2026-07-13 14:14:32 +03:00