Relationships
#984 MethodContext docs/comments mention context.putSecret but runtime exposes vaultService.put
Opened by evrardjp · 7/6/2026· Shipped 7/6/2026
Summary
There is a discrepancy in Swamp around model method secret-writing APIs. Some code/comments and extension assumptions refer to a context.putSecret API, but the current canonical MethodContext and runtime contexts expose vault writes through context.vaultService.put(...) instead.
Environment
- Swamp version:
20260705.211241.0-sha.a2f45922 - Source fetched with
swamp source fetchfor that version.
Evidence
Canonical MethodContext (src/domain/models/model.ts) includes:
vaultService?: VaultService;and does not define putSecret or deleteSecret.
buildMethodContext (src/domain/models/method_context.ts) passes vaultService through but does not add top-level putSecret/deleteSecret.
Remote worker context (src/worker/remote_method_context.ts) builds a vaultService proxy with methods like:
put: async (vaultName, secretKey, secretValue) => { ... }But src/serve/capability_service.ts contains a comment saying:
// Secrets are not model-type-scoped: any method may write to any vault
// key via the context.putSecret API ...That comment/API name appears stale or inconsistent with the runtime surface.
Reproduction / impact
An extension using context.putSecret fails at runtime with an error equivalent to:
This Swamp runtime does not expose context.putSecretThe expected in-process API seems to be context.vaultService.put(vaultName, key, value).
Expected behavior
Please clarify and align the extension-author-facing MethodContext contract and implementation:
- Either expose top-level
context.putSecret/context.deleteSecretif that is the intended API; or - Update stale comments/docs/examples to point extension authors at
context.vaultService.put/delete; and - Ideally ensure the testing package types match the documented extension-author API for secret writes.
Shipped
Click a lifecycle step above to view its details.