Skip to content

release: v3.9.1 - browser mode — consolidate node:* gating + fix… - #127

Merged
Shinrai merged 15 commits into
masterfrom
next
May 31, 2026
Merged

Shinrai merged 15 commits into
masterfrom
next

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

🚀 What's Changed

💥 Breaking Changes

No breaking changes

✨ Features

No new features

🐛 Bug Fixes

🔧 Other Changes

👥 Contributors

Shinrai and others added 15 commits May 29, 2026 16:58
…tures)

Add .github/codeql-config.yml, used via the reusable workflow's config_file input. It replicates the default paths-ignore and extends it with types/ (generated .d.mts declarations) and api_tests/ (test fixtures, incl. intentionally-invalid TS error/typegen fixtures). Removes 8 quality alerts that originated in generated / non-shipped code.
Behavior-preserving. src/lib/handlers: drop provably-redundant operands flagged as trivial-conditional / null-comparison / redundant-operation / dead-store (#53,#54,#55,#92,#94), each already annotated dead via /* v8 ignore */. helpers.cjs: remove dead initializer, use array-elision for a throwaway destructure, de-dupe ':' in a regex character class (#88,#89,#90,#97). tools/: simplify obj-truthiness guards, void-wrap the intentional materialization-trigger expression, drop an unused import (#56,#57,#60,#93,#96). Reload alert #91 (unused implForReload) is intentionally left in place: it flags a real latent bug (a forgotten ___setImpl in the eager root-key reload path), fixed on a separate branch. Verified: metadata (1508), unified-wrapper (515), api-manager suites pass; tool outputs byte-identical before/after.
…#122)

## 🚀 What's Changed

### 💥 Breaking Changes
_No breaking changes_

### ✨ Features
_No new features_

### 🐛 Bug Fixes
_No bug fixes_

### 🔧 Other Changes
- chore: resolve 14 CodeQL quality alerts (dead code, redundant guards)
(fc1b507)
- chore(ci): scope CodeQL to source (exclude generated types + test
fixtures) (ffe6fd9)



<details>
<summary>👥 Contributors</summary>

- @Shinrai

</details>
…ntext crash (#123)

Browser mode (v3.9.0) couldn't load: top-level static node:* imports across ~14 modules broke ESM parse in a browser, and once past that the first self/context access in live mode crashed dereferencing a null AsyncLocalStorage.

- platform.mjs: single source of truth for node-vs-browser host differences (isNode + lazily-imported builtins/shims + host-polymorphic loadJson). The affected modules use plain static imports from it; no node:* specifier enters the browser graph.
- Fix the live-mode crash: AsyncContextManager.tryGetContext() guards a null ALS so the runtime dispatcher's probe is browser-safe.
- Browser i18n: navigator-based detection, async setLanguageAsync, locale files exported at @cldmv/slothlet/i18n/language/*.
- engines.node >= 22 (Node 20 EOL; keeps the JSON import attribute warning-free).
- Tests: real-Chromium Playwright smoke (self/hooks/permissions/metadata/i18n/events/api.add), static loadability test, KNOWN_LOCALES drift guard, setLanguageAsync coverage.

Full Node suite green (11085/0); coverage 99.93/99.92/100/100.
Harden browser mode (shipped under-tested in v3.9.0) so context, permissions,
self, hooks (error/suppressErrors), metadata, lifecycle events, and api
mutations run in `npm run coverage`, not only the Chromium smoke. Adds a
runtime-probe fixture (context/self/caller via the live runtime) and a
browser-only v8-ignore policy note in platform.mjs.

These suites surface pre-existing eager+browser findings (api.remove and
impl:removed no-op on eager mounts; full-instance reload config guard) which
are tracked for follow-up fixes; the mutations suite's mode labels and the
two remove assertions are corrected alongside the ownership fix.
…l:removed

In eager+browser mode, api.add re-runs the eager build, and
UnifiedWrapper.___createChildWrapper derived the child moduleID from the shared
leaf functions' existing metadata. For a base leaf re-mounted at a new path that
metadata is base_slothlet, so ownership stacked the new module over base and
api.remove rolled the leaves back to base instead of deleting them — the mount
stayed readable and impl:removed never fired (lazy and node modes were
unaffected). Prefer the parent/build owner (one buildAPI builds exactly one
module's subtree).

Tests + coverage:
- browser-mutations: drop the green-pinned "FINDING" and its config-destructuring
  bug (it passed the {name,config} wrapper to browserCfg, so every standalone case
  ran eager); assert remove() clears the property across the full matrix.
- browser-events: expand impl:removed from lazy-only to the full matrix.
- Close 3 pre-existing coverage gaps to 100% statements + branches:
  eventemitter-context untrack guard (justified ignore matching its siblings),
  module-discovery dot-dir skip (add the missing .hidden-dir fixture so the
  existing test exercises line 349), typescript cache-write non-EEXIST rethrow
  (fault-injection test).
- run-all-vitest: per-file heap override for metadata-edge-cases (already solo;
  ~1.2GB peak intermittently OOM-flaked under coverage instrumentation).

Full node suite green (313 files, 0 failures); coverage 100%.
…ed config (#91)

transformConfig's browser guard rejected a null resolveModuleSpecifier, but the
config normalization stores `?? null` for "no override". reload() re-feeds the
already-normalized config into load() -> transformConfig, so a browser instance
created without a resolveModuleSpecifier (stored as null) threw
INVALID_CONFIG_BROWSER_RESOLVE_SPECIFIER_INVALID on reload. Treat null like
undefined (both mean "use the default resolver"), matching the versionDispatcher
guard at config.mjs:428 -- transformConfig is now idempotent.

browser-mutations: replace the characterization test that pinned the throw with
full-matrix assertions that reload() re-composes the api (fresh instanceID and
keepInstanceID:true), and flip the fileoverview note.
…uage consistent

PR review follow-ups:
- shutdown() ran the TS transform-cache cleanup unconditionally; `fsp` is null in a
  browser (helpers/platform), so it could TypeError in a real browser/Electron renderer.
  Guard with `isNode` to match the reload-time cleanup (slothlet.mjs:788).
- setLanguageAsync() reset translations to the bundled English defaults but only updated
  currentLanguage after the await resolved, so getLanguage() reported the stale prior
  locale while the (async, in a browser) load was pending. Set currentLanguage to "en-us"
  up front so it stays consistent with the active translations; success overwrites it.
  The browser setLanguage() branch inherits this via `void setLanguageAsync`.
The #123 consolidation added src/lib/helpers/platform.mjs and i18n setLanguageAsync but
never regenerated the checked-in declarations, so `@cldmv/slothlet/helpers/platform` had no
types/src/lib/helpers/platform.d.mts and translations.d.mts was absent. Regenerate via
`npm run build:types`; resyncs the declarations the consolidation touched. Validated with
`npm run test:types` (51 exports).
…redundant runtime axis

Browser forces the live context manager (no AsyncLocalStorage, #123), so the
browser suites' full async/live matrix was redundant: a runtime:"async" config
is silently coerced to live, re-running live configs under a misleading name.

- Add getBrowserMatrixConfigs() (live-only, mode×hooks, "_LIVE" token dropped);
  switch all 11 browser suites; drop the now-moot runtime keys in
  browser-mutations' targeted configs.
- Assert the async->live coercion explicitly, once (browser-context), instead of
  smearing a fictional "async browser" runtime across the whole matrix.
- Fix browser-context "concurrent context.run() stay isolated": it asserted an
  ALS-only invariant the live manager cannot provide (a single global
  currentInstanceID is overwritten across an await by a sibling run()). Now
  asserts live's real guarantee - sequential run() isolation with base restored
  between calls. Interleaved concurrency stays covered by the Node async (ALS)
  runtime in context/per-request-context.
- Document the boundary: LiveContextManager JSDoc + docs/CONTEXT-PROPAGATION.md;
  regenerate the context-live type declaration.

No production behavior change (context-live.mjs is JSDoc-only). Full coverage
gate: 100% statements/branches/functions/lines, 0 failures.
…g); refresh README What's New

v3.9.0 shipped browser mode (#119/#116) but never got a changelog or a README
update; v3.9.1 (this PR) had neither yet. Back-fill both and bring the README
"What's New" section current.

- docs/changelog/v3/v3.9.0.md — browser/worker mode introduction: manifest-based
  api loading (no fs), generateManifest() build-time helper, platform vs env
  split, dir->base migration, suppressFixes (C03), security/CodeQL fixes.
- docs/changelog/v3/v3.9.1.md — browser-mode hardening: #123 live-binding
  self/context crash (node:* gating consolidated into a platform helper), #91
  full-instance reload(), eager api.remove mount deletion + impl:removed, browser
  shutdown crash, i18n currentLanguage consistency; new setLanguageAsync(); Node
  minimum raised to 22 (import attributes for bundled i18n — noted, shipped as a
  patch by decision); CodeQL cleanup (#122); browser test suites + matrix sweep.
- README: Latest -> v3.9.1; Recent Releases -> v3.9.0, v3.8.0, v3.7.0, v3.6.0
  (4-entry cap per readme-whats-new rules; v3.5.1/v3.5.0 drop off).
The resolved node:* builtins in helpers/platform are `let x = null` reassigned
inside the isNode block, so tsc inferred the declared type as `null` — a TS
consumer importing e.g. `fs` saw a non-callable `null`. Annotate them `any` via
source JSDoc and regenerate declarations. Not `typeof import("node:*")`: that
would force @types/node onto every consumer (including browser) and fails the
no-extra-types export validation. (PR review)
…d import

The #123 loadability scan silently continued on an Acorn parse failure, so a
reachable module the parser can't read would be dropped from the graph walk —
hiding a potential top-level node:* import. It now collects parse failures and
asserts none, skipping only `.json` data leaves (browser-safe, not JS, can't
carry node:* imports). Also removes an unused `relative` import from the
Playwright smoke test. (PR review)
…l:removed (#126)

## 🚀 What's Changed

### 💥 Breaking Changes
_No breaking changes_

### ✨ Features
_No new features_

### 🐛 Bug Fixes
- fix(browser): guard shutdown TS-cache cleanup + keep i18n
currentLanguage consistent (#126) (e1944b1)
- fix(browser): full-instance reload() no longer throws on the
normalized config (#91) (0f478c8)
- fix(browser): eager-mode api.remove now deletes the mount + fires
impl:removed (#126) (cd9882c)
- fix: browser mode — consolidate node:* gating + fix live-mode
self/context crash (#123) (c1df5a6)

### 🔧 Other Changes
- test(browser): fail-loud loadability scan on parse errors; drop unused
import (#126) (ae96165)
- chore(types): type platform builtins as `any` instead of bare `null`
(#126) (73997bb)
- docs(changelog): add v3.9.0 (browser mode) + v3.9.1 (browser
hardening); refresh README What's New (#126) (355a5d7)
- test(browser): align context tests with live-mode reality + collapse
redundant runtime axis (#126) (52208dd)
- chore(types): regenerate declarations — add platform +
setLanguageAsync (#126) (0ebe199)
- test(browser): node-side platform:browser suites for the major systems
(#126) (76a3f99)



<details>
<summary>👥 Contributors</summary>

- @Shinrai

</details>
@cldmv-bot cldmv-bot Bot added ! release → master release Marks a pull request as a pending release — merge to publish a new version semver: patch This release contains only backwards-compatible bug fixes type: bug Something is broken or not behaving as expected type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments labels May 31, 2026
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails
npm/fsevents 2.3.2 🟢 3.1
Details
CheckScoreReason
Maintained⚠️ 00 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Binary-Artifacts🟢 10no binaries found in the repo
Code-Review🟢 3Found 7/22 approved changesets -- score normalized to 3
Packaging⚠️ -1packaging workflow not detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Security-Policy⚠️ 0security policy file not detected
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
npm/playwright 1.60.0 🟢 6.5
Details
CheckScoreReason
Maintained🟢 1030 commit(s) out of 30 and 6 issue activity out of 30 found in the last 90 days -- score normalized to 10
Code-Review🟢 9GitHub code reviews found for 29 commits out of the last 30 -- score normalized to 9
CII-Best-Practices⚠️ 0no badge detected
Vulnerabilities🟢 10no vulnerabilities detected
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 10security policy file detected
License🟢 10license file detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Packaging⚠️ -1no published package detected
Token-Permissions⚠️ 0non read-only tokens detected in GitHub workflows
Binary-Artifacts🟢 6binaries present in source code
Dependency-Update-Tool🟢 10update tool detected
Fuzzing⚠️ 0project is not fuzzed
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Branch-Protection🟢 3branch protection is not maximal on development and all release branches
npm/playwright-core 1.60.0 🟢 6.5
Details
CheckScoreReason
Maintained🟢 1030 commit(s) out of 30 and 6 issue activity out of 30 found in the last 90 days -- score normalized to 10
Code-Review🟢 9GitHub code reviews found for 29 commits out of the last 30 -- score normalized to 9
CII-Best-Practices⚠️ 0no badge detected
Vulnerabilities🟢 10no vulnerabilities detected
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 10security policy file detected
License🟢 10license file detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Packaging⚠️ -1no published package detected
Token-Permissions⚠️ 0non read-only tokens detected in GitHub workflows
Binary-Artifacts🟢 6binaries present in source code
Dependency-Update-Tool🟢 10update tool detected
Fuzzing⚠️ 0project is not fuzzed
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Branch-Protection🟢 3branch protection is not maximal on development and all release branches

Scanned Files

  • package-lock.json

@cldmv-bot

cldmv-bot Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Bundle size increased

File Raw Δ Raw Gzipped Δ Gzipped
dist/lib/builders/api-assignment.mjs 13.1 kB — 2.9 kB —
dist/lib/builders/api_builder.mjs 39.4 kB −36 B (-0.1%) ✅ 7.9 kB −30 B
dist/lib/builders/builder.mjs 1.5 kB — 798 B —
dist/lib/builders/modes-processor.mjs 37.8 kB — 6.3 kB —
dist/lib/errors.mjs 4.1 kB — 1.6 kB —
dist/lib/factories/component-base.mjs 1.3 kB — 693 B —
dist/lib/factories/context.mjs 1.0 kB — 536 B —
dist/lib/handlers/api-cache-manager.mjs 3.2 kB — 1.4 kB —
dist/lib/handlers/api-manager.mjs 50.6 kB −164 B (-0.3%) ✅ 10.3 kB −77 B
dist/lib/handlers/context-async.mjs 3.6 kB +66 B (+1.8%) 1.3 kB +19 B
dist/lib/handlers/context-live.mjs 3.5 kB — 1.3 kB —
dist/lib/handlers/hook-manager.mjs 11.2 kB — 3.1 kB —
dist/lib/handlers/lifecycle-token.mjs 959 B — 540 B —
dist/lib/handlers/lifecycle.mjs 2.2 kB — 1019 B —
dist/lib/handlers/materialize-manager.mjs 1.2 kB — 679 B —
dist/lib/handlers/metadata.mjs 12.2 kB −21 B (-0.2%) ✅ 3.2 kB −10 B
dist/lib/handlers/module-manager.mjs 9.3 kB — 3.0 kB —
dist/lib/handlers/ownership.mjs 6.3 kB — 2.1 kB —
dist/lib/handlers/permission-manager.mjs 11.3 kB — 3.2 kB —
dist/lib/handlers/unified-wrapper.mjs 62.4 kB −210 B (-0.3%) ✅ 10.8 kB −30 B
dist/lib/handlers/version-manager.mjs 14.1 kB +47 B (+0.3%) 3.6 kB +12 B
dist/lib/helpers/class-instance-wrapper.mjs 2.5 kB +37 B (+1.5%) 1.1 kB +28 B
dist/lib/helpers/config.mjs 11.1 kB +17 B (+0.1%) 3.3 kB −13 B
dist/lib/helpers/eventemitter-context.mjs 8.8 kB +63 B (+0.7%) 1.8 kB +14 B
dist/lib/helpers/generate-manifest.mjs 2.2 kB — 1.1 kB —
dist/lib/helpers/hint-detector.mjs 1.3 kB — 764 B —
dist/lib/helpers/manifest-resolver.mjs 1004 B — 611 B —
dist/lib/helpers/modes-utils.mjs 1.1 kB — 704 B —
dist/lib/helpers/module-discovery.mjs 7.5 kB −146 B (-1.9%) ✅ 2.5 kB −91 B
dist/lib/helpers/module-manifest-validator.mjs 8.2 kB −85 B (-1.0%) ✅ 1.9 kB −55 B
dist/lib/helpers/module-sort.mjs 1.0 kB — 593 B —
dist/lib/helpers/pattern-matcher.mjs 2.6 kB — 1.2 kB —
dist/lib/helpers/platform.mjs 1.6 kB +1.6 kB (+100.0%) ⚠️ 901 B +901 B
dist/lib/helpers/resolve-from-caller.mjs 3.0 kB −289 B (-8.7%) ✅ 1.3 kB −134 B
dist/lib/helpers/sanitize.mjs 7.8 kB — 2.3 kB —
dist/lib/helpers/utilities.mjs 1.7 kB — 916 B —
dist/lib/i18n/languages/de-de.json 56.4 kB — 16.1 kB —
dist/lib/i18n/languages/en-gb.json 49.8 kB — 14.0 kB —
dist/lib/i18n/languages/en-us.json 49.8 kB — 14.0 kB —
dist/lib/i18n/languages/es-es.json 56.1 kB — 15.6 kB —
dist/lib/i18n/languages/es-mx.json 56.1 kB — 15.6 kB —
dist/lib/i18n/languages/fr-fr.json 56.9 kB — 15.6 kB —
dist/lib/i18n/languages/hi-in.json 93.8 kB — 18.1 kB —
dist/lib/i18n/languages/ja-jp.json 66.9 kB — 16.5 kB —
dist/lib/i18n/languages/ko-kr.json 57.8 kB — 15.5 kB —
dist/lib/i18n/languages/pt-br.json 55.4 kB — 15.4 kB —
dist/lib/i18n/languages/ru-ru.json 65.6 kB — 16.2 kB —
dist/lib/i18n/languages/zh-cn.json 48.8 kB — 15.4 kB —
dist/lib/i18n/translations.mjs 4.1 kB +918 B (+27.7%) ⚠️ 1.6 kB +239 B
dist/lib/modes/eager.mjs 1.4 kB — 784 B —
dist/lib/modes/lazy.mjs 1.9 kB — 1021 B —
dist/lib/processors/flatten.mjs 10.0 kB — 2.4 kB —
dist/lib/processors/loader.mjs 10.1 kB −541 B (-5.0%) ✅ 3.4 kB −174 B
dist/lib/processors/type-generator.mjs 5.3 kB — 2.0 kB —
dist/lib/processors/typescript.mjs 10.7 kB — 4.0 kB —
dist/lib/runtime/runtime-asynclocalstorage.mjs 2.9 kB — 1.0 kB —
dist/lib/runtime/runtime-livebindings.mjs 2.5 kB — 941 B —
dist/lib/runtime/runtime.mjs 2.2 kB — 799 B —
dist/lib/typegen/typegen.mjs 2.1 kB — 1.0 kB —
dist/slothlet.mjs 15.6 kB −98 B (-0.6%) ✅ 4.6 kB −6 B
Total 1.11 MB +1.2 kB 298.2 kB +593 B

📊 Generated by bundle-size. Brotli sizes also measured but omitted from the table for brevity.

@Shinrai
Shinrai enabled auto-merge (squash) May 31, 2026 03:45
@Shinrai
Shinrai disabled auto-merge May 31, 2026 03:45
@Shinrai
Shinrai enabled auto-merge (squash) May 31, 2026 03:45
@Shinrai
Shinrai merged commit 928cfc1 into master May 31, 2026
33 checks passed
@cldmv-bot
cldmv-bot Bot deleted the next branch May 31, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Marks a pull request as a pending release — merge to publish a new version semver: patch This release contains only backwards-compatible bug fixes type: bug Something is broken or not behaving as expected type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: @cldmv/slothlet 3.9.0 — platform: "browser" cannot actually be loaded by a browser

1 participant