Skip to content

Fix(gating): Accept a recent publisher run - #363

Merged
ModeSevenIndustrialSolutions merged 1 commit into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-362
Dec 5, 2026
Merged

ModeSevenIndustrialSolutions merged 1 commit into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-362

Conversation

@lf-releng-code-monkey-bot

@lf-releng-code-monkey-bot lf-releng-code-monkey-bot Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Closes #362

Authored by an AI agent; human review required
Command Exit
uv run pytest -q tests/test_client.py -k publisher # without fix 1
uv run pytest -q 0
uv run ruff check . 0
uv run ruff format --check . 0
python3 /home/runner/work/github-code-monkey-bot/github-code-monkey-bot/monkey-assets/scripts/message_check.py 28da64f30fb3f9e4b65de5344fd3ae6b254e00ca 0
git log --raw --format=%h 28da64f30fb3f9e4b65de5344fd3ae6b254e00ca..HEAD 0
prek run --files docs/adr/0009-fuzzing.md docs/org-scan-setup.md src/github_security_report/client/org_reads.py src/github_security_report/collect/org.py src/github_security_report/collect/protocols.p 0

The github-code-monkey-bot workflow opened this pull request.
Nobody has merged it; a maintainer must review it first.
Review findings on this pull request are answered by a later revision round of this workflow, up to ten rounds per antagonistic review round; after that a maintainer, or the next antagonistic review, takes on any finding that remains, and a maintainer reviews every round before merge.

Round 4 of revision, on its base.


Fixes #362.

Feature gating decided fuzz support by sampling luck. A clean fuzz run uploads an analysis and no alert, and no ruleset requires a fuzz workflow. That left a 10-repository spread sample as the only evidence, and it could miss all eight fuzzed repositories in 139. This pull request adds a deterministic layer between ruleset evidence and the sample: a successful run, in the last seven days, of the organisation workflow that publishes the signal's SARIF.

  • Configuration: report.publisher_workflows maps zizmor, aislop and fuzz to "<repository>:<workflow file>". It defaults to the publishers in the organisation's .github repository, merges like ruleset_workflows, and an empty string turns an entry off.
  • Client: publisher_recent_success reads the workflow's newest successful run at or after the cutoff. A non-200, a malformed body, a timestamp without a UTC offset or a transport failure is no evidence. Rejected credentials and a spent rate limit still abort.
  • Gating: undecided signals get a publisher probe before the sample. Scorecard gets no publisher probe.
  • Docs: the setup guide and ADR-0009 describe the layer and the key.

This round

Copilot found that a run created_at without a UTC offset (2026-12-01T00:00:00) parsed as a naive datetime. Comparing it with the aware cutoff raised TypeError and aborted the report. The probe now treats such a timestamp as no evidence, and a new client test covers it. The test fails without the fix and passes with it.

Checks run

uv run pytest (2015 passed), ruff check, ruff format --check, the commit message check, and prek run over every changed file (mypy, basedpyright and aislop included) all exit 0. No hook was skipped.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Publisher transport failures can raise NetworkError after retries, aborting the organisation report instead of falling back to the sample; handling and a regression test are needed.

1 open issue
What changed in this PR

Adds recent successful publisher runs as organisation-support evidence, preventing clean fuzzing results from being missed by repository sampling.

Changes:

  • Adds configurable publisher workflows with defaults and validation.
  • Checks publisher runs before sampling, leaving Scorecard unchanged.
  • Documents the new evidence layer and adds regression coverage.
File Description
tests/​test_gating.py Tests publisher evidence, precedence and fallback.
tests/​test_config.py Tests defaults, overrides and validation.
tests/​test_collect.py Extends the collection fake client.
tests/​test_client.py Tests publisher responses and query parameters.
tests/​test_cli.py Mocks publisher reads.
src/​github_security_report/​gating.py Adds concurrent publisher probes before sampling.
src/​github_security_report/​config/​schema.py Defines allowed publisher configuration keys.
src/​github_security_report/​config/​models.py Adds publisher defaults and model field.
src/​github_security_report/​config/​key_notes.py Describes the new configuration key.
src/​github_security_report/​config/​blocks.py Validates and merges publisher entries.
src/​github_security_report/​config/​__init__.py Exports publisher constants.
src/​github_security_report/​collect/​protocols.py Declares the publisher-read interface.
src/​github_security_report/​collect/​org.py Passes publisher configuration into gating.
src/​github_security_report/​client/​org_reads.py Queries recent successful publisher runs.
docs/​org-scan-setup.md Documents evidence order and configuration.
docs/​adr/​0009-fuzzing.md Updates the fuzz-support decision rationale.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Valid workflow filenames containing spaces or # are rejected during configuration loading, and publisher requests need percent-encoding and regression coverage for these names.

