Repository navigation
Description
Problem Description
After #7292, the shared tier takes the issue records of a public repository only. But when a public repository becomes private, the records that the tier already holds stay until their TTL ends, at most 24 hours after their last write (DEFAULT_BRAIN_ISSUE_TTL_SECONDS). No process reads them after its public answer ends (at most 30 minutes), and a webhook delivery stops at once, because the delivery carries repository.private.
The listing snapshot has a bound for this case: its shared copy stays at most 1 hour after the change (openspec/specs/project-brain/shared-cache/spec.md, requirement of the visibility answer, owner decision of 2026-11-21). A round removes the snapshot when its visibility read gives private. The issue cache has no such removal, because its records are one key for each issue (valkey:roadmap:v1:issue:<owner>/<name>:<number>) and the issue cache runs no scan of keys. The cache tier itself has scan and unlink since #7320 (src/devops_cli/valkey/cache.py:183 and :196).
Reach of the data: the records were public when a process wrote them, and a reader needs the password of the cache in namespace devops. So this is a break of the 1-hour bound, with no known path for an outside reader.
Reproduction Steps
- With the
valkey_serverfake, write 2 issue records of a repository whose visibility read gives public. - Change the visibility read to private, move the clock 30 minutes, and read one issue.
- Read the keys of the fake: the 2 records are still there.
Expected vs Actual Behavior
- Expected: at most 1 hour after a repository becomes private, the shared tier holds no issue record of it, unless the process sends
SWEEP_USER. - Actual: the records stay for at most 24 hours after their last write.
Proposed Fix
When the visibility check gives private for a process that does not send SWEEP_USER, the issue cache removes the keys of that repository: a SCAN with MATCH valkey:roadmap:v1:issue:<owner>/<name>:* and a bounded COUNT, then UNLINK, in the form of the snapshot removal. The scan has a bound of time and of keys, fails soft, and counts its result. The pattern of o/n matches no key of o/nn, because the : ends the repository part.
Acceptance Criteria
- Test first: after a private answer, the fake holds no issue key of that repository and still holds the keys of another repository whose name starts with the same characters. The test fails on the base.
- A test: a process that sends
SWEEP_USERremoves nothing. - A test: with the tier down, the removal sends no command and raises no error.
- The spec states the 1-hour bound for the issue records.
Environment Diagnostics
devops-cli after the merge of the pull request of #7292.
Dependencies
Related: #6611 (the bound of the snapshot), #6589, #4624.
Source
Source: #4624
Alternatives check of 2026-11-26: none.
Tool: none found.
Reason: Searches found no open tool that evicts a repository's cached issue records when its visibility turns private; this is application logic in devops-cli, run against the Valkey keyspace it already writes.
Lacks:
- No tool drops issue keys on a private visibility answer
- No per-repository scan of the issue key space
- No removal bound shorter than the 24-hour TTL
- No sweep that spares keys of similarly named repositories
Proposed design
Problem statement
After #7292 the shared tier holds the issue records of a public repository only. When a public repository becomes private, the records that the tier already holds stay until their TTL, at most 24 hours after their last write. The listing snapshot removes its shared copy at the first private answer, and the issue cache has no such removal. This breaks the 1-hour bound of the spec for the issue records.
Acceptance criteria
Requirement: A private answer removes the issue keys of the repository
When the visibility check gives private for a process that sends no sweep ACL user, the issue cache SHALL remove each key valkey:roadmap:v1:issue:<owner>/<name>:<number> of that repository.
Scenario: A repository that became private
- WHEN A store writes the issue keys of
dan-petty/devops-cliand ofdan-petty/devops-cli-2on thevalkey_serverfake, and a store of a new process with no ACL user reads an issue ofdan-petty/devops-cliwhile the visibility read givesisPrivate: true - THEN The fake holds no key with the prefix
valkey:roadmap:v1:issue:dan-petty/devops-cli:. It keeps each key with the prefixvalkey:roadmap:v1:issue:dan-petty/devops-cli-2:.devops_cli_brain_writes_total{store="issue",result="removed"}rises by one.
Requirement: The sweep user keeps the issue keys
A process that sends the sweep ACL user SHALL NOT remove the issue keys of a private repository.
Scenario: A private repository under the sweep user
- WHEN A store writes the issue keys of a repository on the
valkey_serverfake, and a store of a new process that sends thesweepuser reads an issue while the visibility read givesisPrivate: true - THEN The fake keeps each issue key of the repository, and
devops_cli_brain_writes_total{store="issue",result="removed"}does not rise.
Requirement: A failed tier fails the removal soft
A removal whose SCAN or UNLINK command fails SHALL raise no error to the caller, SHALL send no further command, and SHALL count the failure.
Scenario: The tier stops before the removal
- WHEN A store of a new process with no ACL user reads an issue of a repository whose visibility read gives
isPrivate: true, and thevalkey_serverfake hasconnected = Falsebefore the removal - THEN The read returns no entry and no error reaches the caller. The fake receives no
UNLINK.devops_cli_valkey_cache_errors_total{op="scan",error="connection"}rises by one.
Requirement: The spec states the 1-hour bound of the issue records
The project-brain/shared-cache spec SHALL state that the shared tier holds no issue record of a repository later than 1 hour after the repository becomes private, unless the process sends sweep.
Scenario: The spec delta validates
- WHEN
openspec validate --strictruns on the change folder of this issue - THEN The command reports no error for the change, and the spec delta of
project-brain/shared-cacheholds the requirement of the 1-hour bound for the issue records.
Existing Tool Considered
The alternatives check of 2026-11-26 in the issue body gives the verdict none: it found no open tool or library that evicts a repository's cached issue records when its visibility turns private, and the block lists what such a tool lacks. The change builds the removal itself on the SCAN and UNLINK commands that the cache tier already holds (src/devops_cli/valkey/cache.py:183 and :196), in the form of the snapshot removal. Written cost of the own code: about 40,000 tokens to build, keep and fix the removal and its tests, and about 3 hours of elapsed time.
Key questions
- Where does the removal of a repository's issue keys run?: In
src/devops_cli/roadmap/stores/brain_issues.py, at the visibility answer that the issue cache reads. The store removes the keys one time for each private answer, when the process sends nosweepACL user, and then returns no entry. (best practice) [sources: src/devops_cli/roadmap/stores/brain_issues.py:103, src/devops_cli/roadmap/stores/visibility.py:56, src/devops_cli/roadmap/stores/listing_shared.py, openspec/specs/project-brain/shared-cache/spec.md]- Chosen: Remove at the private visibility answer of the issue store. The store already reads this answer, and the snapshot store removes its shared copy at the same point. The process sends no command for a private repository.
- Rejected: Remove in the webhook route from
repository.private. The route holds no visibility answer, and a change of visibility sends noissuesdelivery that the route handles. - Rejected: Remove in a scheduled sweep over the issue key space. No process holds the set of repositories, and the tier holds no reverse index, so a sweep would scan the whole keyspace each round.
- Does the removal use
SCANwithMATCH, or an index key for each repository?:SCANwithMATCH valkey:roadmap:v1:issue:<owner>/<name>:*and a boundedCOUNT, thenUNLINK, through thescanandunlinkmethods of the cache tier. (best practice) [sources: src/devops_cli/valkey/cache.py:183, src/devops_cli/valkey/cache.py:196, src/devops_cli/roadmap/brain_index.py:189]- Chosen:
SCAN MATCHthenUNLINK. The tier hasscanandunlink, the brain index already scans this way, and no new key needs a write on each issue write. - Rejected: An index set for each repository. It adds a write to each issue write, a second structure to keep and a new failure path, and the tier holds no such index today.
- Rejected: A
KEYScommand.KEYSblocks the server on the whole keyspace, and the tier does not expose it.
- Chosen:
- Which bound does the scan take?:
SCANwithCOUNT 500in each call, repeated within a budget of 5 s and 10,000 keys for one removal. A removal that passes the budget stops, sends no further command, and counts the error. A key that the removal missed still ends at its 24-hour TTL. (best practice) [sources: src/devops_cli/valkey/cache.py:183, openspec/specs/project-brain/shared-cache/spec.md]- Chosen: A cursor loop with
COUNT 500and a budget of 5 s and 10,000 keys. Each call stays short, and the budget keeps a slow tier from holding the read of the issue. - Rejected: One
SCANcall with no loop. A repository with many issues needs more than one cursor step. - Rejected: A removal with no bound. A slow or a large keyspace would hold the read of the issue, and the spec bounds each Valkey operation.
- Chosen: A cursor loop with
- Which counter records a removal?:
devops_cli_brain_writes_total{store="issue",result="removed"}, one time for each removal round that removed at least one key. (best practice) [sources: openspec/specs/project-brain/shared-cache/spec.md, src/devops_cli/roadmap/stores/brain_issues.py]- Chosen: A
removedresult on the existing write counter. The snapshot store counts its removal asremovedon the same counter, and the label values stay in the fixed set of the source. - Rejected: Reuse the result
private. A reader cannot tell a removal from a refused write. - Rejected: A new counter. It adds a second counter for one store, and the spec names four counters.
- Chosen: A
- Does the removal meet the 1-hour bound of the spec?: Yes. A process keeps a public answer for 30 min, so it reads the visibility again at most 30 min after the change and removes at that read. The shared tier holds no issue record of the repository later than 1 hour after the change. [sources: openspec/specs/project-brain/shared-cache/spec.md, src/devops_cli/config/defaults.py:774, src/devops_cli/roadmap/stores/visibility.py]
- Does the
MATCHpattern stay inside the keys of one repository?: Yes. The pattern ends with the literal:after the casefoldedRepoRef.key, and a key ofdan-petty/devops-cli-2holds-2:where the pattern holds:. ADR 0022 records that*spans:in a Valkey pattern, so the trailing*matches only the number part of a key of the same repository. [sources: openspec/specs/project-brain/shared-cache/spec.md, docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md:39, src/devops_cli/github/repo_ref.py] - How does a test prove that the spec holds the 1-hour bound?:
openspec validate --strictvalidates the change folder and its spec delta. The requirement text of the delta carries the bound, and a test that reads the Markdown asserts no value of the document. (best practice) [sources: openspec/config.yaml, openspec/specs/project-brain/shared-cache/spec.md]- Chosen:
openspec validate --stricton the change folder. OpenSpec is the spec layer, and the validator checks the delta that holds the requirement. - Rejected: A test that reads the spec Markdown. A test asserts no value of a document, and the validator already checks the delta.
- Chosen:
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
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 (8)
Tools considered:
Searches run:
Sources:
dan-petty commentedon Nov 27, 2026
Design check, 2026-11-26
Body, 1 correction: the sentence "the cache tier has no scan of keys" was true before #7320. The tier now has
scan(src/devops_cli/valkey/cache.py:183) andunlink(src/devops_cli/valkey/cache.py:196). The brain index usesscan(src/devops_cli/roadmap/brain_index.py:189).Premise: it is true.
src/devops_cli/roadmap/stores/brain_issues.pyhas no scan and no removal of the keys of one repository.Service blocks: no error found. This item has no refine block yet.
Dependencies: #7292 is closed (#7297). No open item blocks this item.
Related: the comment of 2026-11-26 on #4687 gives the same case for the brain index.
devops-cli-service commentedon Nov 28, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
devops-cli-service commentedon Nov 28, 2026
Released in v0.234.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.234.0
devops-cli-service commentedon Nov 28, 2026
Live since 2026-11-28 17:56 UTC