Skip to main content
← Back to list
01Issue
BugShippedSwamp CLI
Assigneesstack72

Bundle cache fallback silently skipped when source and bundle have equal mtimes

Opened by 4chems · 4/9/2026· Shipped 4/9/2026

Description

The bundler has a fallback: if rebundling fails, use the cached bundle. That fallback is only reached when the cached file is strictly newer than all source files (bundleStat.mtime > newestSourceMtime). When both are written in the same second (e.g. source file and bundle created in the same pre-commit hook run), the check fails (> not >=), and the code falls through to attempt a rebundle — which then fails because imports are missing.

The result: every swamp invocation attempts and fails to rebundle, adds the types to result.failed, and never populates the catalog. The cached bundles exist but are never used.

Steps to Reproduce

  1. Have a local extension with valid cached .js bundles in .swamp/bundles/
  2. Ensure the source file and bundle file have the same mtime (e.g. written in the same second)
  3. Run any swamp command that loads models
  4. Observe: Failed to load user model errors, despite valid cached bundles existing on disk

Expected Behavior

The cached bundle should be used when bundleStat.mtime >= newestSourceMtime (i.e. >= not >), or the cache should be used unconditionally when required dependencies are missing.

Environment

  • swamp version: 20260409.030033.0-sha.07dae003
  • OS: macOS Darwin 25.3.0
02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPEDTRIAGE+ 2 MOREREVIEW+ 3 MOREPR_MERGEDSHIPPED

Shipped

4/9/2026, 3:01:05 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack724/9/2026, 2:20:17 PM

Sign in to post a ripple.