Skip to content

πŸŽ™οΈ task - feat(types): brand ContextAwsLambdaCaller vs ContextAwsLambdaServer β€” a caller is silently assignable to a serverΒ #24

Description

@uladkasach

πŸ¦«πŸŽ™οΈ dispatch to foreman

πŸ’§ task enqueued
   β”œβ”€ priority = ?
   β”œβ”€ yieldage = ?
   └─ leverage = ?

title
feat(types): brand ContextAwsLambdaCaller vs ContextAwsLambdaServer β€” a caller is silently assignable to a server
description

what

brand ContextAwsLambdaCaller and ContextAwsLambdaServer so they are non-interchangeable at the type level.

why

the two contexts are near-identical in shape, so a caller is silently assignable to a server. verified with a probe in svc-gateway:

assignment result
caller -> where a server is expected compiles silently
server -> where a caller is expected TS2322 (env optional vs required)

exactly one direction is compiler-invisible, and it is a real hazard: env.access means different things on each side β€”

  • caller: which peer lambda to target, ${service}-${access}-${function}
  • server: whether to open the introspection gate (below prod only)

a caller passed where a server is expected compiles, then mis-gates introspection.

ask

brand them so the compiler enforces the distinction the names imply:

export interface ContextAwsLambdaCaller extends ContextLogTrail {
  readonly __side?: "caller";   // or an OfGlossary-style brand
  ...
}

that removes the need for any downstream naming convention β€” the type system carries it. (secondary, if declined: scaffold contextLambdaCaller + contextLambdaServer consts in the lambda-service practice β€” the convention-level workaround for the same problem, noting the test->prep collapse the caller needs and the server does not.)

source

found during the declapract upgrade of ahbode/svc-gateway (branch vlad/bump-practs), item 4 of .dream/2026_08_12.upstream-sdk-zod-glossary-splits

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions