Relationships
#928 doctor extensions reports source-mounted bundles as unreferenced after repair
Opened by evrardjp · 7/2/2026· Shipped 7/2/2026
swamp doctor extensions --repair evicts bundle files for source-mounted extensions, but the next swamp doctor extensions --json immediately rebuilds/reports those same files as aggregateState.bundleOrphans / orphanBundleFileCount even though their catalog rows exist and are Indexed.
This makes the repair non-idempotent/noisy: local deleted-source OrphanedBundleOnly rows are fixed, but healthy source-mounted extension bundles continue to appear as orphan bundle files.
Reproduction
In a repo with source-mounted extensions configured in .swamp-sources.yaml, for example:
sources:
- path: /path/to/repo
- path: /path/to/swamp-extensions/arch-cloud-init
- path: /path/to/swamp-extensions/capability-orchestrator
- path: /path/to/swamp-extensions/maintainer-activity
- path: /path/to/swamp-extensions/pi-session-telemetry
- path: /path/to/swamp-extensions/qcow2-overlay-prep
- path: /path/to/swamp-extensions/ssh-caRun:
swamp doctor extensions --repair --json
swamp doctor extensions --jsonObserved behavior
After repair, swamp doctor extensions --json still reports overallStatus: pass, but includes bundle orphans like:
.swamp/bundles/0e898615/models/arch_cloud_init.js
.swamp/bundles/2b04d43d/models/capability_catalog.js
.swamp/bundles/2b04d43d/models/capability_plan.js
.swamp/bundles/5b22a6db/models/cloud_init_nocloud.js
.swamp/bundles/df619aa7/models/qcow2_overlay_prep.js
.swamp/bundles/26ebac94/models/maintainer_activity.js
.swamp/bundles/b01d5fc4/models/pi_session_telemetry.js
.swamp/bundles/53490ff9/models/ssh_ca.js
.swamp/report-bundles/26ebac94/reports/maintainer_briefing.js
.swamp/report-bundles/b01d5fc4/reports/pi_session_report.js
.swamp/report-bundles/53490ff9/reports/ssh_ca_inventory.jsHowever, the catalog DB has corresponding bundle_types rows for these source-mounted files, with state = Indexed and bundle_path pointing at the same .swamp/bundles/... or .swamp/report-bundles/... path.
The same run showed that deleted local source rows under extensions/ were correctly pruned: @local/local-infra@0.0.0 went from 5 OrphanedBundleOnly rows to 0. The remaining report is specifically about source-mounted extension bundle files.
Expected behavior
Once doctor extensions --repair runs, a subsequent doctor extensions --json should be clean/idempotent for source-mounted extension bundles that are referenced by Indexed catalog rows.
Either:
- do not report source-mounted extension bundles as
bundleOrphanswhen a catalog row references the same bundle path, or - if repair intentionally removes them, do not immediately recreate/re-report them as unreferenced bundle files on the next scan.
Environment
- Swamp version:
20260702.205250.0-sha.1ba549d7 - Command:
swamp doctor extensions --repair --json, followed byswamp doctor extensions --json - Affected component: extension doctor aggregate/bundle orphan detection and repair for source-mounted extensions
Suggested fix area
This likely affects the extension doctor aggregate-state logic that computes bundleOrphans and/or the repair logic that evicts unreferenced bundle files. The fix should make bundle orphan detection use the same normalized bundle paths and source-mounted catalog rows that the extension loader writes, so healthy source-mounted bundles are not treated as unreferenced.
Shipped
Click a lifecycle step above to view its details.