You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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-readable DOWNSTREAM_IMPACT block to a file path exported as DOWNSTREAM_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 explicit unreadable note) 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_FEEDBACK cap).
A bats test stubs gh to cover: impacted-with-readable-consumer, impacted-with-unreadable-consumer (-> graceful), and no-impact (-> (none), zero fetches). shellcheck passes.
Mirror the ADVISORY_BOT_FEEDBACK_FILE lifecycle in scripts/review-one-pr.sh (~lines 570–575): write a capped block to a file under /tmp/cascade/, export the path for downstream tiers, rm -f stale 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_PAT via gh exactly as the rest of pr-review does; do not add a new secret. Read-only gh api GET 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 gh in bats the way existing tests do (PATH shim / function override) — see tests/test_ci_status.bats for 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).
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
gh+GH_PAT, and writes a human-readableDOWNSTREAM_IMPACTblock to a file path exported asDOWNSTREAM_IMPACT_FILE.(none)(no fetches performed).(none)for that entry (or an explicitunreadablenote) and never fails the cascade — exit status stays 0.ADVISORY_BOT_FEEDBACKcap).ghto cover: impacted-with-readable-consumer, impacted-with-unreadable-consumer (-> graceful), and no-impact (->(none), zero fetches).shellcheckpasses.Tasks / Subtasks
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)(none)/unreadable, keep exit 0. (AC: Go-live improvements for PR review agent #2, Add @claude delegation, auto-merge, and rebase handling #3)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
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.scripts/review-one-pr.sh:534.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.review-one-pr.sh(degrade, log::warning::, continue).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.shwith the I/O assembler; adds a bats test. Still no prompt wiring (Story 4).References
Likely target surface
scripts/lib/tests/Story prepared by the BMAD Scrum Master (Bob) for epic #748. Status: ready-for-dev.