Repository navigation
Closed
Labels
initiativeEpic / initiative tracking issueEpic / initiative tracking issue
Description
Story
As a CI guard maintainer,
I want teach the two in-repo lint.yml guards to validate a multi-job agent-ingress.yml -- job-scoped forwarding-block extraction in caller_stub_freeze, multi-pin-per-file resolution plus an if:-as-event-filter-only assertion in validate-caller-inputs,
so that this repo can collapse its stubs without the ring-0 freeze hard-failing, and the one place ADR-0001 is loosened stays statically checkable.
Acceptance Criteria
- caller_stub_freeze.sh's
extract_forwarding_block(today a single-on:/single-uses:awk state machine) is replaced by a JOB-SCOPED extractor that selects a named job and captures that job'suses:/with:/permissions:block;CALLER_FREEZE_STUBSand the*.blockfixtures move to per-role/per-job granularity; MISSING stays a HARD error for ring-0 roles. - validate-caller-inputs.sh validates each job's forwarded inputs as a subset of its own pinned ref's declared
workflow_call.inputs, for MULTIPLE distinct per-job pins within one agent-ingress.yml (thevci_with_keys_for_jobindentation contract is preserved). - validate-caller-inputs (or a sibling check wired into the same lint job) enforces the if:-as-event-filter-only boundary: an ingress job's
if:may reference onlygithub.event_name/github.event.action/payload predicates and FAILS if it reaches for repo state. - Both guards remain backward-compatible: they still pass on the pre-collapse per-role stub files, so this story lands BEFORE the collapse without breaking current CI.
- bats coverage: caller_stub_freeze.bats and a validate-caller-inputs test exercise a multi-job ingress fixture (multi-pin passes; a repo-state
if:fails; a pure event-filterif:passes; a drifted single job is caught).
Tasks / Subtasks
- Rewrite caller_stub_freeze.sh extract_forwarding_block to a job-scoped extractor; move CALLER_FREEZE_STUBS entries and tests/fixtures/caller-stub-freeze/*.block to per-role granularity; keep MISSING fatal for ring-0. (AC: test issue from agent #1)
- Verify/harden validate-caller-inputs.sh multi-pin-per-file resolution (vci_with_keys_for_job indent contract) so each job resolves at its own ref. (AC: Go-live improvements for PR review agent #2)
- Add the if:-as-event-filter-only assertion (reject any repo-state reference in an ingress job if:). (AC: Add @claude delegation, auto-merge, and rebase handling #3)
- Add multi-job ingress bats fixtures + assertions and confirm the pre-collapse stubs still pass. (AC: Optimize review: small-PR and incremental fast paths #4, feat: add Copilot engine support via REVIEW_ENGINE toggle #5)
Dev Notes
- caller_stub_freeze.sh:
CALLER_FREEZE_STUBS(L46-50) currently holds dev-lead.yml|dev-lead.block, pr-review-trigger.yml|pr-review-trigger.block, ci-failure-analyst.lock.yml.extract_forwarding_block()(L73-88) is an awk state machine that assumes ONE top-level^on:and the FIRST job-indenteduses:up to the firstsecrets:/permissions:-- it collapses on a multi-job file (one sharedon:, manyuses:). MISSING is a HARD fail for ring-0 (L125-129). Baselines live in tests/fixtures/caller-stub-freeze/*.block;--update(L165-179) regenerates them. This is the guard that will hard-fail the moment dev-lead.yml/pr-review-trigger.yml become jobs, so it MUST land before Story 6. - validate-caller-inputs.sh is the ONE tool already generic: it globs
.github/workflows/*.yml(L288-289), parses eachuses:per line (vci_parse_usesL48-74), collectswith:keys for the specific job by indentation (vci_with_keys_for_jobL79-124;job_indentfrom the uses: line's leading whitespace L87-88), and resolves eachuses:at its OWN ref (vci_resolve_reusableL247-278). So multiple distinct per-job pins in one file work IN PRINCIPLE -- the risk to protect is the indentation contract; the NEW work here is the if:-filter assertion, not the input-subset check. - The [#1052 A] CI guard: forwarded caller inputs ⊆ declared inputs at the pinned @ref (+ #1034 regression) #1253 channel-skew guard (forwarded caller inputs subset of declared at the pinned @ref) is exactly validate-caller-inputs; ADR-0007 asks it to be taught about 'one file forwarding to several pinned refs' -- confirm per-job resolution rather than assume the whole file shares one ref (guards against the feat: implement issue #1031 — fix(#844): plumb LSP_PILOT_ENABLED env + decouple capture from LSP wiring so the pilot A/B runs in CI #1034/fix(ci): prevent channel-skew workflow breakage — guard forwarded inputs vs pinned refs + codify the pinning rules (post-#1034) #1052 channel-skew defect recurring per-surface).
- Both guards are invoked from lint.yml: job
caller-stub-freeze(L252-272) runsbash scripts/caller_stub_freeze.sh; jobvalidate-caller-inputs(L228-250) runsbash scripts/validate-caller-inputs.shand MUST keep persist-credentials true (L242-247) for same-repo channel-tag resolution. - Testing standard (ADR-0004 pure-logic + bats): keep the extraction/validation pure and cover it in tests/caller_stub_freeze.bats and a validate-caller-inputs bats fixture; assert both the collapsed and the legacy per-role shapes.
Project Structure Notes
Edits two scripts + their bats + fixtures; no reusable or workflow-trigger change. The if:-filter check may live in validate-caller-inputs.sh or a small sibling wired into the same lint job -- keep it pure-logic + bats per ADR-0004.
References
- scripts/caller_stub_freeze.sh#extract_forwarding_block
- scripts/validate-caller-inputs.sh#vci_with_keys_for_job
- .github/workflows/lint.yml#caller-stub-freeze
- .github/workflows/lint.yml#validate-caller-inputs
- tests/caller_stub_freeze.bats
- tests/fixtures/caller-stub-freeze/
- docs/architecture/adr/0001-thin-caller-reusable-two-tier.md
- referenced_issues: [#1052 A] CI guard: forwarded caller inputs ⊆ declared inputs at the pinned @ref (+ #1034 regression) #1253 (channel-skew guard), feat: implement issue #1031 — fix(#844): plumb LSP_PILOT_ENABLED env + decouple capture from LSP wiring so the pilot A/B runs in CI #1034/fix(ci): prevent channel-skew workflow breakage — guard forwarded inputs vs pinned refs + codify the pinning rules (post-#1034) #1052 (channel-skew defect)
Likely target surface
scripts/caller_stub_freeze.shscripts/validate-caller-inputs.shtests/caller_stub_freeze.batstests/fixtures/caller-stub-freeze/tests/test_validate_caller_inputs.bats (new)
Story prepared by the BMAD Scrum Master (Bob) for epic #1716. Status: ready-for-dev.
Metadata
Metadata
Assignees
Labels
initiativeEpic / initiative tracking issueEpic / initiative tracking issue
Activity
github-actions commentedon Sep 8, 2026
Superseded by the re-planned initiative epic #1723 (re-planned from idea discussion #1711).