3.0 KiB
3.0 KiB
Tasks — foundation-fix-gap-3-secrets-slot
- Add
secrets: SecretsLikeREQUIRED field toPluginContext<Caps>in@suaveplan/api-types/plugin-context; verify theOmit<PluginContext, "capabilities">extension causesRequestContext,JobContext,ConnectionContextto inherit the field. - Update
plugin-context.mdto document the new field on every flavour. - Add optional
secrets?: SecretsLiketoHostAdaptersin@suaveplan/api-host/host/host.types.ts; update Zod adapter shape inhost.tsto accept the optional field. - Add
EmptySecretsclass atpackages/api-stack/api/api-host/src/empty-secrets/{empty-secrets.ts,empty-secrets.test.ts,empty-secrets.md,index.ts};getreturnsundefined,requirethrowsSECRETS.SECRET_NOT_FOUNDviaSecretsError,listreturns frozen empty array. - Wire
./empty-secretssubpath export inapi-host/package.jsonand re-export from the root barrel. - Add
@suaveplan/api-secretsworkspace dependency toapi-host/package.jsonsoSecretsError+SECRETS_CODESare reachable. - Thread
secrets: SecretsLikethroughRequestPipelineOptions; updaterequest-pipeline-helpers.buildRequestContextto accept + propagate; updaterequest-pipeline-driver.runPipelineto passconfig.options.secrets. - Wire
LifecycleDriverOptions.secretsand store on the driver; updatecallUserHookto pass{ plugin, secrets }to user hooks instead of{}. - In
createHost/HostImpl, constructsecrets = adapters.secrets ?? new EmptySecrets()and inject into both pipeline options and lifecycle driver options. - Update
request-pipeline-outcomes.test.tsandrequest-pipeline.test.ts(3 pipeline constructor sites) to supplysecrets: new EmptySecrets(). - Add
request-pipeline-secrets.test.tscovering: (a) handler readsctx.secrets.require("FOO")via a wired stub, (b)EmptySecretsthrowsSECRETS.SECRET_NOT_FOUNDand yields 500 envelope, (c)ctx.secretsis the same reference passed via options. - Remove the
buildSecrets()closure +secrets.require(SECRET_KEY)binding frome2e/foundation-stack/src/fixture-plugin.ts; route handler reads viactx.secrets.require("FOUNDATION_SECRET"). - Wire
createEnvSecrets(...)intoHostAdapters.secretsine2e/foundation-stack/src/server.ts; update the inline gap-3 deviation comment to "CLOSED". - Verify gate:
bunx turbo lint typecheck test build --filter=@suaveplan/api-host --filter=@suaveplan/api-types --filter=@suaveplan/e2e-foundation-stack→ green. - Verify coverage: 100% line on touched files (api-host empty-secrets, lifecycle, host, request-pipeline driver/helpers/types).
- E2E: re-run
cd e2e/foundation-stack && bunx playwright test— all 10 tests pass post-shim removal, including the secrets-redaction test. - Fold deltas into canonical
openspec/specs/api-host/spec.mdandopenspec/specs/api-types/spec.md; move folder toopenspec/archive/2026-05-26-foundation-fix-gap-3-secrets-slot/.