Skip to content

fix: add remaining ensureLoaded() calls missed in #1056#1059

Merged
stack72 merged 1 commit intomainfrom
fix/remaining-ensure-loaded-calls
Apr 2, 2026
Merged

fix: add remaining ensureLoaded() calls missed in #1056#1059
stack72 merged 1 commit intomainfrom
fix/remaining-ensure-loaded-calls

Conversation

@stack72
Copy link
Copy Markdown
Contributor

@stack72 stack72 commented Apr 2, 2026

Summary

  • Add vaultTypeRegistry.ensureLoaded() at the top of VaultService.fromRepository() — fixes 5 extension vault integration test failures where user-defined vault types weren't found because the registry was empty
  • Add modelRegistry.ensureLoaded() in the model validate command handler before createModelValidateDeps() — fixes 1 extension model test failure where model validate couldn't find extension model types

These are the remaining 6 regression failures from the lazy extension loading change (#1050), following the initial fix in #1056 which resolved 4 of 10.

Test Plan

  • All 4013 tests pass locally (0 failures)
  • The 6 previously failing integration tests now pass:
    • extension_vault_test.ts (5 tests): vault lifecycle, model method run with vault secrets, workflow run with vault secrets, built-in and user-defined vaults coexist, two instances of same type
    • extension_model_test.ts (1 test): model validate step

🤖 Generated with Claude Code

VaultService.fromRepository() accesses vaultTypeRegistry without loading
it first, causing all extension vault tests to fail with "Unsupported
vault type". The model validate command similarly calls
createModelValidateDeps() without loading the model registry.

Add vaultTypeRegistry.ensureLoaded() at the top of fromRepository() and
modelRegistry.ensureLoaded() in the model validate command handler.

Fixes 6 remaining regression failures from lazy extension loading.
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLI UX Review

Blocking

None.

Suggestions

None.

Verdict

PASS — This PR only adds internal ensureLoaded() calls to fix extension registry initialization order. No user-facing output, flags, error messages, or JSON shape is changed. No UX impact.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Clean, minimal fix that adds the missing ensureLoaded() calls to resolve the remaining 6 regression failures from #1050.

Blocking Issues

None.

Suggestions

  1. The modelRegistry import in model_validate.ts bypasses src/libswamp/mod.ts (importing directly from ../../domain/models/model.ts). This is a pre-existing pattern across many CLI commands (model_method_run.ts, type_describe.ts, type_search.ts, etc.) — not introduced by this PR — but worth noting as tech debt to address holistically.

DDD review: Both changes are well-placed. VaultService.fromRepository() correctly ensures its type registry is loaded within the domain service factory, and the CLI command handler follows the established application-layer pattern of loading registries before invoking domain logic.

LGTM — ship it.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial Review

Critical / High

None.

Medium

None.

Low

  1. vault_service.ts:55ensureLoaded() sits outside the try/catch block (lines 57–107).
    The try/catch gracefully degrades when vault configs are missing or invalid (logging warnings/debug instead of crashing). If ensureLoaded() throws (e.g., corrupt extension manifest, filesystem permission error during extension discovery), the error propagates uncaught from fromRepository(), which could crash the CLI instead of degrading gracefully. In practice this is unlikely since ensureLoaded() failures would indicate a fundamentally broken extension setup where crashing is arguably the right behavior — and this placement is consistent with every other ensureLoaded() call in the codebase. Noting for completeness only.

Verdict

PASS — Minimal, correct fix. Both ensureLoaded() calls are idempotent (guard clause + cached promise), follow the established pattern used across all other CLI commands and domain services, and the import of modelRegistry from ../../domain/models/model.ts is consistent with how every other CLI command imports registry singletons. The fix addresses the documented regression from #1050.

@stack72 stack72 merged commit 3127ce9 into main Apr 2, 2026
10 checks passed
@stack72 stack72 deleted the fix/remaining-ensure-loaded-calls branch April 2, 2026 16:16
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