Skip to content

feat(service): keep a Valkey read model of each item #4582

Open

Description

@dan-petty

Update 2026-11-26 (infra move): the valkey-roadmap manifest goes to dan-petty/homelab (follow-up of #4563).

This item keeps the product code. The router ACL lines are a homelab change, made when this item is built. devops ci --check --only k8s here cannot check them. Record the 2 MB memory plan line with the manifest.


Problem or Motivation

The read API of the roadmap Service must answer from valkey-roadmap with no GitHub request, and both router replicas must give the same answer. Today the open items exist only in GitHub and in the transient listing of the status lane. No store holds a read model of the items.

Proposed Solution & Architectural Design

Keys from RepoRef in valkey-roadmap:

Key Type Writer Bound
roadmap:v1:item:<owner>/<name>:<n> hash (fields, record marks, updated_at) the issue listing; the router on issues deliveries TTL 1 day, set again at each listing
roadmap:v1:items:<owner>/<name> set of open numbers the issue listing: write a temporary key, then RENAME owner: the listing
  • The code that lists the open issues already (the status lane now; the sweep later) writes the read model at no extra request cost. The writer function moves with the listing to the sweep; no route changes.
  • issues deliveries update the item from the payload. The issues payload model declares label.name and keeps extra="ignore" (ADR 0009).
  • A Valkey error is one log line, and the round goes on.
  • ACL: the router user reads these keys and the state keys that /health and /budgets report, and writes item:* and items:*.
  • Size: about 2 MB for 7 repositories. Add it to the memory plan of valkey-roadmap.

Target Subsystem

Workstation Caching & Valkey (roadmap Service read model).

Existing Tool Considered

Valkey hashes, sets and RENAME through valkey-py. A process-memory reader is rejected: the router runs 2 replicas at the end of the move. valkey-runs is rejected: any source can reach its NodePort. Cost: about 300,000 tokens and 4 hours to build, about 10,000 tokens a month to keep, about 50,000 tokens to fix.

Acceptance Criteria

  • The issue listing writes each open item to the keys above with no extra GitHub request (a test counts requests).
  • An issues delivery updates the item hash from the payload.
  • The set of open numbers is replaced with RENAME; each item hash has a TTL of 1 day.
  • A Valkey error is one log line, and the round goes on.
  • All keys come from RepoRef; the router ACL user gets the access above.

Dependencies

  • "docs(service): decide the roadmap Service read API".
  • "feat(roadmap): name each repository's resources from one RepoRef".
  • "feat(service): share the GitHub budget and holds in Valkey".

Source: #4517

Alternatives check of 2026-11-28: in-use.
The repository already uses this tool.
Tool: valkey-io/valkey-py (https://github.com/valkey-io/valkey-py), MIT, last activity 2026-11-20, maintained.
Reason: Searches found no tool that keeps a Valkey read model of issues; valkey-py is the client that already gives the hash, set, expire and rename commands, but the key schema, writers, ACL and memory plan stay project code.

Covers:

  • HSET, SADD, EXPIRE and RENAME under their raw command names
  • TTL set again on each write of an item hash
  • Pipelines, connection pools and ACL user authentication

Lacks:

  • Read-model key schema from RepoRef
  • Writer in the open-item listing and the issues delivery path
  • router ACL line and the 2 MB memory plan line

Proposed design

Problem statement

The read API of the roadmap Service must answer from valkey-roadmap with no GitHub request, and both router replicas must give the same answer. No store holds a read model of the items today: the open items exist only in GitHub and in the transient listing of the status lane. This change writes each open item to valkey-roadmap from the listing that already reads it, updates one item from each issues delivery, and adds the keys, the 1-day TTL, the atomic swap of the open set, the error handling, the router ACL line and the 2 MB memory plan line of the instance.

Acceptance criteria

Requirement: Listing writes the read model

The open-item listing SHALL write each open item to its item hash and write the set of open numbers from the items that it already reads.

Scenario: No extra GitHub request

  • WHEN The stage round lists the open items and Valkey accepts the writes.
  • THEN A test counts no GitHub request beyond the listing's own, and each item hash and the set hold the listed items.

Requirement: Webhook updates one item

The router MUST update the item hash of an issues delivery from the payload, with no GitHub request.

Scenario: A label delivery updates the hash

  • WHEN A signed issues delivery with action labeled arrives for an open item.
  • THEN The item hash holds the label of label.name, the state, the title and the updated_at of the payload, and a test counts no GitHub request.

Requirement: Atomic swap of the open set

The listing MUST replace the set of open numbers with RENAME from a temporary key.

Scenario: A reader never sees a partial set

  • WHEN A listing round writes a temporary set and renames it over the set of open numbers.
  • THEN The set holds exactly the open numbers, no temporary key remains, and the writer sends no DEL of the set.

Requirement: Item hash expiry

Each write of an item hash MUST set a TTL of 1 day on it again.

Scenario: TTL is set again

  • WHEN A listing round and an issues delivery write the same item hash 10 minutes apart.
  • THEN The item hash holds a TTL of 86400 seconds after each write.

Requirement: Valkey error does not stop the round

A Valkey error MUST write one log line and MUST NOT stop the listing round or the delivery.

Scenario: Connection error during the write

  • WHEN The Valkey client raises a connection error during the write of a listing round.
  • THEN The test finds one log line for the error, and the round returns its usual result.

Requirement: Keys come from RepoRef

Each read-model key SHALL come from RepoRef, and no code SHALL parse owner/name itself.

Scenario: Item key of one repository

  • WHEN The writer builds the keys for dan-petty/devops-cli and item 4582.
  • THEN The keys are roadmap:v1:item:dan-petty/devops-cli:4582 and roadmap:v1:items:dan-petty/devops-cli.

Requirement: Router ACL

The router ACL user SHALL read the read-model and state keys and SHALL write the item and set keys with +hset, +sadd, +expire and +rename.

Scenario: The ACL plan renders the router user

  • WHEN uv run devops ci test tests/k8s/test_cluster_secret_plan.py runs on the change that adds the router user to ROADMAP_STATE_VALKEY_ACL_TEMPLATE.
  • THEN The test passes and the aclfile holds a router line with ~roadmap:v1:item:*, ~roadmap:v1:items:*, +hset, +sadd, +expire and +rename.

Requirement: Memory plan states the read model

The memory plan of valkey-roadmap MUST state the read model and its bound of 2 MB for 7 repositories.

Scenario: The k8s row renders the valkey-roadmap manifest

  • WHEN uv run devops ci --check --only k8s runs on the change that adds the read-model line to k8s/devops/valkey-roadmap/valkey.conf.
  • THEN The row passes and reports no error for the valkey-roadmap manifest.

Requirement: Pending a person after the merge

After the merge, a person SHALL push the router password and the aclfile to devops/valkey-roadmap-auth, restart deployment/valkey-roadmap, and prove that the live router user writes and reads an item key.

Scenario: The live router user writes the read model

  • WHEN After the merge a person runs uv run devops k8s push-secrets --only devops/valkey-roadmap-auth, restarts deployment/valkey-roadmap and deployment/roadmap-service, and runs kubectl -n devops exec deploy/valkey-roadmap -c valkey -- valkey-cli --user router --pass <router-password> HSET roadmap:v1:item:dan-petty/devops-cli:4582 title test.
  • THEN The push reports the new router key and the aclfile, the pod is ready, and the HSET answers 1; HGET as router answers test.

Existing Tool Considered

valkey-io/valkey-py (https://github.com/valkey-io/valkey-py, MIT, maintained) is the open client that the alternatives check of 2026-11-23 records in-use; its block names what it lacks for this item. The change builds that product code, at about 300,000 tokens and 4 hours to build, about 10,000 tokens a month to keep, and about 50,000 tokens to fix.

Key questions

  • Does this item change the valkey-roadmap manifest, its ACL or its memory plan?: Yes. The valkey-roadmap product base is in this repository at k8s/devops/valkey-roadmap/ (ADR 0032 section 1, k8s/README.md:26, docs/CLUSTER.md:294). The router line is a change of ROADMAP_STATE_VALKEY_ACL_TEMPLATE in src/devops_cli/k8s/cluster_secrets.py:81, and the 2 MB line goes with the manifest in k8s/devops/valkey-roadmap/valkey.conf:11 and the valkey-roadmap section of k8s/README.md:24. The body note of 2026-11-26 that the manifest goes to homelab is not the state at this commit: feat(k8s): add the valkey-roadmap instance, its setting and ACL users #7302 delivered the instance here on 2026-11-26 (CHANGELOG.md:38), and docs/CLUSTER.md:294 names this folder. uv run devops ci --check --only k8s builds the folder; the ACL test is tests/k8s/test_cluster_secret_plan.py:709. [sources: docs/adr/0032-infrastructure-templates-live-in-four-homes.md:38, k8s/README.md:26, docs/CLUSTER.md:294, src/devops_cli/k8s/cluster_secrets.py:81, k8s/devops/valkey-roadmap/valkey.conf:11, CHANGELOG.md:38, tests/k8s/test_cluster_secret_plan.py:709]
  • Do the read-model key names come from RepoRef?: Yes. ADR 0022 gives one rule for each key that holds a repository, and ARCHITECTURE.md:227 repeats it: no code parses owner/name itself. RepoRef.valkey_key at src/devops_cli/github/repo_ref.py:203 builds roadmap:v1:<kind>:<owner>/<name>[:<id>], so valkey_key("item", "4582") gives roadmap:v1:item:dan-petty/devops-cli:4582 and valkey_key("items") gives roadmap:v1:items:dan-petty/devops-cli. (best practice) [sources: docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md, ARCHITECTURE.md:227, src/devops_cli/github/repo_ref.py:203]
    • Chosen: Use RepoRef. ADR 0022 requires one reference for each key that holds a repository.
    • Rejected: Format owner/name in the writer. ADR 0022 forbids code outside RepoRef from parsing owner/name.
    • Rejected: Read key names from settings. Settings hold repository names, not key names, and ADR 0022 gives the key rule.
  • Where does the writer live, and which code gives it the open items?: The writer joins src/devops_cli/roadmap/stores/listing_shared.py, the shared listing store that already writes the listing through HSET, EXPIRE and RENAME (listing_shared.py:489-532). The change adds the set write and the roadmap_state_tier() for the read-model keys (src/devops_cli/valkey/cache.py:398). The stage row _open_items at src/devops_cli/roadmap/stage/stage.py:586 gives it the open items of the listing that the round already reads, so the round sends no extra GitHub request. The writer moves with that listing to the sweep. (best practice) [sources: src/devops_cli/roadmap/stores/listing_shared.py:489, src/devops_cli/roadmap/stores/listing_shared.py:531, tests/roadmap/stores/test_listing_shared.py, src/devops_cli/roadmap/stage/stage.py:586, src/devops_cli/valkey/cache.py:398, src/devops_cli/roadmap/run.py]
    • Chosen: Extend src/devops_cli/roadmap/stores/listing_shared.py. The store already writes the listing through HSET, EXPIRE and RENAME and has tests, so one module holds the writer and moves to the sweep.
    • Rejected: A new module src/devops_cli/roadmap/stores/item_read_model.py. It adds a second writer of the same listing and a second place to move to the sweep.
    • Rejected: Inline in the stage row. The webhook route cannot reuse it, and the stage row would hold the Valkey detail.
  • How does the listing replace the set of open numbers?: Write the open numbers to a temporary key and RENAME that key over the set of open numbers. src/devops_cli/valkey/client.py:348 sends RENAME, and listing_shared.py:531 already uses that command for the snapshot swap. ADR 0023 records the same swap for a rebuild. (best practice) [sources: docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md, src/devops_cli/roadmap/stores/listing_shared.py:531, src/devops_cli/valkey/client.py:348]
    • Chosen: RENAME of a temporary key. The swap is one atomic command, so a reader sees the old set or the new set and never a partial one.
    • Rejected: DEL then SADD. A reader between the two commands sees an empty set, and the read API answers with no open item.
    • Rejected: SREM of each closed number. The code reads the set and computes the difference, and a reader sees a mixed set for the length of the round.
  • What TTL does an item hash get?: 1 day, set again at each listing round and after each delivery. ADR 0021 section 3 rule 6 requires a TTL or one owner for each key (docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:83). The sweep runs every 5 minutes (CONTEXT.md:157), so the TTL never expires a live item; the item hashes of a repository that leaves service.repos free their memory within 1 day, and the set key has the listing as its one owner, which deletes it. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:83, docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md, CONTEXT.md:157, src/devops_cli/roadmap/stores/listing_shared.py]
    • Chosen: 1 day, set again at each round and after each delivery. The sweep refreshes each live item every 5 minutes, and the item hashes of a removed repository free their memory within 1 day.
    • Rejected: No TTL. The item hashes of a removed repository stay until a person deletes them, and nothing reports them.
    • Rejected: 7 days. The memory of a removed repository stays 7 times longer, and the listing already refreshes the key.
  • What does the writer do when Valkey returns an error?: Write one log line at warning level and continue the round or the delivery. GitHub stays the source of truth (ARCHITECTURE.md:225) and the read model is derived data (ADR 0021 section 3 rule 1), so a Valkey error must not delay a label, a comment or a webhook. (best practice) [sources: ARCHITECTURE.md:225, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, docs/guidelines/agentic-jobs.md]
    • Chosen: One log line, then continue. GitHub stays the source of truth, and one line keeps the log quiet during an outage.
    • Rejected: Abort the round. A Valkey outage then stops roadmap work that GitHub can still do, and the status lane loses its round.
    • Rejected: Retry with backoff in the round. The round holds its lane for the backoff, and the next round writes the same keys.
  • Which fields does an issues delivery write into the item hash?: The fields that the read API answers, the record marks and updated_at, taken from the payload. WebhookIssue already declares labels of WebhookLabel.name, state, title and updated_at, with extra="ignore" (src/devops_cli/models/webhooks.py:29, src/devops_cli/models/webhooks.py:70), so this item changes no payload model. ADR 0009 requires extra="ignore", so an unknown field never fails a delivery. (best practice) [sources: docs/adr/0009-one-webhook-router-delivers-each-event-to-the-consumers-subscribed-to-it.md, src/devops_cli/models/webhooks.py:29, src/devops_cli/models/webhooks.py:70, docs/adr/0029-the-roadmap-service-serves-a-read-only-api.md]
    • Chosen: The read-API fields, the record marks and updated_at. The hash holds only fields that a reader uses, and extra="ignore" keeps the delivery safe when GitHub adds a field.
    • Rejected: The whole payload as JSON. The read API parses JSON for each answer, and the hash grows past the 2 MB bound.
    • Rejected: Only the number and the title. The answer would miss the state, the labels and updated_at, and the read API would need GitHub again.
  • Which user writes the read model, and what may it read?: The router user writes the item and set keys, and reads the read-model keys and the state keys that /health and /budgets report. ADR 0021 section 3 names the router, sweep and agent users (docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:76); feat(service): share the GitHub budget and holds in Valkey #4563 adds the router and sweep users (docs/CLUSTER.md:300), and this item adds the read-model key patterns to router. The Service pod's existing brain user keeps the brain index (docs/CLUSTER.md:301). The ACL template is ROADMAP_STATE_VALKEY_ACL_TEMPLATE at src/devops_cli/k8s/cluster_secrets.py:81. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:76, docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md, docs/CLUSTER.md:300, docs/CLUSTER.md:301, src/devops_cli/k8s/cluster_secrets.py:81]
    • Chosen: The router user. The issue names it for the read model, and ADR 0021 section 3 gives the instance a router user.
    • Rejected: A new read-only reader user. The router writes the item from each delivery, so a read-only user needs a second write user and a second credential.
    • Rejected: The default user. It holds all commands, so a defect in the router could write any key of the instance.
  • Which file holds the memory plan of valkey-roadmap?: The valkey-roadmap product base is k8s/devops/valkey-roadmap/ (ADR 0032 section 1, k8s/README.md:26, docs/CLUSTER.md:294). k8s/devops/valkey-roadmap/valkey.conf:11 holds maxmemory 128mb and the basis of the bound; the valkey-roadmap section of k8s/README.md:24 states the bound of 128 MiB. The 2 MB read-model line goes in valkey.conf with the manifest, and the section repeats it. [sources: docs/adr/0032-infrastructure-templates-live-in-four-homes.md:38, k8s/README.md:24, docs/CLUSTER.md:294, k8s/devops/valkey-roadmap/valkey.conf:11]
  • Which items does this item depend on?: Only feat(service): share the GitHub budget and holds in Valkey #4563 is open. feat(service): share the GitHub budget and holds in Valkey #4563 adds the router and sweep users and the coordination keys that the read model's ACL and state keys need (docs/CLUSTER.md:296, docs/CLUSTER.md:300). docs(service): decide the roadmap Service read API #4581 is delivered: ADR 0029 is accepted and records the read API fields (docs/adr/0029-the-roadmap-service-serves-a-read-only-api.md:1). feat(roadmap): name each repository's resources from one RepoRef #4533 is delivered: ADR 0022 is accepted and RepoRef is in src/devops_cli/github/repo_ref.py (docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md:1, src/devops_cli/github/repo_ref.py:102). [sources: docs/CLUSTER.md:296, docs/CLUSTER.md:300, docs/adr/0029-the-roadmap-service-serves-a-read-only-api.md:1, docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md:1, src/devops_cli/github/repo_ref.py:102]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4563, #4581, #4533

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    scope/service
    status/new
    value/high
    effort/medium
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/service. The (service) scope of the title gives the scope.
    • Priority: P2-Medium. It is a required piece of the service read API but has unmet dependencies and no failure or advisory driving it.
    • Value: High. It lets the read API answer from Valkey with no GitHub request, which is a core service requirement.
    • Effort: Medium. The body estimates about 4 hours to build with clear acceptance criteria and defined keys.
    • Related: refactor(github): roadmap store that reads and writes items, releases and board fields behind one interface #768, which asks for a different change. Both deal with reading and writing roadmap items, but #768 unifies the GitHub read/write interface while this candidate adds a Valkey-backed read model for the service read API.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 13, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The searches found valkey-py, the maintained Python Valkey client that the issue already names, and it supplies every Valkey command the design needs (hashes, sets, expiry/TTL, RENAME, pipelines). It is only a client, though: the read model itself, its writer in the issue listing, the webhook update and the ACL wiring still have to be built, so it covers only the storage half of the need.

    The repository already uses this tool.

    Tool: valkey-io/valkey-py (https://github.com/valkey-io/valkey-py)

    • License: MIT
    • Last activity: 2026-11-02
    • Maintained: yes

    Covers:

    • Client for hashes and sets: HSET/HGETALL and SADD/SMEMBERS
    • Expiry of a key with EXPIRE, which gives each item hash its 1 day TTL
    • RENAME, for replacing the set of open numbers with a temporary key
    • Pipelines, to batch the writes of one listing round
    • Connection pools and async clients for the router replicas

    Lacks:

    • The read model itself: key names from RepoRef, fields, record marks and updated_at
    • The writer function inside the issue listing and its move to the sweep
    • Updating an item hash from an issues delivery payload
    • The router ACL user for item:/items: and the state keys
    • The memory plan of valkey-roadmap

    Tools considered:

    Searches run:

    • valkey-py Python client hashes sets TTL RENAME, results: 5
    • Redis OM Python object mapping hashes, results: 5
    • valkey-py redis-py fork Python Valkey client library, results: 5
    • valkey-py, results: 5

    Sources:

    Checked on 2026-11-13. A person decides what this means for the item. The check changes no label and closes no issue.

  6. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at b15faab while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

  7. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in 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/servicesource/agentstatus/newtype/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions