Summary
OpenAPI security requirements can express alternatives between requirement objects and combinations of multiple schemes within one requirement. Lathe currently removes the scheme names and flattens all scopes into one list, so the generated catalog and runtime cannot preserve those semantics.
Reproduction
Use an operation whose security declaration contains:
- two Security Requirement Objects, meaning either credential set may satisfy the operation; or
- one Security Requirement Object containing two schemes, meaning both are required.
Generate the CLI and inspect commands show ... --json.
Actual behavior
internal/codegen/rawir.RawSecurityReq stores only scopes.
- Backend conversion iterates each map but discards every security scheme identifier.
internal/codegen/normalize/normalize.go::deriveSecurity merges all scopes into one sorted slice.
pkg/runtime.SecurityHint exposes only Public and Scopes.
- Runtime host configuration constructs one authenticator rather than selecting a satisfiable alternative or applying a required combination.
Expected behavior
The generated contract should preserve scheme identity, alternative requirements, and required combinations. Runtime execution should select a satisfiable alternative and apply every scheme required by that alternative. Catalog and Skill output must expose the same requirement structure to agents.
Acceptance criteria
- IR and generated specs distinguish OR alternatives from AND combinations.
- Scheme names and locations survive parsing without exposing credential values.
- Anonymous alternatives are represented correctly.
- Runtime fails before sending when no alternative is satisfiable.
- Tests cover bearer/API-key alternatives and a two-scheme combination.
- Any catalog or generated schema change is versioned explicitly.
Summary
OpenAPI security requirements can express alternatives between requirement objects and combinations of multiple schemes within one requirement. Lathe currently removes the scheme names and flattens all scopes into one list, so the generated catalog and runtime cannot preserve those semantics.
Reproduction
Use an operation whose security declaration contains:
Generate the CLI and inspect
commands show ... --json.Actual behavior
internal/codegen/rawir.RawSecurityReqstores only scopes.internal/codegen/normalize/normalize.go::deriveSecuritymerges all scopes into one sorted slice.pkg/runtime.SecurityHintexposes onlyPublicandScopes.Expected behavior
The generated contract should preserve scheme identity, alternative requirements, and required combinations. Runtime execution should select a satisfiable alternative and apply every scheme required by that alternative. Catalog and Skill output must expose the same requirement structure to agents.
Acceptance criteria