Skip to main content
← Back to list
01Issue
BugOpenSwamp CLIPublic
AssigneesNone

Relationships

#1791 extension install serializes files[] in readdir order, producing machine-dependent reorder diffs in upstream_extensions.json

Opened by randybias · 8/22/2026

swamp extension install appears to serialize each package's files[] array in filesystem readdir order rather than a stable order. Because readdir order is a per-directory artifact that differs between machines and changes when entries are recreated, the same logical state serializes differently on different hosts — producing recurring pure-reorder diffs in extensions/models/upstream_extensions.json, merge conflicts where nobody changed anything, and bookkeeping commits carrying no information.

Observed on swamp 20260811.005918.0-sha.c8953e9e.

⚠️ Read this before trying to reproduce

A bare swamp extension install on an already-current tree is a no-op and rewrites nothing. We re-ran exactly that and the manifest sha was unchanged. The rewrite was observed after an install that actually pulled and installed packages. So the serialization appears to run on a real (re)install, not on every install invocation — consistent with both observations, but we have not isolated the trigger, and we would rather say so than hand you a repro that fails.

We are filing on the strength of the artifact below rather than a deterministic recipe, because the correspondence is specific enough to locate in code by inspection.

The evidence

Immediately after an install that did install packages (@swamp/kubernetes, @swamp/aws/route53), the manifest's files[] matched /bin/ls -f on the package directory position for position:

readdir (/bin/ls -f)        manifest files[]
namespace.ts                namespace.ts
node.ts                     node.ts
hpa.ts                      hpa.ts
secret.ts                   secret.ts
_lib                 -->    _lib/helpers.ts      <- subdirectory expanded IN PLACE, same slot
configmap.ts                configmap.ts
pvc.ts                      pvc.ts
pod.ts                      pod.ts
rbac.ts                     rbac.ts
netpol.ts                   netpol.ts

The _lib row is the part that makes this more than a coincidental prefix: the subdirectory is recursed and its contents expanded at exactly the slot _lib occupies in the readdir stream, which is what a directory walk emitting entries as it encounters them would produce. The correspondence tracks the whole list, not the first few entries.

On a different machine the same packages produce a different order, because readdir order differs — which is the mechanism behind the recurring no-op diffs.

Impact

Low severity, steady cost: reorder-only diffs on a checked-in manifest across a team, conflicts on a file nobody edited, and real changes hidden inside large reorder noise when reviewing.

Suggested fix

Sort files[] before serializing. A stable order makes the manifest a function of content rather than of the filesystem it was generated on, and the diff then means something.

Measurement by master (laptop); filed by claude-swamp.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED

Open

8/22/2026, 7:41:50 PM

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.