Skip to content

fix(hardening): defect PR #3680 missing declared surface hardening #3683

Closed as not planned

Description

@github-actions

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.md
  • ARCHITECTURE.md
  • SECURITY.md
  • CONTRIBUTING.md
  • src/devops_cli/ai/tasks/*.md
  • src/devops_cli/ai/knowledge_base/
  • .devops/review.toml
  • src/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 and repo label 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.py and reads openspec/specs/roadmap-service-counters/spec.md
  • THEN the test module passes, and the spec holds the zero-series requirement and the repo label

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 check runs
  • 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_hardening receives a file list with additions under ARCHITECTURE.md
  • THEN is_hardened is true and hardened_surfaces names ARCHITECTURE.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 create checks the title and the body
  • THEN the check accepts both and adds type/docs and scope/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 /metrics scrape of the new pod had no zero sample, so increase() lost the first count of each label set. The failure counter devops_cli_service_implement_failures_total also had no repo label, 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/bug or type/security; devops pr create gives a fix(...) title type/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 time tests/ and openspec/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's tests/telemetry/test_service_counter_series.py and openspec/specs/roadmap-service-counters/spec.md now 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/ and openspec/specs/ declared surfaces, and fix(telemetry): Service counters read true across pods and repos #3680 added tests/telemetry/test_service_counter_series.py and the living openspec/specs/roadmap-service-counters/spec.md; audit_pr_hardening now 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.md rule 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 and repo label as the root cause, and the existing tests and living spec as the guardrails. The guardrails already exist: tests/telemetry/test_service_counter_series.py and openspec/specs/roadmap-service-counters/spec.md; tests/ and openspec/specs/ are declared surfaces. ARCHITECTURE.md is 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.md is 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, and tests/ is now a declared surface, so a new test would duplicate the guardrail.
    • Rejected: Living spec update. openspec/specs/roadmap-service-counters/spec.md already 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.
  • 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.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. The lesson names both, and uv run devops docs check checks the document. A new invariant test for ARCHITECTURE.md is not added because docs/TESTING.md says 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/ and openspec/specs/ are declared surfaces; the lesson names them.
    • Rejected: New invariant test for the document. docs/TESTING.md:61-62 says a document change gets no test and names a repeatable command such as uv 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.
  • 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 pytest tests in tests/telemetry/test_service_counter_series.py already cover it. Semgrep is the open tool for a code pattern and its rule pack is src/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 of tests/, not a metric behavior.
    • Rejected: Matcher in Python. It adds code that the project builds and keeps, and the existing tests cover the behavior.
  • Does the pull request need a devops ci fail-to-pass run?: No. The title is docs(telemetry), and the change edits ARCHITECTURE.md only, with no behavior in src/. CONTRIBUTING.md gives a fail-to-pass check only to a fix title that changes src/ outside src/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 type docs: docs(telemetry): record the service counter rule from #3680. hardening is not a declared scope, and the lesson concerns the Service counters, which scope/telemetry names. (best practice) [sources: .github/labels.yml:70, CONTRIBUTING.md:135, .github/workflows/pr-title.yml:83]
    • Chosen: telemetry. .github/labels.yml declares scope/telemetry for Prometheus metrics, and .github/workflows/pr-title.yml lists it; the lesson is about the Service counters.
    • Rejected: hardening. No scope/hardening label exists in .github/labels.yml and hardening is not in the scopes list of .github/workflows/pr-title.yml; devops pr create would refuse it.
    • Rejected: docs. scope/docs is 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.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    status/new
    value/medium
    effort/low
    on Nov 5, 2026
  2. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

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

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: none. The title has the scope hardening, and .github/labels.yml declares no scope/hardening label. Add the label to the file to give the scope to this item.
    • Priority: P2-Medium. A process invariant was violated, but no user-facing defect is active.
    • Value: Medium. Adding the missing guardrail prevents a known regression from recurring.
    • Effort: Low. The work is to document one root-cause guardrail in an existing declared surface.
    • Related: fix(hardening): defect PR #3669 missing declared surface hardening #3675, which asks for a different change. Both are audit findings for unhardened defect PRs, but each addresses a different PR and its specific root cause.
  3. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    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.

  4. dan-petty commented on Nov 11, 2026

    @dan-petty
    Owner

    Closed as not planned. The check that filed this item passes now.

    • Command: uv run devops pr hardening-report --pr 3680
    • Result: is_hardened: true. The hardened surfaces are tests/ and openspec/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.

  5. removed
    status/new
    on Nov 11, 2026
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/lowpriority/p2-mediumsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions