Skip to content

[Phase 3] Default-off feature flag + regression guard + operator docs for the downstream-impact pass #753

Closed

Description

@github-actions

Story

As a pr-review operator,
I want the downstream-impact pass shipped default-off behind a flag, covered by a golden-fixture regression guard, and documented,
so that the feature adds zero cost/behavior until I deliberately enable it, and its mapping logic cannot silently regress.

Acceptance Criteria

  1. The entire downstream-impact pass (assembly, inlining, verdict note) is gated behind a default-off env var (e.g. DOWNSTREAM_IMPACT_ENABLED, default false); with the flag off, review-one-pr.sh produces byte-identical prompts/behavior to today (no fetches, no prompt changes).
  2. A regression guard (bats) pins the pure mapper against a committed golden manifest + golden expected-output fixtures, so a change to mapping output fails CI; the new bats file is added to the lint.yml bats list as a stable check.
  3. Operator docs under docs/pr-review-agent/ cover: what the pass does, how to enable it (the flag), the GH_PAT scope it needs, the per-PR fetch + size caps, and how/when to refresh the consumer manifest (Story 1's builder).
  4. AGENTS.md is updated if a new always-run workflow/test is introduced (per its documented exception convention); shellcheck passes.

Tasks / Subtasks

Dev Notes

  • Default-off is the cost cap: with DOWNSTREAM_IMPACT_ENABLED=false there must be zero added gh calls and zero prompt deltas — enforce with a test that diffs the off-path prompt against the pre-feature baseline.
  • Model the regression guard on the existing golden/holdout patterns: tests/test_holdout_guard.bats (+scripts/lib/holdout-guard.sh) is the repo's reference for an immutable, CI-enforced guard; holdout-guard.yml is a documented repo-specific exception in AGENTS.md.
  • Golden fixtures are the immutable baseline here — changing expected mapping output requires an explicit fixture update (visible in diff), preventing silent drift. This is fixture-based regression testing, not metric/eval tuning, so no held-out eval split is needed.
  • Docs home is docs/pr-review-agent/; add the page and link it from documentation-index.md (existing index file). Note the GH_PAT cross-repo read requirement (already satisfied by existing pr-review workflows per 💡 Cross-Repo Impact-Aware Review Annotations for Downstream Breakage Detection #653).
  • Any new bats file MUST be registered in the lint.yml bats list (AGENTS.md repo-specific exception); if a new always-run workflow is added, document it as an exception in AGENTS.md.

Project Structure Notes

Touches scripts/review-one-pr.sh (flag), tests/ (regression guard + fixtures), docs/pr-review-agent/ (operator docs), .github/workflows/lint.yml (bats registration), and possibly AGENTS.md.

References

  • tests/test_holdout_guard.bats
  • scripts/lib/holdout-guard.sh
  • AGENTS.md#holdout-guard-exception
  • docs/pr-review-agent/documentation-index.md
  • .github/workflows/lint.yml#bats

Likely target surface

  • scripts/review-one-pr.sh
  • tests/
  • docs/pr-review-agent/
  • .github/workflows/lint.yml
  • AGENTS.md

Story prepared by the BMAD Scrum Master (Bob) for epic #748. Status: ready-for-dev.

Activity

  1. don-petry commented on Jun 19, 2026

    @don-petry
    Collaborator

    Dev-Lead Implementation Plan

    Issue: #753 — [Phase 3] Default-off feature flag + regression guard + operator docs for the downstream-impact pass

    Scope

    Ship the downstream-impact pass default-off behind DOWNSTREAM_IMPACT_ENABLED (gate already wired in #752), add a golden-fixture regression guard pinning the pure mapper, and write operator docs.

    Implementation Checklist

    • Confirm the DOWNSTREAM_IMPACT_ENABLED default-off gate already wraps the whole pass (assembly + triage inline + verdict note) in scripts/review-one-pr.sh; no behavior when off.
    • Add committed golden fixtures tests/fixtures/downstream-impact/golden/ (frozen manifest + per-case changed.txt/expected.json).
    • Add tests/test_downstream_impact_regression.bats pinning compute_downstream_impact output against the golden fixtures + an off-path no-op assertion.
    • Register the new bats file in .github/workflows/lint.yml bats list.
    • Write docs/pr-review-agent/downstream-impact.md and link it from docs/pr-review-agent/documentation-index.md.
    • Update AGENTS.md bats-list exception to document the regression guard; run shellcheck.

    Tests to Write

    • tests/test_downstream_impact_regression.bats — golden-fixture diff per case (direct workflow, indirect lib, indirect prompt, shared-source union, mixed, no-impact, empty) + flag-off no-op.

    Test Command

    bats tests/test_downstream_impact_regression.bats (full suite via scripts/run-bats.sh); lint via bash .dev-lead/scripts/dev-lead-lint.sh

  2. don-petry commented on Jun 19, 2026

    @don-petry
    Collaborator

    Dev-Lead: Implementation Complete

    Plan Execution

    Test Results

    # Full lint.yml bats list (33 files): 572 tests, 0 failures
    1..572
    ...
    ok 561 golden manifest fixture exists and is valid JSON
    ok 562 at least one golden case is present
    ok 563 golden: direct reusable-workflow change
    ok 564 golden: indirect scripts/lib change via surface_sources
    ok 565 golden: indirect prompts change via surface_sources
    ok 566 golden: source shared by two reusables (union of surfaces + consumers)
    ok 567 golden: mixed impacting + non-impacting paths
    ok 568 golden: no-impact change
    ok 569 golden: empty changed-file list
    ok 570 every golden case directory matches its expected output
    ok 571 flag off: triage section emits nothing (off-path no-op)
    ok 572 flag explicitly false: triage section emits nothing (off-path no-op)
    
    # dev-lead-lint (shellcheck on 67 files + agent-profile validation)
      [lint] all checks passed
    
    # Mutation test: perturbing one expected.json made the guard fail (cases 3 + catch-all),
    # restoring it returned all 12 to green — the guard is not vacuous.
    

    Files Changed

    • tests/test_downstream_impact_regression.bats: new golden-fixture regression guard for the pure mapper + flag-off no-op checks.
    • tests/fixtures/downstream-impact/golden/manifest.json: frozen golden manifest (independent of the live consumer-manifest.json).
    • tests/fixtures/downstream-impact/golden/cases/*/{changed.txt,expected.json}: 7 golden cases (direct, indirect-lib, indirect-prompt, shared-source union, mixed, no-impact, empty).
    • .github/workflows/lint.yml: registered the new bats file in the bats job list.
    • docs/pr-review-agent/downstream-impact.md: new operator guide.
    • docs/pr-review-agent/documentation-index.md: linked the new guide.
    • AGENTS.md: documented the regression guard under the bats-list exception.

    Notes

    • The AC test issue from agent #1 gate (DOWNSTREAM_IMPACT_ENABLED, default-off) was already implemented in [Phase 3] Wire the DOWNSTREAM_IMPACT block into the triage + deep prompts and surface it in the verdict #752; the off-path is a no-op (the assembly/fetch step in review-one-pr.sh is skipped when the flag is off, and the triage-section helper emits nothing), and this story adds the explicit flag-off no-op assertions to the new guard.
    • No new always-run workflow was introduced — the guard runs in the existing always-run bats job, so no new workflow exception was added to AGENTS.md (only the bats-list exception was extended).
    • The golden manifest is deliberately decoupled from the live consumer-manifest.json so Story 1's builder refreshing the manifest does not break the guard; only a mapper-output change does, requiring an explicit, reviewable fixture update.
  3. added a commit that references this issue on Jun 19, 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

    dev-leadFor dev-lead agent pickupinitiativeEpic / initiative tracking issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions