Skip to content

Chore/sibujs hardening#37

Merged
hexplus merged 40 commits into
mainfrom
chore/sibujs-hardening
Jun 26, 2026
Merged

Chore/sibujs hardening#37
hexplus merged 40 commits into
mainfrom
chore/sibujs-hardening

Conversation

@hexplus

@hexplus hexplus commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Description

Continues the duplicate-runtime hardening from 3.3.1 by sweeping the remaining coordination singletons that fragment when a bundler loads the module twice, plus two tooling fixes. Released as 3.3.2.

  • createId() — shared counter. Duplicate copies each counted from 0 and handed out colliding ids (sibu-1 from both), breaking a11y pairing (aria-labelledby, for + id) and SSR hydration. The counter now lives on a globalThis holder (same first-copy-wins approach as the 3.3.1 reactive-core fix).
  • ssr-context — shared SSR flag/context. The AsyncLocalStorage instance + fallback store are now shared, so enableSSR() in one copy is observed by isSSR() in another — preventing client-only effects running during a server render or per-request state bleeding across copies.
  • Build: __SIBU_VERSION__ define. Added tsup.config.ts that stamps the package version, so the duplicate-runtime dev warning prints real versions (active: 3.3.2, …) instead of dev.
  • Bench harness. Rewrote the Create 10,000 effects bench (was a single un-warmed iterations: 1 shot swinging ~10→20 ms) to measure create-only cost, warmed and averaged over 12 rounds with disposal outside the timed region (~14% spread, under the gate), and regenerated the stale bench-baseline.json so bench:check is trustworthy again.

Also audited and confirmed safe: context() (instance-owned signal) and the devtools hook (globalThis). The router globalRouter singleton is fragile in principle but left as a documented follow-up (large plugins module, least-likely scenario).

Regression tests added to tests/duplicate-instance.test.ts (both fail before the fix, pass after). Version bumped 3.3.1 → 3.3.2 with CHANGELOG and docs-site version badges.

Related Issue

Closes #

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • I have read CONTRIBUTING.md
  • My code builds without errors
  • I have tested my changes
  • I have updated documentation if needed

hexplus added 30 commits March 28, 2026 15:11
@hexplus hexplus merged commit c2e095f into main Jun 26, 2026
1 check passed
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