Repository navigation
Closed
Labels
dev-leadFor dev-lead agent pickupFor dev-lead agent pickupinitiativeEpic / initiative tracking issueEpic / initiative tracking issue
Description
Story
As a pr-review maintainer,
I want a step that takes the mapped impacted consumers, fetches their referencing workflow files via GH_PAT, and assembles a size-capped DOWNSTREAM_IMPACT block to a file,
so that the triage/deep tiers can consume a ready-made, bounded downstream-impact context the same way they consume advisory-bot feedback.
Acceptance Criteria
- Given the impact object from Story 2, the step fetches, for each impacted consumer, the workflow file(s) that reference the impacted surface using
gh+GH_PAT, and writes a human-readableDOWNSTREAM_IMPACTblock to a file path exported asDOWNSTREAM_IMPACT_FILE. - When no surfaces are impacted, the block is the literal
(none)(no fetches performed). - Degrades gracefully: a consumer repo that is private/unreadable or a missing token scope yields
(none)for that entry (or an explicitunreadablenote) and never fails the cascade — exit status stays 0. - Fetch volume is bounded: only exact-matched consumers are fetched, capped at a configurable max repo count per PR, and the assembled block is truncated to a size cap (mirroring the 8 KB
ADVISORY_BOT_FEEDBACKcap). - A bats test stubs
ghto cover: impacted-with-readable-consumer, impacted-with-unreadable-consumer (-> graceful), and no-impact (->(none), zero fetches).shellcheckpasses.
Tasks / Subtasks
- Add an assembler (e.g.
assemble_downstream_impactinscripts/lib/downstream-impact.sh) that calls the pure mapper, then fetches consumer workflow files viagh api/ghwithGH_PAT, honoring the per-PR repo cap and size cap. (AC: test issue from agent #1, Optimize review: small-PR and incremental fast paths #4) - Implement graceful degradation for unreadable/private repos and missing scope — catch fetch errors, emit
(none)/unreadable, keep exit 0. (AC: Go-live improvements for PR review agent #2, Add @claude delegation, auto-merge, and rebase handling #3) - Write the block to
DOWNSTREAM_IMPACT_FILE(default under/tmp/cascade/), export it, and add the gh-stubbed bats test; register it inlint.yml. (AC: test issue from agent #1, feat: add Copilot engine support via REVIEW_ENGINE toggle #5)
Dev Notes
- Mirror the
ADVISORY_BOT_FEEDBACK_FILElifecycle inscripts/review-one-pr.sh(~lines 570–575): write a capped block to a file under/tmp/cascade/,exportthe path for downstream tiers,rm -fstale copies first. - Cap discipline matches the existing advisory cap (~8 KB) so huge consumer sets cannot blow up the prompt — see the 'Cap total size' note around
scripts/review-one-pr.sh:534. - Use
GH_PATviaghexactly as the rest of pr-review does; do not add a new secret. Read-onlygh apiGET calls on consumer.github/workflows/*paths; no enumeration beyond the exact-matched consumer set. - Graceful degradation is a hard requirement: the cascade must never fail because a consumer repo is private or the token lacks a scope — follow the rate-limit/error-handling philosophy already in
review-one-pr.sh(degrade, log::warning::, continue). - Stub
ghin bats the way existing tests do (PATH shim / function override) — seetests/test_ci_status.batsfor the pattern.
Project Structure Notes
Extends scripts/lib/downstream-impact.sh with the I/O assembler; adds a bats test. Still no prompt wiring (Story 4).
References
- scripts/review-one-pr.sh#ADVISORY_BOT_FEEDBACK_FILE
- scripts/review-one-pr.sh#cap-total-size
- .github/workflows/pr-review.yml#GH_PAT
- tests/test_ci_status.bats#gh-stub
Likely target surface
scripts/lib/tests/
Story prepared by the BMAD Scrum Master (Bob) for epic #748. Status: ready-for-dev.
Metadata
Metadata
Assignees
Labels
dev-leadFor dev-lead agent pickupFor dev-lead agent pickupinitiativeEpic / initiative tracking issueEpic / initiative tracking issue
Activity
don-petry commentedon Jun 18, 2026
Dev-Lead Implementation Plan
Issue: #751 — [Phase 2] Fetch consumer references + assemble the DOWNSTREAM_IMPACT context block
Scope
Add an I/O assembler
assemble_downstream_impacttoscripts/lib/downstream-impact.shthat calls the pure mapper, fetches each impacted consumer's referencing workflow file(s) viagh+GH_PAT(bounded by a per-PR repo cap and an 8 KB size cap), degrades gracefully on unreadable/private repos, and writes a human-readableDOWNSTREAM_IMPACTblock toDOWNSTREAM_IMPACT_FILE.Implementation Checklist
scripts/lib/downstream-impact.sh: addassemble_downstream_impact <changed_files> <manifest> [out_file](callscompute_downstream_impact, fetches consumer workflow files, builds + caps the block, writes the file, exportsDOWNSTREAM_IMPACT_FILE)DOWNSTREAM_IMPACT_MAX_REPOS(default 10) andDOWNSTREAM_IMPACT_MAX_BYTES(default 8000, mirrorsADVISORY_BOT_FEEDBACKcap)unreadablenote, never non-zero exit; no surfaces → literal(none)with zero fetches.github/workflows/lint.yml: register the new bats test file in therun-bats.shlistTests to Write
tests/test_downstream_impact_assemble.batswith a PATH-shimmedghstubunreadablenote, exit 0(none), zeroghcallsTest Command
scripts/run-bats.sh tests/test_downstream_impact_assemble.bats(full suite vialint.yml), thenbash .dev-lead/scripts/dev-lead-lint.shdon-petry commentedon Jun 18, 2026
Dev-Lead: Implementation Complete
Plan Execution
assemble_downstream_impact <changed_files> <manifest> [out_file]toscripts/lib/downstream-impact.sh(calls the purecompute_downstream_impactmapper, fetches consumer workflow files, builds + caps the block, writes the file, exportsDOWNSTREAM_IMPACT_FILE)DOWNSTREAM_IMPACT_MAX_REPOS(default 10) andDOWNSTREAM_IMPACT_MAX_BYTES(default 8000, mirrors theADVISORY_BOT_FEEDBACK8 KB cap)unreadablenote +::warning::, never non-zero exit; no impacted surfaces → literal(none)with zero fetchesGH_PATviagh(preferred, falls back to ambientGH_TOKEN); no new secrettests/test_downstream_impact_assemble.batsand registered it in.github/workflows/lint.ymlTest Results
Files Changed
scripts/lib/downstream-impact.sh: added the I/O assemblerassemble_downstream_impactplus two private helpers (_downstream_ghfor GH_PAT-preferring auth,_downstream_referencing_filesfor listing+fetching+matching a consumer's workflow files). The pure mapper is unchanged.tests/test_downstream_impact_assemble.bats: new gh-stubbed bats test (6 cases) covering readable/unreadable/no-impact plus the repo cap, size cap, and path export..github/workflows/lint.yml: registered the new test file in therun-bats.shlist.Notes
.github/workflows/pr-review.yml) against the consumer'suses:line — the consumer was already confirmed to pin that surface by the pure mapper, so this only resolves the filename. Best-effort context.set -euo pipefail(the callerreview-one-pr.shruns with it), so a fetch failure can never break the cascade./tmp/cascade/downstream-impact.txt, mirroring theADVISORY_BOT_FEEDBACK_FILElifecycle.feat: implement issue #751 — [Phase 2] Fetch consumer references + as…