Skip to content

feat(#65 P4): align Credentials modeling across machine/proto/RCM layers #72

Description

@yzxoi

Problem

Credentials have three different modeling approaches across layers (Issue #65, P4):

Layer Type Representation
machine Model.credentials: Option<String> Resolved API key string
proto CredentialSpec { oneof { env, literal } } Preserves source distinction
RCM credentials_env + credentials_key (two separate Option fields) Two fields, compile-time mutual exclusion check

This means:

  • machine::Model always stores the resolved API key — loses the original source info
  • RCM syntax requires two separate fields with manual mutual exclusion
  • Error messages in compile show "mutually exclusive" instead of guiding the user

Design considerations

The proto CredentialSpec design is actually the cleanest — it preserves the source distinction via oneof. Consider aligning machine::Model and RCM syntax to match this pattern:

message CredentialSpec {
  oneof source {
    string env = 1;
    string literal = 2;
  }
}

Out of scope

  • Does not change credential behavior or resolution logic
  • Does not introduce credential storage or rotation

Parent: #65

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions