Skip to content

feat(roadmap): keep alternatives results in a brain index - #7320

Merged
dan-petty merged 11 commits into
mainfrom
feat/4676-brain-index-of-alternatives-results
Nov 26, 2026
Merged

dan-petty merged 11 commits into
mainfrom
feat/4676-brain-index-of-alternatives-results

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The alternatives row of the Service now runs the step brain-sync after its checks. The step copies the check of each issue that changed since its watermark into a brain index in valkey-roadmap: one hash for the item, one for its tool and one for each reference repository, each with a TTL of 45 days, and one entry of an audit stream. The keys of one item go in one transaction, and the entry of the newer check stays.

Before, the result of a check was only in the block and the job record of its issue, and no reader joined the results. The index joins the verdicts, the tools and the references of a repository. The step sends no GitHub request, because it reads the listing that the round already holds.

A round whose store is down or not configured ends as before and counts one fallback. The roadmap Service pod becomes the first client of the store: it gets the client label, the password of the user brain and one egress rule to the store.

Closes #4676

Change: openspec/changes/archive/2026-11-26-4676-brain-index-of-alternatives-results/

@dan-petty dan-petty added type/feature Type feature: a new function scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them labels Nov 26, 2026
@dan-petty

dan-petty commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner Author

Test results, deploy steps and the pending live proof

Head commit: 79fe1d9458b82edce83ffc54f4a80308ce9534d0. The branch holds origin/main at 15bc4af, after #7306 and #7317.

Checks on the workstation

Command Result
uv run devops ci --check --only lint,format,docs,constructs,openspec,test-settings,test-tree,startup-imports,swallowed-failures,k8s Each row passes.
uv run devops ci test tests/roadmap tests/valkey tests/telemetry tests/invariants tests/server/routes tests/k8s tests/commands/k8s tests/config tests/security/test_config_declarations.py 12522 passed, 1 skipped.
uv run mypy on the 9 changed files of src/ No issues.
uv run devops ci fail-to-pass --base origin/main Exit 0. The 3 new test modules error on the base, 8 changed tests fail there, and the k8s row has 1 of 186 cases that fails on the base and 0 on the head (runner.check_only_the_service_pod_may_reach_the_api_server).

Fix round after the review

  • A record of a wrong form no longer stops the sync. project_of and _pypi_name of src/devops_cli/roadmap/inventory.py called urlsplit with no guard, so a tool URL or a link such as https://[cluster-ip]:6443/healthz raised ValueError, and the row failed in each round. They now give None for a string that the URL parser refuses, as their docstrings say. A PyPI page whose last part is no name of a package gives no package URL, and the key id of a text with a lone surrogate is still 16 hex characters. The same error was in the read of a PyPI record and in the reference step, which read project_of for each URL that an item names.
  • Only the issue of a trusted author gives an entry. The body of an issue holds its job record, and the repository is public. An account with no write access could write a block and a record of its own, and the sync copied it into the index. entry_of now gives no entry for an issue that is_trusted refuses.
  • A new password restarts the Service pod. The row devops/valkey-roadmap-auth of the Secret table restarts deployment/valkey-roadmap and then deployment/roadmap-service.
  • A property test gives each value of a record open text, with lone surrogates and URLs of GitHub and PyPI with open paths: the read of an entry raises nothing.

Steps of a person after the merge

  1. Argo CD rolls out Deployment roadmap-service with the label valkey-client: "true", the variable DEVOPS_CLI_ROADMAP_STATE_PASSWORD (key brain of Secret valkey-roadmap-auth, which the cluster holds) and the new rule of roadmap-service-egress.
  2. Run uv run devops k8s deploy-stack --stack devops from a checkout of main. It writes roadmap.state.url and roadmap.state.username to ConfigMap devops-cli-config. On 2026-11-26 the live ConfigMap holds no roadmap.state.
  3. Restart deployment/roadmap-service when its pod is older than the ConfigMap, because a process reads the settings at its start.
  4. Until steps 2 and 3 are done, each alternatives round ends as before and adds one fallback to devops_cli_brain_reads_total{store="brain_index"}.

