Skip to content

fix: add missing ensureLoaded() calls for lazy extension registries#1056

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

fix: add missing ensureLoaded() calls for lazy extension registries#1056
stack72 merged 1 commit intomainfrom
fix/missing-ensure-loaded-calls

Conversation

@stack72
Copy link
Copy Markdown
Contributor

@stack72 stack72 commented Apr 2, 2026

Summary

PR #1050 converted all type registries (modelRegistry, vaultTypeRegistry, etc.) from eager loading at CLI startup to lazy loading via setLoader() / ensureLoaded(). However, three commands and tab completion were missed, causing user-defined extensions from extensions/models/ and extensions/vaults/ to not be discovered.

Fixes:

  • model method describe — added modelRegistry.ensureLoaded() before createModelMethodDescribeDeps
  • type describe — added modelRegistry.ensureLoaded() before createTypeDescribeDeps
  • vault type-search — added vaultTypeRegistry.ensureLoaded() before constructing deps
  • ModelTypeType.complete() — made async with ensureLoaded() so extension types appear in tab completion

Root cause: Unlike createModelCreateDeps() which calls ensureLoaded() internally, createModelMethodDescribeDeps() and createTypeDescribeDeps() do not — so the CLI command must call it before invoking them.

Test plan

  • deno check passes
  • deno lint passes
  • deno fmt passes
  • All 4013 unit/integration tests pass
  • UAT tests pass: extension_vault_test.ts, extension_model_test.ts, method_describe_test.ts, broken_extensions_test.ts, vault_only_pull_test.ts

🤖 Generated with Claude Code

PR #1050 converted type registries to lazy loading but missed
ensureLoaded() calls in three commands and tab completion, causing
user-defined extensions to not be discovered.

- model_method_describe: add modelRegistry.ensureLoaded() before
  createModelMethodDescribeDeps
- type_describe: add modelRegistry.ensureLoaded() before
  createTypeDescribeDeps
- vault_type_search: add vaultTypeRegistry.ensureLoaded() before
  constructing deps
- completion_types: make ModelTypeType.complete() async with
  ensureLoaded() so extension types appear in tab completion

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@stack72 stack72 added the regression Something that previously worked is now broken label Apr 2, 2026
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 contains no user-facing changes. It fixes a silent bug where user-defined extension types were not discovered by model method describe, type describe, vault type-search, and tab completion. The only observable effect is that these commands now work correctly with extensions, which is a net UX improvement.

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

No blocking issues found. This is a clean, focused bug fix.

What looks good

  • All ensureLoaded() calls are properly awaited — no fire-and-forget promises
  • Imports from domain modules (../../domain/models/model.ts, ../../domain/vaults/vault_type_registry.ts) follow the established pattern used by other CLI commands (model_method_run.ts, workflow_run.ts, type_search.ts)
  • The libswamp import boundary is respected — no imports from internal libswamp paths
  • ModelTypeType.complete() correctly changed to async with Promise<string[]> return type
  • Tests properly updated to async/await to match the new signature
  • All files retain the AGPLv3 copyright header
  • Changes are minimal and focused on the fix

Suggestions

  1. Consider whether createModelMethodDescribeDeps() and createTypeDescribeDeps() should call ensureLoaded() internally (like createModelCreateDeps() does), so future callers don't need to remember. This would be a follow-up improvement, not blocking.

@stack72 stack72 merged commit 060631a into main Apr 2, 2026
10 checks passed
@stack72 stack72 deleted the fix/missing-ensure-loaded-calls branch April 2, 2026 15:42
stack72 added a commit that referenced this pull request Apr 2, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

regression Something that previously worked is now broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant