Relationships
#3067 Search and list output follows directory iteration order in the definition, workflow, vault and output repositories
Opened by skunk-ape · 10/6/2026
Description
While fixing swamp-club#3066 (catalog backfill rows inserted in Deno.readDir order), a sweep of production readDir sites found the same unsorted-walk pattern in the other filesystem repositories. Their findAll results keep whatever order the directory listing returns, which is sorted on APFS but hash order on ext4, so the same repo lists differently per machine.
Sites where the order reaches user-visible output
- src/infrastructure/persistence/yaml_definition_repository.ts findAll(type) and collectAllDefinitions: swamp model search (src/libswamp/models/search.ts has no sort), shell completion (src/cli/completion_types.ts), and the ambiguous partial-id list in src/domain/models/model_lookup.ts.
- src/infrastructure/persistence/yaml_workflow_repository.ts findAll: swamp workflow search (src/libswamp/workflows/search.ts has no sort), report search and report get.
- src/infrastructure/persistence/yaml_vault_config_repository.ts findAll via walk: swamp vault search (src/libswamp/vaults/search.ts has no sort); serve.ts picks the first non-local vault it finds; findByName returns the first match on duplicate names.
- src/infrastructure/persistence/yaml_output_repository.ts findAll and findAllGlobalSince: model output search sorts by startedAt but ties keep walk order.
- src/infrastructure/persistence/yaml_workflow_run_repository.ts listWorkflowIds and listRunIdsInDir are unsorted; the findAll methods sort by startedAt but unstarted runs and equal timestamps keep walk order.
- src/libswamp/extensions/enumerate_pulled.ts [REDACTED-SECRET-1] and src/cli/resolve_extension_files.ts allSkillFiles return unsorted lists; src/libswamp/extensions/pull.ts listFiles sets the order of the conflict list shown to the user.
- src/infrastructure/persistence/json_telemetry_repository.ts findByDate is unsorted.
Expected
Either each repository sorts directory entries by name at every level of its walk (the fix chosen for the data repository in swamp-club#3066), or each search renderer sorts before output. Note that @std/fs walk and expandGlob do not sort either.
Impact
Cosmetic for most listings, but swamp model search, workflow search and vault search give different orders on different machines, and first-match lookups (vault findByName on duplicate names, serve non-local vault selection) can resolve differently per filesystem. No test currently fails because the existing tests sort before asserting.
Open
No activity in this phase yet.
Sign in to post a ripple.