Repository navigation
Description
Problem Description
The brain issue cache of #6013 breaks two rules of the shared cache tier (ADR 0023 section 8, openspec/specs/project-brain/shared-cache/spec.md).
- It holds private repositories.
issue_cache(src/devops_cli/roadmap/stores/brain_issues.py:54) has no visibility check. Each read ofGitHubStore.issue(src/devops_cli/roadmap/stores/github_store.py:874) and each webhook delivery (_remember_delivery_issue,src/devops_cli/server/routes/webhooks.py:417) writes the issue record tovalkey-devops. ADR 0023 section 8 keeps the shared tier to public repositories until each client sends a role user and the default user is off (feat(k8s): turn off the valkey-devops default user #6600). The listing snapshot obeys this rule (Visibility,SWEEP_USERinsrc/devops_cli/roadmap/stores/listing_shared.py). The issue cache does not. - Its key is outside each ACL role. The prefix comes from
RepoRef.valkey_key("brain-issue"), which givesroadmap:v1:brain-issue:<owner>/<name>. That is the key form ofvalkey-roadmap(ADR 0022 section 5), but the cache writes tovalkey-devops. The ACL users of feat(k8s): give valkey-devops one ACL user for each role #4704 (DEVOPS_CACHE_VALKEY_ACL_TEMPLATE,src/devops_cli/k8s/cluster_secrets.py:58) reach onlyvalkey:roadmap:*,valkey:gh:*,valkey:brain:*andvalkey:rag:*. When a client sends a role user, each command of the issue cache getsNOPERM, and each read is a miss.
Measured on 2026-11-26 with a read-only SCAN of valkey-devops: 453 keys have the prefix roadmap:v1:brain-issue. 32 of them hold issue records of the 2 private repositories of the Service. The other key families are valkey:rag:embedding (3,306), valkey:brain:v1 (29) and valkey:roadmap:v1 (7).
Reach of the data: the NetworkPolicy admits namespace devops only, and a reader needs the shared password. Each pod that holds the password can also read the repositories as the App. So this is a break of the rule, with no known path for an outside reader.
Reproduction Steps
- Read
src/devops_cli/roadmap/stores/brain_issues.py:54-66: no visibility read, and the prefixref.valkey_key("brain-issue"). - With a client of
valkey-devops, runSCAN 0 MATCH roadmap:v1:brain-issue:* COUNT 2000until the cursor is 0. - Count the keys of each repository, and read the visibility of each repository from GitHub.
Expected vs Actual Behavior
- Expected: the shared tier holds the issue record of a public repository only, until the process sends the role user that may hold private data. The key of the record starts with a prefix that the role user of its writer reaches.
- Actual: the shared tier holds the issue records of each repository, under a key that no role user reaches.
Proposed Fix
- The issue cache uses the visibility check of the listing snapshot (one check, no second copy). A private repository, and a repository whose visibility is unknown, gets no shared read and no shared write, unless the process sends
SWEEP_USER. - The prefix moves under
CONST_VALKEY_ROADMAP_PREFIX(valkey:roadmap:v1:issue:<owner>/<name>), whichsweepwrites andbrainreads. - The records under the old prefix have a TTL of 24 hours (
DEFAULT_BRAIN_ISSUE_TTL_SECONDS), so they go without a step of a person. State this in the pull request. - Spec delta in
openspec/specs/project-brain/shared-cache/spec.md.
Acceptance Criteria
- Test first: a read and a webhook delivery of a private repository write no key to the
valkey_serverfake, and each read answers from GitHub, as before feat(service): Cache GitHub issue and PR state in the brain from webhooks #6013 (the issue cache keeps no copy in the process). The test fails on the base. - A test: with
valkey.usernameset tosweep, the record of a private repository reaches the shared tier. - A test: each key of the issue cache starts with
valkey:roadmap:v1:. - A test: a public repository keeps the shared read and write of today.
- Live proof after the release: 25 hours after the deploy, a
SCANofvalkey-devopsfinds no key with the prefixroadmap:v1:brain-issue, and no key of a private repository under the new prefix. A comment gives the counts.
Environment Diagnostics
devops-cli 0.221.13, valkey-devops (valkey 9.2.0), Service ConfigMap with no valkey.username.
Dependencies
None.
Related: #6013 (the issue cache), #6611 (the same rules for the snapshot and fact caches), #6589 (private repositories under role users), #6600 (default user off), #4624 (tracker). This item must merge before a client of valkey-devops sends a role user.
Alternatives check of 2026-11-26: none.
Tool: none found.
Reason: The searches returned only generic browser Cache API documentation, no open tool or library that adds a public-only visibility gate or a role-reachable key prefix to the project's Valkey issue cache; the fix stays in devops-cli's own store code.
Lacks:
- No per-repository visibility gate before a shared cache write
- No key prefix constrained to the writer's ACL role
- No reuse of the listing snapshot's existing visibility check
Proposed design
Problem statement
Gate the brain issue cache by repository visibility and move its key under valkey:roadmap:v1:issue:. The cache writes private issue records to the shared valkey-devops tier today. It also uses roadmap:v1:brain-issue:*, which no ACL role reaches. The change reuses the listing snapshot visibility check and SWEEP_USER gate. It adds the spec delta to openspec/specs/project-brain/shared-cache/spec.md.
Acceptance criteria
Requirement: Private issue read skips the shared tier
A read of an issue of a private repository SHALL write no key to the shared tier when the process sends no ACL user.
Scenario: Private issue read
- WHEN A test reads issue 6013 of a private repository through
issue_cacheon thevalkey_serverfake with novalkey.username. - THEN The fake holds no key under
valkey:roadmap:v1:issue:, and the read returns the issue from the fake GitHub.
Requirement: Private webhook delivery skips the shared tier
A webhook delivery for an issue of a private repository SHALL write no key to the shared tier when the process sends no ACL user.
Scenario: Private webhook
- WHEN A signed
issueswebhook for a private repository reaches_remember_delivery_issueon thevalkey_serverfake with novalkey.username. - THEN The fake holds no key under
valkey:roadmap:v1:issue:.
Requirement: Sweep user shares a private issue
The issue cache SHALL write and read the shared record of a private repository when the process sends the ACL user sweep.
Scenario: Private repository under sweep
- WHEN A test writes issue 7 of a private repository through
issue_cachewithvalkey.usernameset tosweepon thevalkey_serverfake. - THEN The fake holds the key
valkey:roadmap:v1:issue:<owner>/<name>:7, and a secondissue_cacheread returns the stored issue.
Requirement: Issue keys use the roadmap prefix
Each key that the issue cache writes SHALL start with valkey:roadmap:v1:issue:.
Scenario: Issue key prefix
- WHEN A test writes an issue of a public repository through
issue_cacheon thevalkey_serverfake. - THEN Each key that the fake holds starts with
valkey:roadmap:v1:issue:.
Requirement: Public repository keeps shared read and write
A read and a write of an issue of a public repository SHALL use the shared tier as today.
Scenario: Public issue cache
- WHEN A test writes an issue of a public repository through
issue_cacheand a secondissue_cachereads it on the samevalkey_serverfake. - THEN The second read returns the stored issue and sends no GitHub request.
Requirement: Unknown visibility never shares
The issue cache SHALL write no shared key and read no shared record for a repository whose visibility is unknown, even when the process sends sweep.
Scenario: Unknown visibility
- WHEN A test reads and writes an issue of a repository whose visibility read fails on the
valkey_serverfake withvalkey.usernameset tosweep. - THEN The fake holds no key under
valkey:roadmap:v1:issue:, and each read returns the issue from the fake GitHub.
Requirement: Pending a person after the merge
After the release, the shared tier MUST hold no key under the old issue prefix and no private issue key under the new prefix.
Scenario: Live scan after 25 hours
- WHEN A person runs
SCAN 0 MATCH roadmap:v1:brain-issue:* COUNT 2000andSCAN 0 MATCH valkey:roadmap:v1:issue:* COUNT 2000with a client ofvalkey-devops25 hours after the deploy, and reads the visibility of each repository. - THEN The first scan returns no key, the second scan returns no key of a private repository, and a comment gives the counts.
Existing Tool Considered
The alternatives check of 2026-11-26 in the issue body gives verdict none: no open tool or library covers the need. The proposal meets the missing capabilities by reusing the listing snapshot visibility check and SWEEP_USER gate and by moving the key under CONST_VALKEY_ROADMAP_PREFIX. The fix stays in devops-cli store code. Written cost: about 3,000 tokens and 2 hours to build, and about 500 tokens per later fix to keep it.
Key questions
- How should the issue cache apply the shared-tier visibility rule?: Reuse the listing snapshot visibility check and
SWEEP_USERgate. A private repository shares only undersweep. A repository with unknown visibility shares never. (best practice) [sources: openspec/specs/project-brain/shared-cache/spec.md, src/devops_cli/roadmap/stores/listing_shared.py]- Chosen: Reuse the listing visibility check. One check, no second copy; matches the shared-cache spec and ADR 0023 section 8.
- Rejected: Add a second visibility check in brain_issues. Duplicates logic and can drift from the listing snapshot.
- Rejected: Share every repository. Breaks ADR 0023 section 8 and puts private issue data in the shared tier.
- Which key prefix should the issue cache use?: Use
CONST_VALKEY_ROADMAP_PREFIXwith:issue:<casefolded RepoRef.key>:<number>. The key isvalkey:roadmap:v1:issue:<owner>/<name>:<number>. (best practice) [sources: src/devops_cli/config/constants.py:2955, src/devops_cli/roadmap/stores/listing_shared.py, src/devops_cli/k8s/cluster_secrets.py:58]- Chosen: Prefix under CONST_VALKEY_ROADMAP_PREFIX. The ACL template reaches
valkey:roadmap:*, and the listing snapshot uses the same constant. - Rejected: Keep
RepoRef.valkey_key("brain-issue"). It givesroadmap:v1:brain-issue:*, which no ACL role reaches. - Rejected: Use
valkey:gh:*. The prefix is for GitHub objects, not brain issue records.
- Chosen: Prefix under CONST_VALKEY_ROADMAP_PREFIX. The ACL template reaches
- What happens to existing keys under the old prefix?: Do not migrate the old keys. The 24-hour TTL of
DEFAULT_BRAIN_ISSUE_TTL_SECONDSremoves them. State this in the pull request. (best practice) [sources: src/devops_cli/config/defaults.py:773, openspec/specs/project-brain/shared-cache/spec.md]- Chosen: Let the TTL remove old keys. No person step and no live migration.
- Rejected: Run a migration or delete command. Adds an operational step and a risk.
- When should the live proof run?: Wait 25 hours after the deploy. Then scan for the old and the new prefixes. A person runs the live proof after the merge. (best practice) [sources: src/devops_cli/config/defaults.py:773, openspec/specs/project-brain/shared-cache/spec.md]
- Chosen: Scan 25 hours after the deploy. The old keys have a 24-hour TTL, so a later scan proves they are gone.
- Rejected: Scan at the deploy. The old keys can stay for up to 24 hours.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 26, 2026
Private repository data sits in a shared cache tier and the key prefix causes NOPERM for role users, a security rule violation with functional impact.devops-cli-service commentedon Nov 26, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (3)
Searches run:
Sources:
devops-cli-service commentedon Nov 26, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
dan-petty commentedon Nov 26, 2026
Delivery note for pull request #7297.
Left out of the pull request
sweepuser stops its reads and writes of these entries when its public answer ends, at most 30 minutes after the change. Each key then expires 24 hours after its last write. The listing snapshot removes its copy at the first round after the change. To remove the entries sooner, the cache needs aSCANofvalkey:roadmap:v1:issue:<owner>/<name>:*, or one hash for each repository as the snapshot has.RepoRef.valkey_keyandRepoRef.valkey_patterns(src/devops_cli/github/repo_ref.py) have no caller insrc/after the change. They build the key form ofvalkey-roadmap(ADR 0022 section 5).Webhook path
The route sends no GitHub read. It takes
repository.privateof the signed delivery, else the visibility answer that the process holds, and writes nothing with neither. An unknown answer writes nothing under each ACL user, as the snapshot store has it.devops-cli-service commentedon Nov 26, 2026
Released in v0.221.14: https://github.com/dan-petty/devops-cli/releases/tag/v0.221.14
devops-cli-service commentedon Nov 26, 2026
Live since 2026-11-26 15:07 UTC
dan-petty commentedon Nov 27, 2026
Live proof, 2026-11-27 15:40 UTC, more than 25 hours after the deploy: a read-only
SCANofvalkey-devops(4,610 keys, 82 MiB of 256 MiB).roadmap:v1:brain-issue: 0. On 2026-11-26 there were 453, and 32 of them held issue records of private repositories.valkey:roadmap:v1:issue:: 554, in 7 repositories: dan-petty/devops-cli 516, dan-petty/infra 25, dan-petty/devtools 5, dan-petty/dotfiles 3, dan-petty/devcontainer-features 3, dan-petty/dreamscaper 1, dan-petty/vibes 1. GitHub givesprivate: falsefor each of the 7. No key of a private repository.valkey:rag:embedding3,831,valkey:roadmap:v1561,valkey:brain:v1218.The live criterion passes. The bound for a repository that becomes private later is #7298.