Repository navigation
Description
Problem
PR #6629 (#6615) adds a guard to the project review dispatcher (_foreign_workload in src/devops_cli/roadmap/project_review/dispatch.py). It checks the result rows of each Prometheus and Loki rows fact. A row fails when a label of _NAMESPACE_LABELS (namespace, exported_namespace, dest_namespace) has a value outside the project namespaces, or when the row holds a label of _WORKLOAD_LABELS (pod, container, service and others) and no namespace.
The guard is a list of labels to refuse. A row passes when it names a workload or a namespace of another project in a label that is not on the list: a label that label_replace or group_left writes, or the Argo CD label name. The verify review of PR #6629 found this, and the PR documents that the guard checks only the labels in its lists. No shipped fact gives such a row today. A new catalog fact can give one, and the guard will not see it.
Expected
- The guard refuses by default. A row with a namespace label in the project namespaces can hold any label. A row with no project namespace can hold only labels from a list of safe labels, for example
resource,code_class,leandquantile, taken from the labels that the shippedrowsfacts keep. - A refusal names the fact id and the label name, never a label value, as now.
- The docs (the dispatch.py docstring, the catalog header, docs/ROADMAP_WORKFLOW.md and the spec) say that the guard refuses each label that is not on the safe list.
Acceptance criteria
- Test first: a row with no namespace and a label that is not on the safe list (for example
name) marks the facterror. The test fails on the base. - A test: a row of a project namespace with any label passes, and a row by
resourceonly passes. - A test: the shipped catalog loads, and a fixture run of each shipped
rowsfact gives no guard error.
Dependencies
- fix(roadmap): keep other projects' workload names out of the review #6615 adds the guard (PR fix(roadmap): keep other projects' workload names out of the review #6629).
Source
Source: #6629
Alternatives check of 2026-11-21: none.
Tool: none found.
Reason: Searches found no library that validates Prometheus or Loki result rows against a safe-label list; the change is inside the project's own _foreign_workload guard, so only its code and docs can cover it.
Lacks:
- Default-refusal allowlist of safe row labels
- Refusal naming fact id and label name only
- Tests for a project-namespace row with any label
- Docs and spec wording of the allowlist rule
Proposed design
Problem statement
The row guard of the project review dispatcher refuses only the labels on two lists. A row that names a workload or a namespace of another project in a label that is not on a list passes, such as a label that label_replace writes or the Argo CD label name. The fix makes the guard refuse by default: a row with a project namespace passes with any label, and a row with no project namespace may hold only labels of a safe list.
Acceptance criteria
Requirement: Row guard refuses an unknown label by default
The row guard SHALL mark a rows fact error when a row holds no project namespace and a label that is not on the safe list.
Scenario: Row with an unknown label and no namespace
- WHEN A test gives
_read_factarowsfact and a Prometheus answer with one series that holds the labelnameand no namespace label. - THEN The fact status is
error, the reason names the fact id andname, and the same test givesokon the base commit.
Requirement: Row of a project namespace passes with any label
The row guard SHALL pass a row whose namespace labels all hold project namespaces, whatever other labels it holds.
Scenario: Row with a project namespace and the Argo CD label
- WHEN A test gives a
rowsfact a series withnamespaceset to a project namespace and the labelname. - THEN The guard returns
Noneand the fact status isok.
Requirement: Row of safe labels passes
The row guard SHALL pass a row that holds no namespace label and only labels of the safe list.
Scenario: Row by resource and le
- WHEN A test gives a
rowsfact a series with the labelsresourceandleand no namespace label. - THEN The guard returns
Noneand the fact status isok.
Requirement: Shipped rows facts give no guard error
Each shipped rows fact SHALL give no guard error when a row of the labels that it keeps goes through the guard.
Scenario: Guard run over each shipped rows fact
- WHEN A test loads
src/devops_cli/roadmap/project_review/catalog.yamland builds one row from the labels that each fact ofshape: rowskeeps. - THEN The guard returns
Nonefor each fact, and no shippedrowsfact keeps a label that is not on the safe list.
Requirement: Docs state the default refusal
The dispatcher docstring, the catalog header and docs/ROADMAP_WORKFLOW.md SHALL state that the guard refuses each label that is not on the safe list.
Scenario: Rule stated in each document
- WHEN A test reads the module docstring of
src/devops_cli/roadmap/project_review/dispatch.py, the header ofsrc/devops_cli/roadmap/project_review/catalog.yamlanddocs/ROADMAP_WORKFLOW.md. - THEN Each text states that the guard refuses each label that is not on the safe list.
Existing Tool Considered
The alternatives check of 2026-11-21 in the issue body records verdict none and names no tool, and its Lacks: list holds what the change must add. No open, maintained library validates Prometheus or Loki result rows against a safe-label list, so the change builds its own code in _foreign_workload of src/devops_cli/roadmap/project_review/dispatch.py. Cost: about 15k tokens to write the guard and its tests, about 4k tokens a year to keep and fix, and half a day of elapsed time. A library would add a dependency and its upgrade churn for about 25 lines of code.
Key questions
- Which labels are on the safe list, and where does the list live?: A hand-kept constant
_SAFE_ROW_LABELSindispatch.pyholdsresource,code_class,leandquantile. The shipped-catalog test proves the list complete. A list derived from the catalog would change with a new fact and hide the new label. (best practice) [sources: src/devops_cli/roadmap/project_review/dispatch.py:131, src/devops_cli/roadmap/project_review/catalog.yaml]- Chosen: Hand-kept constant. The list is visible in one place, and a new catalog label fails the shipped-catalog test until a person adds it.
- Rejected: Derive the list from the catalog clauses at load time. A new fact would widen the guard with no review, and the loader reads the
byandonclauses for another purpose.
- Does the guard check the
__name__label?: No. The guard skips__name__, because it is the metric name and_vector_valuealready drops it from a row's labels. A check of it would refuse each row. (best practice) [sources: src/devops_cli/roadmap/project_review/dispatch.py]- Chosen: Skip
__name__. The metric name is no dimension of a row, and_vector_valuedrops it from the row labels that a fact keeps. - Rejected: Put
__name__on the safe list. The safe list would hold a label that no fact keeps, and the rule would read as if a metric name were safe data.
- Chosen: Skip
- What happens to
_WORKLOAD_LABELSindispatch.py?: The change removes it fromdispatch.py. The default refusal covers each of its labels because none is on the safe list.catalog.pykeeps its own copy for the loader. (best practice) [sources: src/devops_cli/roadmap/project_review/dispatch.py:131, src/devops_cli/roadmap/project_review/catalog.py:78]- Chosen: Remove the copy in
dispatch.py. One rule refuses the labels, so a second list cannot drift from it. - Rejected: Keep both rules. Two lists give two reasons for one row and need a second update for each new workload label.
- Chosen: Remove the copy in
- Which label does a refusal name when several labels are off the safe list?: The first label in sorted order, as
min(named)does today. The order is deterministic and the reason names one label. (best practice) [sources: src/devops_cli/roadmap/project_review/dispatch.py:328]- Chosen: Sorted first label. The same row gives the same reason on each run, whatever the order of the labels in the answer.
- Rejected: First label in the answer order. The order comes from the JSON answer and can change between readers.
- Does the refusal message change?: No.
MESSAGES.roadmap.review_foreign_workloadtakes the fact id and the label name and no label value. [sources: src/devops_cli/roadmap/project_review/dispatch.py] - Does the guard still refuse a foreign namespace when the row also holds a project namespace?: Yes. The namespace check runs first, so a namespace label whose value is not in
roadmap.project_review.namespacesgiveserror, as it does now. (best practice) [sources: src/devops_cli/roadmap/project_review/dispatch.py:328]- Chosen: Namespace check first. The reason names the namespace label, and the rule of a foreign namespace stays the same.
- Rejected: Default refusal first. A row with a foreign namespace would give a reason about the safe list, not about the namespace.
- Is fix(roadmap): keep other projects' workload names out of the review #6615 still a dependency?: No.
_foreign_workloadis atsrc/devops_cli/roadmap/project_review/dispatch.py:328in the base, so PR fix(roadmap): keep other projects' workload names out of the review #6629 delivered the guard. [sources: src/devops_cli/roadmap/project_review/dispatch.py:328]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 21, 2026
Both work on the row guard in dispatch.py, but #6615 adds the guard with a blocklist and the candidate refines it to an allowlist model.devops-cli-service commentedon Nov 21, 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 (2)
Searches run:
Sources:
devops-cli-service commentedon Nov 22, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
fix(roadmap): refuse unlisted labels in row guard (#6632)
test(roadmap): avoid private imports in row guard dispatch test (#6632)
devops-cli-service commentedon Nov 25, 2026
Released in v0.219.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.219.0
devops-cli-service commentedon Nov 25, 2026
Live since 2026-11-25 17:09 UTC