1 open issue

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the publisher-run evidence changes.

No open issues 🎉

Review effort: Balanced

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Antagonistic review by agent: 1 finding(s) for the human reviewer.

The publisher evidence layer preserves the existing fallbacks, but its date-only filter accepts runs older than the documented seven-day window.

Antagonistic round 1 of 3. Revision requested from Code Monkey.


Automated antagonistic review by lf-releng-antagonistic-review-bot[bot] using model gpt-6-astra; see the run. This is not a human review and never an approval: a maintainer must still review and approve this pull request.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Timezone-naive created_at values can raise a TypeError during cutoff comparison, aborting the organisation report instead of falling back to sampling.

1 open issue

Review effort: Balanced

Feature gating decided fuzz support by sampling luck. A clean fuzz run
uploads an analysis and no alert, and no ruleset requires a fuzz
workflow, so the only evidence left was a 10-repository spread sample.
With eight fuzzed repositories in 139, the sample can miss every one,
and archiving a repository shifts it: the Fuzzing section of the
lfreleng-actions report disappeared although the central fuzz job runs
green every day.

Add a deterministic layer between ruleset evidence and the sample: a
successful run, in the last seven days, of the organisation workflow
that publishes the signal's SARIF. The new report.publisher_workflows
key maps zizmor, aislop and fuzz to "<repository>:<workflow file>",
defaulting to the reference publishers in the organisation's .github
repository. A configured mapping merges into the default and an empty
string turns an entry off. The client reads the workflow's successful
runs, and any non-200, malformed body or transport failure is no
evidence, so the signal falls through to the sample as before.
Rejected credentials and a spent rate limit still abort the run.
Scorecard runs per repository and gets no publisher probe.

Document the layer and key in the setup guide and ADR-0009.

Review: a transport failure that exhausted the retries raised
NetworkError from the publisher probe and aborted the organisation
report, as quiet=True only lowers logging. The probe now catches
NetworkError and returns no evidence, re-raising AuthError and
RateLimitError as the pattern inventory read does. A regression test
covers a connection failure and a 401.

Review: the entry check refused valid workflow file names such as
"fuzz nightly.yaml" or "fuzz#nightly.yaml", which match the documented
form, and aborted configuration loading. The check now takes any
single-segment name ending .yml or .yaml with no "/" or ":" and no
control character, and the client percent-encodes the file name as one
path segment, as workflow_state does. Tests cover both names and the
encoded request path.

Review: the run filter sent the cutoff's date alone, so a run from
earlier on the cutoff day, up to a day past the seven-day window,
counted as support. The filter now carries the full UTC timestamp, and
the probe also requires the newest run's created_at to fall at or
after the cutoff. Client tests cover a run one second before the
cutoff on the same date and a run without a timestamp.

Review: a run's created_at without a UTC offset, such as
"2026-12-01T00:00:00", parsed as a naive datetime, and comparing it
with the aware cutoff raised TypeError and aborted the organisation
report. The probe now treats such a timestamp as no evidence. A client
test covers the response.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the publisher-run evidence change.

No open issues 🎉

Review effort: Balanced

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Antagonistic review by agent: no line-level findings; the summary below is the verdict.

The publisher-evidence layer appears sound and preserves the existing gating fallbacks. No actionable defects found in the diff or dependent code.

Antagonistic round 2 of 3.


Automated antagonistic review by lf-releng-antagonistic-review-bot[bot] using model gpt-6-astra; see the run. This is not a human review and never an approval: a maintainer must still review and approve this pull request.

@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions merged commit fc1c179 into lfreleng-actions:main Dec 5, 2026
33 checks passed
@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions deleted the code-monkey/issue-362 branch December 5, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix(gating): Accept a recent publisher run

2 participants