Skip to content

feat: add auto-resolution and name remapping for S3 datastore extension#910

Draft
stack72 wants to merge 1 commit intomainfrom
s3-datastore-extension
Draft

feat: add auto-resolution and name remapping for S3 datastore extension#910
stack72 wants to merge 1 commit intomainfrom
s3-datastore-extension

Conversation

@stack72
Copy link
Copy Markdown
Contributor

@stack72 stack72 commented Mar 29, 2026

Summary

This is the first step toward moving the S3 datastore to the @swamp/s3-datastore extension package (published as v2026.03.28.1 in the swamp-extensions repo). A follow-up PR will remove the built-in S3 code once this is validated.

Phase 1: Auto-resolution infrastructure

  • resolveDatastoreType() helper in extension_auto_resolver.ts
  • hotLoadDatastores() in ExtensionInstallerPort and auto-resolver adapter
  • Datastores are now hot-loaded alongside models and vaults after extension install

Phase 2: Name remapping

  • RENAMED_DATASTORE_TYPES map: "s3" → "@swamp/s3-datastore"
  • resolveDatastoreConfig and parseDatastoreEnvVar are now async
  • Old type: s3 configs auto-resolve the extension, with deprecation warning
  • Falls back to built-in S3 if extension unavailable

User impact

  • No breaking changes — existing type: s3 configs work as before
  • Deprecation warning logged when old s3 type name is used
  • First use auto-installs extension (~5s one-time); subsequent runs use cache
  • Requires @swamp/s3-datastore extension published to registry (done: v2026.03.28.1)

Test plan

  • Compiled binary, tested against real S3-backed repository
  • First run: extension auto-resolved, downloaded, bundled, cached
  • Second run: loaded from cache, no registry call, completed cleanly
  • All unit tests pass (38 tests across modified files)
  • CI passes

🤖 Generated with Claude Code

Add infrastructure to automatically resolve the S3 datastore from the
@swamp/s3-datastore extension package, replacing the built-in S3 code
path over time.

## What changed

### Phase 1: Auto-resolution infrastructure
- Added `resolveDatastoreType()` helper to `extension_auto_resolver.ts`
  (mirrors the existing `resolveVaultType()` pattern)
- Added `hotLoadDatastores()` to `ExtensionInstallerPort` interface and
  the auto-resolver adapter, so newly installed datastore extensions are
  hot-loaded alongside models and vaults
- Updated `installAndLoad()` to call `hotLoadDatastores()` after pulling
  an extension

### Phase 2: Name remapping with backward compatibility
- Added `RENAMED_DATASTORE_TYPES` map: `"s3" → "@swamp/s3-datastore"`
- Made `resolveDatastoreConfig` and `parseDatastoreEnvVar` async to
  support auto-resolution
- When `type: s3` is encountered in `.swamp.yaml` or `SWAMP_DATASTORE`
  env var, the code remaps to `@swamp/s3-datastore`, attempts
  auto-resolution, and falls back to built-in S3 handling if the
  extension is unavailable
- Users see a deprecation warning suggesting they update their config

## User impact

- **No breaking changes** — existing `type: s3` configs continue to work
  via the built-in fallback
- A deprecation warning is logged when the old `s3` type name is used
- On first use, logged-in users will see the extension auto-install
  (~5s one-time cost); subsequent runs use the cached extension
- The `@swamp/s3-datastore` extension must be published to the registry
  before this lands (it has been published as v2026.03.28.1)

## Testing performed

- Compiled binary and tested against a real S3-backed repository
- First run: extension auto-resolved from registry, downloaded, bundled,
  and cached successfully
- Second run: extension loaded from cache with no registry call, command
  completed cleanly
- All unit tests pass (38 tests across modified files)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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