Pending live proof (issue #4676)

After the release, the alternatives row checks 3 items as the App. A comment on the issue gives the result line of each item, its entry from HGETALL roadmap:v1:brain-item:<owner>/<name>:<n> as the user agent, and devops_cli_brain_sync_lag_seconds{store="brain_index"} against the interval of the row. The first round of a repository copies each check that the listing holds, at most 500.

The real store

The coordinator ran the code of this branch on 2026-11-26 against Valkey 9.2.1 in a temporary namespace, with the aclfile of the template and throwaway passwords, through roadmap_state_tier() as the user brain. BrainIndex.write gave new, then replaced for the same check, then kept for an older check. advance, watermark and item_keys answered. The keys of acme/widgets held no key of acme/widgets-two. Each item, tool, reference and stream key had a TTL of 3,888,000 s, and the watermark had none. So WATCH, MULTI, EXEC, HSET, EXPIRE, XADD, HSCAN and SCAN are open to brain.

Not verified here

  • The contract suite of the Valkey fake has no scenario for XADD with MAXLEN and for SCAN with MATCH. A record needs a real valkey-server, which the devcontainer does not hold.
  • The reference step with an item text that names a string such as https://[cluster-ip]:6443/healthz: the fix of project_of covers it, and project_of has its test, but no test runs the step with such a text.

Follow-up, not in this pull request

@dan-petty

Copy link
Copy Markdown
Owner Author

Review of the coordinator, 2026-11-26, at f58f0eb. The pull request stays a draft until one defect is fixed.

Defect, in work. A malformed URL in one job record makes the sync raise. project_of and _pypi_name of src/devops_cli/roadmap/inventory.py call urlsplit with no guard, so checked_entry raises ValueError for a tool URL such as https://[cluster-ip]:6443/healthz (probed on this branch). The sync reads each issue of the snapshot after the checks of the round, so one such record fails the row in each round. The fix goes to the two functions, which are on main already.

Test against a real store. Valkey 9.2.1 in a temporary namespace, with the aclfile of the template and throwaway passwords, through roadmap_state_tier() as the user brain:

Check Result
BrainIndex.write of a new check, the same check, an older check new, replaced, kept
advance, watermark, item_keys each answers; the watermark holds the place and the time of the sync
Keys of acme/widgets against acme/widgets-two the scan of one repository holds no key of the other
TTL 3,888,000 s on each item, tool, reference and stream key; none on the watermark
Commands as brain WATCH, MULTI, EXEC, HSET, EXPIRE, XADD, HSCAN and SCAN are open

Service wiring. The egress rule names the pods of the store and TCP 6379 only, the Secret reference is optional, and no Job template and no container agent gets a key.

After the merge. uv run devops k8s deploy-stack --stack devops from main writes roadmap.state.url and roadmap.state.username to the live ConfigMap; then the Service pod restarts. Until then each round counts one fallback and goes on.

@devops-cli-service

Copy link
Copy Markdown
Contributor

Pull request #7320 has merge conflicts with main at commit f58f0eb89a16. GitHub cannot merge it. Rebase the branch onto the current main, resolve the conflicts and push the branch.

@dan-petty
dan-petty force-pushed the feat/4676-brain-index-of-alternatives-results branch from f58f0eb to 79fe1d9 Compare November 26, 2026 17:41
@dan-petty

Copy link
Copy Markdown
Owner Author

Second review of the coordinator, 2026-11-26, at 79fe1d9 (rebased on main after #7306 and #7317).

  • The defect is fixed at its cause in src/devops_cli/roadmap/inventory.py. Probe on this head: canonical_id, project_of and checked_entry raise nothing for https://[cluster-ip]:6443/healthz, http://[{host}]:{port}, https://[::1, https://example.com:8080, https://pypi.org/project/ / and a PyPI URL with a lone surrogate, as the tool URL and inside alternatives.refs. Such a string is its own tool id and is no reference.
  • The fix also closes the same error for a model-written tool URL in the alternatives check and in the reference step of feat(roadmap): link reference implementations in each checked item #7306, which are on main.
  • The second read of the builder found a trust gap and closed it: the index takes no entry from the issue of an author that is_trusted refuses, so an outside account cannot write a block and a record into its own issue and get them into the index.
  • A new password of the store now also restarts the Service pod.
  • The four main test files pass here (108 passed), and each check of the head is green.

After the merge. uv run devops k8s deploy-stack --stack devops from main writes roadmap.state.url and roadmap.state.username to the live ConfigMap, then the Service pod restarts. Until then each round counts one fallback and goes on. The live proof follows on #4676: the result lines of 3 items, their index entries, and the sync lag.

@dan-petty
dan-petty marked this pull request as ready for review November 26, 2026 17:50
@dan-petty
dan-petty merged commit ef01e07 into main Nov 26, 2026
29 checks passed
@dan-petty
dan-petty deleted the feat/4676-brain-index-of-alternatives-results branch November 26, 2026 17:51
dan-petty-release Bot added a commit that referenced this pull request Nov 26, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.223.0](v0.222.0...v0.223.0)
(2026-11-26)


### Features

* **roadmap:** keep alternatives results in a brain index
([#7320](#7320))
([ef01e07](ef01e07))
* **roadmap:** link reference implementations in each checked item
([#7306](#7306))
([15bc4af](15bc4af))


### Code Refactoring

* **k8s:** delete the environment files from devops-cli
([#7317](#7317))
([66cb933](66cb933)),
closes [#7290](#7290)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(roadmap): keep alternatives results in a brain index

1 participant