Repository navigation
Description
Unhardened Defect PR Audit Finding
Defect Pull Request #3680 was merged without adding guardrails or lessons to any declared hardening surface.
Declared Hardening Surfaces
docs/TESTING.mdARCHITECTURE.mdSECURITY.mdCONTRIBUTING.mdsrc/devops_cli/ai/tasks/*.mdsrc/devops_cli/ai/knowledge_base/.devops/review.tomlsrc/devops_cli/review/rules/
Per project invariants (AGENTS.md), defect fixes must codify root-cause guardrails into at least one declared surface to prevent recurrent regressions.
Proposed design
Problem statement
Pull request #3680 fixed the Service counters: each label set starts at zero when the Service starts, and the failure counter carries repo. At merge the hardening audit counted neither tests/ nor openspec/specs/, so it filed this issue; #3684 made both declared surfaces, and the audit now reports #3680 as hardened through tests/telemetry/test_service_counter_series.py and openspec/specs/roadmap-service-counters/spec.md. No document states the root cause or the rule for the next author. The change adds that lesson to ARCHITECTURE.md and names the existing guardrails.
Acceptance criteria
Requirement: Lesson in a declared surface
The change MUST add a bullet to ARCHITECTURE.md that names pull request #3680, the missing zero series and repo label as the root cause, and tests/telemetry/test_service_counter_series.py and openspec/specs/roadmap-service-counters/spec.md as the guardrails.
Scenario: The lesson names the defect and the guardrails
- WHEN a check reads
ARCHITECTURE.md - THEN the text holds
#3680, the missing zero series andrepolabel as the root cause, and both guardrail paths
Requirement: Existing guardrails
The change MUST name the existing regression tests and the living spec that fail when the Service counters lose their zero series or their repo label, and those guardrails MUST pass.
Scenario: The named guardrails run
- WHEN a check runs
uv run devops ci test tests/telemetry/test_service_counter_series.pyand readsopenspec/specs/roadmap-service-counters/spec.md - THEN the test module passes, and the spec holds the zero-series requirement and the
repolabel
Requirement: Documentation checks
The change MUST pass the documentation checks after the edit to ARCHITECTURE.md.
Scenario: The documentation checks run
- WHEN
uv run devops docs checkruns - THEN the command exits 0
Requirement: Hardening audit report
The hardening audit MUST count the new ARCHITECTURE.md lines as a hardened surface for the pull request that delivers the change.
Scenario: The audit reads a file list
- WHEN
audit_pr_hardeningreceives a file list with additions underARCHITECTURE.md - THEN
is_hardenedis true andhardened_surfacesnamesARCHITECTURE.md
Requirement: Pull request form
The pull request MUST have a Conventional Commit title docs(telemetry): <summary> with a declared scope and a summary of at most 60 characters, and a body that ends with Closes #3683 and the Change: line.
Scenario: The form check reads the pull request
- WHEN
devops pr createchecks the title and the body - THEN the check accepts both and adds
type/docsandscope/telemetry
Existing Tool Considered
The open, maintained pytest and the OpenSpec spec layer cover the guardrail: tests/telemetry/test_service_counter_series.py fails if a failure class or repository has no zero series or the failure counter loses its repo label, and openspec/specs/roadmap-service-counters/spec.md states the requirement and its scenarios. They lack a check of a document's prose, so uv run devops docs check and review keep the lesson. No open tool writes a project rule into ARCHITECTURE.md; the change is one bullet in an existing Markdown file. Cost: about 3,000 tokens to write, about 500 tokens per quarter to keep, and about 20 minutes of elapsed time. It deletes no internal code.
Key questions
- What root cause did pull request fix(telemetry): Service counters read true across pods and repos #3680 fix?: Pull request fix(telemetry): Service counters read true across pods and repos #3680 delivered the change of issue fix(telemetry): Service counters read true across pods and repos #3495. The Service counters gave a false picture: each release starts a new pod, a labelled counter has no series until its first increment, and the
/metricsscrape of the new pod had no zero sample, soincrease()lost the first count of each label set. The failure counterdevops_cli_service_implement_failures_totalalso had norepolabel, so one series mixed all repositories. [sources: openspec/changes/archive/2026-11-05-3495-service-counters-zero-series-repo-label/proposal.md:5, openspec/changes/archive/2026-11-05-3495-service-counters-zero-series-repo-label/design.md:5, docs/TELEMETRY.md:37, CHANGELOG.md:318] - Did the hardening audit run on pull request fix(telemetry): Service counters read true across pods and repos #3680?: Yes. The workflow runs on a closed, merged pull request that carries
type/bugortype/security;devops pr creategives afix(...)titletype/bug. Before fix(ci): count tests and specs as hardening guardrails #3684 the workflow filed an issue with the finding text, and this issue is that finding. At that timetests/andopenspec/specs/were not declared surfaces, so the audit reported fix(telemetry): Service counters read true across pods and repos #3680 as missing. fix(ci): count tests and specs as hardening guardrails #3684 then added both surfaces, and fix(telemetry): Service counters read true across pods and repos #3680'stests/telemetry/test_service_counter_series.pyandopenspec/specs/roadmap-service-counters/spec.mdnow make the audit report fix(telemetry): Service counters read true across pods and repos #3680 as hardened. [sources: .github/workflows/defect-pr-hardening-audit.yml:26, CONTRIBUTING.md:131, openspec/changes/archive/2026-11-05-3479-hardening-audit-counts-tests-and-specs/proposal.md:5, src/devops_cli/github/defect_classifier.py:29, CHANGELOG.md:315] - Is the issue's audit premise still true?: No. fix(ci): count tests and specs as hardening guardrails #3684 made
tests/andopenspec/specs/declared surfaces, and fix(telemetry): Service counters read true across pods and repos #3680 addedtests/telemetry/test_service_counter_series.pyand the livingopenspec/specs/roadmap-service-counters/spec.md;audit_pr_hardeningnow counts those additions and reports fix(telemetry): Service counters read true across pods and repos #3680 as hardened. The issue still stands for its other need: no document states the root cause or the rule for the next author. [sources: src/devops_cli/github/defect_classifier.py:29, tests/telemetry/test_service_counter_series.py:72, openspec/specs/roadmap-service-counters/spec.md:8, CHANGELOG.md:315, openspec/changes/archive/2026-11-06-2660-no-clean-default-guardrail/proposal.md:31] - Which project rule makes a defect fix add a guardrail?:
AGENTS.mdrule 11 says to fix the cause at its source and, when an outside constraint blocks the fix, to add a check that fails if the problem returns. Rule 4 says to test new behavior first and to prove any other change with a command. [sources: AGENTS.md:19, AGENTS.md:12] - Which declared hardening surface holds the missing lesson?:
ARCHITECTURE.md, with a bullet in section 6 that names fix(telemetry): Service counters read true across pods and repos #3680, the missing zero series andrepolabel as the root cause, and the existing tests and living spec as the guardrails. The guardrails already exist:tests/telemetry/test_service_counter_series.pyandopenspec/specs/roadmap-service-counters/spec.md;tests/andopenspec/specs/are declared surfaces.ARCHITECTURE.mdis the declared surface that owns the telemetry architecture, and no document states the root cause for the next author. (best practice) [sources: src/devops_cli/github/defect_classifier.py:29, ARCHITECTURE.md:152, tests/telemetry/test_service_counter_series.py:72, openspec/specs/roadmap-service-counters/spec.md:8, docs/TESTING.md:92, openspec/changes/archive/2026-11-06-2660-no-clean-default-guardrail/proposal.md:9]- Chosen: Lesson in ARCHITECTURE.md.
ARCHITECTURE.mdis a declared surface and owns the telemetry architecture; the bullet records the root cause and names the existing regression tests and living spec, which is what no document does today. - Rejected: New regression test in the file of the behaviour. fix(telemetry): Service counters read true across pods and repos #3680 already added
tests/telemetry/test_service_counter_series.py, andtests/is now a declared surface, so a new test would duplicate the guardrail. - Rejected: Living spec update.
openspec/specs/roadmap-service-counters/spec.mdalready states the zero-series requirement and its scenarios; the missing part is the narrative root cause for the next author. - Rejected: Semgrep rule in the rule pack. The defect is a metric label-set rule, not a code pattern; the rule pack holds one network policy rule and cannot read a process's metric registry.
- Rejected: Suppression in
.devops/review.toml. A suppression hides a finding with a reason and an expiry; it prevents no return of the defect.
- Chosen: Lesson in ARCHITECTURE.md.
- How does the change keep the guardrail from disappearing?: The existing guardrails are the regression tests and the living spec:
tests/telemetry/test_service_counter_series.pyfails if a failure class or repository has no zero series or the failure counter loses itsrepolabel, andopenspec/specs/roadmap-service-counters/spec.mdstates the requirement. The lesson names both, anduv run devops docs checkchecks the document. A new invariant test forARCHITECTURE.mdis not added becausedocs/TESTING.mdsays a document change gets no test and names a repeatable command instead. (best practice) [sources: tests/telemetry/test_service_counter_series.py:72, openspec/specs/roadmap-service-counters/spec.md:8, docs/TESTING.md:61, docs/TESTING.md:92]- Chosen: Existing regression tests and living spec. They already fail or block a return of the defect, and
tests/andopenspec/specs/are declared surfaces; the lesson names them. - Rejected: New invariant test for the document.
docs/TESTING.md:61-62says a document change gets no test and names a repeatable command such asuv run devops docs check; the 2660 change followed that rule. - Rejected: No check. The lesson can be deleted, but the guardrail against the defect stays in the tests and the spec; the document check and review keep the lesson.
- Chosen: Existing regression tests and living spec. They already fail or block a return of the defect, and
- Which open tool holds a guardrail that is a code pattern?: No Semgrep rule is needed. The defect is a metric label-set rule, and the open, maintained
pytesttests intests/telemetry/test_service_counter_series.pyalready cover it. Semgrep is the open tool for a code pattern and its rule pack issrc/devops_cli/review/rules/, but the pack holds one network policy rule and cannot read a process's metric registry. (best practice) [sources: src/devops_cli/review/rules/k8s-networkpolicy-ingress-any.yaml:1, .github/workflows/ci.yml:736, tests/telemetry/test_service_counter_series.py:72]- Chosen: Existing pytest regression tests. They run offline, already fail on the defect, and
tests/is a declared surface. - Rejected: Semgrep rule pack. The defect is a label-set behavior, not a code pattern; Semgrep cannot read a process's metric registry.
- Rejected: ast-grep construct rule.
.ast-grep/rules/holds constructs of this repository's own files, such as the elapsed-time bound oftests/, not a metric behavior. - Rejected: Matcher in Python. It adds code that the project builds and keeps, and the existing tests cover the behavior.
- Chosen: Existing pytest regression tests. They run offline, already fail on the defect, and
- Does the pull request need a
devops ci fail-to-passrun?: No. The title isdocs(telemetry), and the change editsARCHITECTURE.mdonly, with no behavior insrc/.CONTRIBUTING.mdgives a fail-to-pass check only to a fix title that changessrc/outsidesrc/devops_cli/ai/knowledge_base/; a fix that changes only tests, documents or dependencies gets no check. [sources: CONTRIBUTING.md:155, docs/TESTING.md:61] - Which scope does the pull request title use?:
telemetry, with the typedocs:docs(telemetry): record the service counter rule from #3680.hardeningis not a declared scope, and the lesson concerns the Service counters, whichscope/telemetrynames. (best practice) [sources: .github/labels.yml:70, CONTRIBUTING.md:135, .github/workflows/pr-title.yml:83]- Chosen: telemetry.
.github/labels.ymldeclaresscope/telemetryfor Prometheus metrics, and.github/workflows/pr-title.ymllists it; the lesson is about the Service counters. - Rejected: hardening. No
scope/hardeninglabel exists in.github/labels.ymlandhardeningis not in the scopes list of.github/workflows/pr-title.yml;devops pr createwould refuse it. - Rejected: docs.
scope/docsis declared, but the scope names the subject of the change, and the subject is telemetry. - Rejected: ci. The change edits no workflow or CI gate; the audit workflow stays as it is.
- Chosen: telemetry.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 5, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.hardening, and .github/labels.yml declares no scope/hardening label. Add the label to the file to give the scope to this item.A process invariant was violated, but no user-facing defect is active.Adding the missing guardrail prevents a known regression from recurring.The work is to document one root-cause guardrail in an existing declared surface.Both are audit findings for unhardened defect PRs, but each addresses a different PR and its specific root cause.devops-cli-service commentedon Nov 7, 2026
Refine cannot set this item to Ready at 9ca54d1. A bot opened the item, so a review of the issue and of the proposal must approve it first. The review found the defects below. A person edits the body to answer them. The next refine round looks at the item again only after a body edit.
false_premiseat problem_statement and key_questions 2 and 3: The plan says fix(ci): count tests and specs as hardening guardrails #3684 madetests/andopenspec/specs/declared surfaces, so the audit now reports fix(telemetry): Service counters read true across pods and repos #3680 as hardened. The issue lists neither path as a surface, andfilesis empty, so nothing in the input supports the claim. Evidence: "fix(ci): count tests and specs as hardening guardrails #3684 made both declared surfaces, and the audit now reports fix(telemetry): Service counters read true across pods and repos #3680 as hardened throughtests/telemetry/test_service_counter_series.pyandopenspec/specs/roadmap-service-counters/spec.md"dan-petty commentedon Nov 11, 2026
Closed as not planned. The check that filed this item passes now.
uv run devops pr hardening-report --pr 3680is_hardened: true. The hardened surfaces aretests/andopenspec/specs/.#3684 (merged 2026-11-05) counts tests and specs as hardening guardrails. Thus PR #3680 has the guardrail that the audit did not find. #3661 closes this family of items under the issue stewards plan #4780 (AGENTS.md rule 2). If the check fails again, reopen this item.