Repository navigation
Description
Problem or Motivation
A dependency update must edit knowledge base pages under src/. Of 109 dependency update commits on main since 2026-11-01, 19 changed a file under src/ or tests/, and the largest group is the pages under src/devops_cli/ai/knowledge_base/ (19 file edits).
The cause: each page states the versions that it applies to (applies_to, for example pkg:pypi/<name>@<locked minor>.*), and src/devops_cli/ai/kb.py (near lines 272 to 279 and 380 to 406) reads uv.lock and reports a page whose range does not hold the locked version as drift. Until #7229 three tests of tests/review/test_kb_manuals_metadata.py failed on that drift. #7229 removed these tests, but the pages still hold a copy of the locked version.
Owner rule of 2026-11-19: a dependency version lives only in the manifest of its package manager, and an update that changes no interface needs no edit under src/ or tests/.
Proposed Solution
Disposition: change the code and the pages.
- A page names the library, and names a version only where its text is true for that version alone (a floor, such as "from 2.0").
- The drift report compares the page with the version that ran only when the page states a floor or a ceiling.
- Remove the exact minor ranges from the front matter of the pages.
Proof: a Renovate minor update of one Python library passes CI with no edit of a page. A test of kb.py with a page and a lock that the test writes.
Existing Tool Considered
Renovate has no manager for prose. The fix is to hold no copy of the pin. No new code is necessary.
Alternatives check of 2026-11-25: not-applicable.
Class: refactor, no search.
Tool: none found.
Proposed design
Problem statement
Remove the locked version from the knowledge base pages. Keep the drift report for a page that states a floor or a ceiling. A dependency update edits knowledge base pages under src/devops_cli/ai/knowledge_base/, because each page states an exact minor range in its applies_to front matter. src/devops_cli/ai/kb.py reads uv.lock and reports a page as drift when its range does not hold the locked version. The owner rule of 2026-11-19 puts each version in the manifest of its package manager alone.
Acceptance criteria
Requirement: A version-free applies_to entry is valid
The front-matter validator SHALL accept an applies_to entry that names a package or a tool with no version.
Scenario: A package name with no version passes validation
- WHEN The test in
tests/ai/test_kb.pyvalidatesKbFrontMatterwithapplies_toset topkg:pypi/requests. - THEN
KbFrontMatteraccepts the value, andparse_manual_front_matterreturns an empty error.
Requirement: A page with no version does not drift
The matcher SHALL report no drift for a page whose applies_to entry holds no version, whatever the locked version is.
Scenario: A lock change keeps the page matched
- WHEN A test in
tests/ai/test_kb.pywrites auv.lockwith version 2.31.0 and loads a page withpkg:pypi/requests, then writes 2.32.0 and loads the page again. - THEN
load_matched_kb_manualsputs the page inmatchedand not indriftin both runs.
Requirement: A bare package that the lock does not hold is drift
The matcher MUST report drift when a page names a package that the locked inventory does not hold.
Scenario: A missing package is drift
- WHEN A test in
tests/ai/test_kb.pywrites auv.lockwith norequestsentry and loads a page withpkg:pypi/requests. - THEN
load_matched_kb_manualsputs the page indriftwith a reason that holdsnot found in locked inventory.
Requirement: A locked version inside a floor matches
The matcher MUST report no drift when the locked version is at or above a stated floor.
Scenario: A locked version above the floor matches
- WHEN A test in
tests/ai/test_kb.pywrites auv.lockwith version 2.31.0 and loads a page withpkg:pypi/requests@>=2.0. - THEN
load_matched_kb_manualsputs the page inmatchedand not indrift.
Requirement: A locked version below a floor is drift
The matcher MUST report drift when the locked version is below a stated floor.
Scenario: A locked version below the floor is drift
- WHEN A test in
tests/ai/test_kb.pywrites auv.lockwith version 1.9.0 and loads a page withpkg:pypi/requests@>=2.0. - THEN
load_matched_kb_manualsputs the page indriftwith a reason that holds>=2.0and1.9.0.
Requirement: The bundled pages hold no exact range
Each knowledge base page SHALL hold no exact minor range and no == pin in a pkg: or tool: entry of its applies_to front matter.
Scenario: The bundled pages are scanned for exact ranges
- WHEN A test in
tests/ai/test_kb.pyreads each page undersrc/devops_cli/ai/knowledge_base/withparse_manual_front_matter. - THEN No
pkg:ortool:entry ends with.*, and no entry holds==.
Requirement: Pending a person after the merge
A Renovate minor update of one Python library MUST pass CI with no edit under src/devops_cli/ai/knowledge_base/.
Scenario: The next Renovate minor update passes with no page edit
- WHEN After the merge, Renovate opens a minor update pull request for one Python library.
- THEN The required checks pass, and the pull request changes no file under
src/devops_cli/ai/knowledge_base/.
Existing Tool Considered
No open tool covers the need. The alternatives check of 2026-11-25 in the issue body gives the verdict not-applicable: class refactor, no search, no tool found. The need is to stop holding a copy of a version in prose, and Renovate has no manager for prose. The proposal builds no new component, so no tool exists to match. The written cost is about 20 changed lines in src/devops_cli/ai/kb.py, one line in each page that holds an exact range, and no new dependency or module to keep.
Key questions
- Which form does an
applies_toentry take when the page holds no version?: The entry names the package or the tool and stops before@, such aspkg:pypi/requestsortool:ruff. A page keeps a version only as a floor or a ceiling, such aspkg:pypi/requests@>=2.0, where its text is true from that version on. A barepkg:name still drifts when the locked inventory does not hold the package, because the page names a library that the environment must have. (best practice) [sources: src/devops_cli/ai/kb.py:184]- Chosen: Bare name with no
@. It holds no copy of a version. The owner rule of 2026-11-19 puts each version in the manifest of its package manager alone. - Rejected: Wildcard
@*. It still holds a version-shaped token, and it keeps a copy of the pin that the owner rule removes. - Rejected: Keep the exact minor range. It is the cause of the drift and of the page edit on each dependency update.
- Chosen: Bare name with no
- Does the drift report keep a comparison for a page that states a floor or a ceiling?: Yes. The matcher keeps the range path. A page with
>=2.0matches a locked version at or above 2.0 and drifts below it. A page with no version does not drift on a version change. (best practice) [sources: src/devops_cli/ai/kb.py]- Chosen: Keep the range path and drop only the exact range. The owner rule allows a version where the text is true from that version on.
_version_matches_patternalready builds aSpecifierSetfor each operator. - Rejected: Remove the drift report for pages. It removes the check that a floor still holds, and the owner rule keeps the floor.
- Rejected: Compare only the major version. The page states a floor, not a major range, and a major compare hides a real mismatch.
- Chosen: Keep the range path and drop only the exact range. The owner rule allows a version where the text is true from that version on.
- Where does
kb.pyread the locked version, and how does a test give it a lock?:_lookup_uv_lock_versionreadsuv.lockin the current folder into the module cache_UV_LOCK_CACHE._read_uv_lock_versionsmaps each package name, in lower case with-, to its version. A test writes auv.lockin a temporary folder, changes to it, and callsreset_uv_lock_cache()before each read. A test can also passlocked_packagestoload_matched_kb_manuals. [sources: src/devops_cli/ai/kb.py, tests/ai/test_kb.py:165] - What else in the repository reads
applies_to?: The repository definesapplies_toinsrc/devops_cli/ai/kb.py:184and again atsrc/devops_cli/ai/review/defects.py:139. The proposal changes the grammar inkb.pyand the pages. Refine reads line 139 and confirms that the second field accepts the bare form, or changes it in the same pull request. [sources: src/devops_cli/ai/review/defects.py:139, src/devops_cli/ai/kb.py:184] - Do the three tests that test(tests): remove tests that force a version or a setting #7229 removed come back?: No. The pull request adds a test in
tests/ai/test_kb.pythat writes a page and auv.lock. It does not restore the removed tests intests/review/test_kb_manuals_metadata.py, because they asserted the exact range that the owner rule removes. (best practice) [sources: tests/ai/test_kb.py:165, tests/review/test_kb_manuals_metadata.py, src/devops_cli/ai/kb.py]- Chosen: Add a new test in
tests/ai/test_kb.py. It asserts the new behavior with a page and a lock that the test writes. - Rejected: Restore the three removed tests. They asserted the exact range and the drift that the change removes.
- Chosen: Add a new test in
- Which pages hold an exact minor range?: The scan covers each page under
src/devops_cli/ai/knowledge_base/with apkg:ortool:entry. The count is not known before the scan. The new test names each page that still holds a.*wildcard or an==pin, and the pull request edits each page that the test names. [sources: tests/ai/test_kb.py] - Which documents show the old front-matter form?: Refine reads
src/devops_cli/ai/knowledge_base/README.mdand each document that describes the front matter. The pull request changes each one that shows the old form. AGENTS.md rule 8 keeps a document true in the pull request that makes it wrong. (best practice) [sources: AGENTS.md, src/devops_cli/ai/knowledge_base/README.md]- Chosen: Update each document in the same pull request. AGENTS.md rule 8 forbids a document that the change makes wrong.
- Rejected: Update the documents in a second pull request. It leaves
mainwith a wrong example and breaks the one-issue-one-pull-request rule.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 25, 2026
Both edit the same applies_to front matter and the kb.py drift path, but #6998 widened one library's range while the candidate removes all exact pins and changes the comparison rule.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.
chore(main): release 0.252.0 (#7808)
devops-cli-service commentedon Nov 29, 2026
Released in v0.252.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.252.0
devops-cli-service commentedon Nov 29, 2026
Live since 2026-11-29 18:59 UTC