Skip to content

feat(k8s): admit private repositories to the valkey-devops caches #6589

Open

Description

@devops-cli-service

Split from #4704.

The snapshot and fact caches in valkey-devops must admit private repositories for the sweep and brain users only. This part waits on the ACL users and their generated passwords. A person runs uv run devops k8s push-secrets and restarts the pod after the ACL change merges, and the cache client cannot select a role user until that step exists. Acceptance criteria: The cache client SHALL admit a private repository only when the configured valkey.username is sweep or brain. A test of the cache client SHALL assert that agent is refused for a private repository. A live check SHALL show that a private repository snapshot is written under sweep and not under agent.

Proposed design

Problem statement

The snapshot and fact caches of valkey-devops serve every repository, and the cache client sends no ACL user. Private repository data therefore cannot be tied to the sweep or brain role user. This change sends the configured valkey.username and password, and admits a private repository only for those two users. The live proof under the deployed ACL users goes to its own issue.

Acceptance criteria

Requirement: Gate on the Valkey user

The Valkey cache tier SHALL admit a private repository only when the configured valkey.username is sweep or brain.

Scenario: Sweep user admits a private repository

  • WHEN a test sets valkey.username to sweep and calls the cache tier with a private repository
  • THEN uv run pytest tests/valkey/test_valkey_cache_tier.py passes and the test shows that the write reaches the Valkey tier

Requirement: Agent user is refused

The cache tier MUST refuse a private repository when the configured valkey.username is agent.

Scenario: Agent user is refused for a private repository

  • WHEN a test sets valkey.username to agent and calls the cache tier with a private repository
  • THEN the test shows that the tier returns a miss and writes no key to Valkey

Requirement: Public repository is unaffected

The cache tier SHALL admit a public repository for every configured valkey.username.

Scenario: Agent user admits a public repository

  • WHEN a test sets valkey.username to agent and calls the cache tier with a public repository
  • THEN the test shows that the tier writes the key and reads it back

Requirement: Connection sends the ACL user

The cache tier SHALL build its Valkey connection with the configured valkey.username and valkey.password as the ACL user.

Scenario: The connection names the sweep user

  • WHEN a test sets valkey.username to sweep and a password, and builds the cache tier
  • THEN the test shows that the client connection carries the user sweep and the password

Requirement: Unset user fails closed

The cache tier MUST refuse a private repository when valkey.username is unset.

Scenario: No user is configured

  • WHEN a test leaves valkey.username unset and calls the cache tier with a private repository
  • THEN the test shows a miss and no key written

Existing Tool Considered

No alternatives check has run. The valkey-py client covers the need: its connection takes username and password and sends the Valkey ACL AUTH. It lacks a repository visibility policy, because an ACL user grants key patterns and commands only. The proposal keeps the library and adds the gate in src/devops_cli/valkey/cache.py. That gate is a small addition to the cache tier, not a new client.

Key questions

  • Which open, maintained client library carries the Valkey ACL user and password?: The valkey-py client, which keeps the redis-py API, sends the ACL AUTH from its username and password connection arguments. The cache tier keeps that client. The library has no repository visibility policy, so the gate stays in project code. (best practice) [sources: src/devops_cli/valkey/cache.py]
    • Chosen: valkey-py client. It is maintained, it takes a username and a password, and the repository already uses the Valkey client stack.
    • Rejected: Custom RESP client. It re-implements connection, retry and TLS handling that the library keeps.
    • Rejected: Send no username. Valkey cannot attribute a private-repository key to a role user without the ACL user.
  • Where does the code enforce the private-repository gate?: In the cache tier of src/devops_cli/valkey/cache.py, at the point that builds a key for a repository. Every caller reaches the tier, so one check covers the roadmap jobs. (best practice) [sources: src/devops_cli/valkey/cache.py, src/devops_cli/valkey/tiered.py, docs/SERVICE_PATTERNS.md:86]
    • Chosen: Cache tier. One check at the tier covers each caller, and the tier holds the configured user.
    • Rejected: Each roadmap caller. The roadmap modules are many, and one caller misses the check.
    • Rejected: Valkey ACL alone. An ACL rule grants key patterns and commands, and it does not know whether a repository is private.
  • How does the cache tier learn that a repository is private?: From the repository reference that the caller passes with the key. The tier does not call GitHub on a cache read. (best practice) [sources: src/devops_cli/github/repo_ref.py, docs/SERVICE_PATTERNS.md:86]
    • Chosen: The caller passes the visibility with the key. A cache path needs no network, and the tier falls back to a local path as ST3 says.
    • Rejected: The tier reads GitHub. A cache read would need the network and would fail when GitHub is slow.
    • Rejected: The tier infers it from the owner. An owner has public and private repositories.
  • What does the tier do when valkey.username is unset?: It refuses a private repository and returns a miss. ST3 says a failed Valkey write is a later miss, never a job error. (best practice) [sources: docs/SERVICE_PATTERNS.md:86, src/devops_cli/valkey/cache.py]
    • Chosen: Fail closed with a miss. No private key goes to the default user, and the job continues on the local path.
    • Rejected: Admit the private repository. A private key would be written under the default user.
    • Rejected: Raise an error. ST3 makes a cache failure a miss, not a job error.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/feature
    on Nov 21, 2026
  2. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    ContributorAuthor
  3. added
    scope/k8s
    source/agent
    status/new
    value/medium
    effort/medium
    priority/p2-medium
    on Nov 21, 2026
  4. devops-cli-service commented on Nov 22, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

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

    effort/mediumpriority/p2-mediumscope/k8ssource/agentstatus/newtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions