Skip to content

Add Herald reporter scaffold (no-op + fixture-commit test workflow) - #1226

Open
markcor wants to merge 5 commits into
masterfrom
herald-reporter-scaffold
Open

markcor wants to merge 5 commits into
masterfrom
herald-reporter-scaffold

Conversation

@markcor

@markcor markcor commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

First pass at the RelOps Herald change-event reporter. Scope here is intentionally narrow: produce a JSON event for ronin commits using GitHub Models, so we can review the output quality before any Herald service exists or the production reporter is enabled.

  • .github/workflows/herald-reporter.yml — placeholder, triggers on push: master but logs only. Will be replaced with the production pipeline once the JSON output is approved.
  • .github/workflows/herald-real-commits-test.yml — runs the full pipeline against two fixture commits (f31351e..., 757b34d...) and uploads event.json as artifacts.
  • .github/herald/build_event.py — maps changed paths to Herald entities (excludes r10k_modules/ and _staging/alpha per the proposal), parses the AI response (with fenced-JSON tolerance), validates the assembled event against the schema.
  • .github/herald/event.schema.json — Herald change-event schema v1.

Notes

  • AI summary uses actions/ai-inference against GitHub Models via the workflow's GITHUB_TOKEN, so no Anthropic API key is required.
  • The schema enforces a description XOR error contract on ai_summary, so AI failures degrade gracefully to a stub entry rather than dropping the change.
  • Actions are SHA-pinned per ronin convention.

Test plan

  • pre-commit passes
  • herald-real-commits-test produces event.json artifacts for both fixture commits
  • Manually download both artifacts and evaluate AI summary quality
  • Confirm GitHub Models is enabled for mozilla-platform-ops (if not, the AI step fails open and emits the null-description stub — still schema-valid)

🤖 Generated with Claude Code

markcor added 5 commits May 28, 2026 15:23
First pass at the RelOps Herald change-event reporter, focused on
producing and reviewing the JSON output before any Herald service exists.

- .github/workflows/herald-reporter.yml: placeholder; triggers on
  push:master but no-ops. Will be replaced with the production pipeline
  once the JSON output is approved.
- .github/workflows/herald-real-commits-test.yml: runs the full pipeline
  against two fixture commits and uploads event.json artifacts.
- .github/herald/build_event.py: maps changed paths to Herald entities
  (excluding r10k_modules and staging/alpha), calls GitHub Models for
  the AI summary, validates the assembled event against the schema.
- .github/herald/event.schema.json: Herald change-event schema v1.

The AI summary uses actions/ai-inference against GitHub Models via the
workflow's GITHUB_TOKEN, so no Anthropic API key is required.
GitHub Models catalog for mozilla-platform-ops does not include
Anthropic publishers; the initial run failed with '404 Unknown model:
anthropic/claude-sonnet-4'. Swapping to openai/gpt-4o-mini, which is
present in the catalog and accessible via GITHUB_TOKEN (no API key
required).
GitHub Models is not enabled for mozilla-platform-ops, and Anthropic
publishers are not in the GitHub Models catalog anyway. Now that an
ANTHROPIC_API_KEY org/repo secret has been added, swap the AI step
from actions/ai-inference to a plain bash + curl call against
api.anthropic.com/v1/messages. Avoids the org Actions allowlist
constraint that would apply to anthropics/claude-code-action.

Model: claude-sonnet-4-6 (matches the pattern in mozilla/bigquery-etl's
claude-review workflow). continue-on-error preserves the graceful
failure path: if the curl step fails, the assemble step still produces
a schema-valid stub with description=null, error=<reason>.
For each commit, derive the transitive set of Puppet roles affected
and bucket them: roles whose name contains 'azure' are recorded as
azure_images (Azure custom images Herald tracks separately); all other
roles map 1:1 to Taskcluster worker pools and land in worker_pools.

Impact is derived by parsing Puppet manifests with regex:
  - role/role-hiera change   -> that role
  - profile change           -> roles including the profile
  - module change            -> profiles using the module -> roles including those profiles
  - data/os/<Family>.yaml    -> roles matching OS substring (linux/win/mac/osx/darwin)
  - data/common.yaml         -> all roles

Schema gains a required top-level 'impact' object with worker_pools[]
and azure_images[] arrays of role names. Staging/alpha roles continue
to be excluded throughout.
Parsing improvements in build_event.py:
- Strip Puppet comments before regex matching (drops '# include ...' false
  matches and /* ... */ blocks).
- Add profile -> profile transitive closure so a module/profile change reaches
  every role whose profile chain pulls it in, not just direct includes.
  Verified by touching profile 'motd' (only included transitively via OS-base
  profiles): impact fans out from 8 to 41 roles, which matches reality.

New .github/herald/CONVENTIONS.md documents ronin_puppet conventions for
the reporter:
- Repo shape and entity types
- worker-pool vs azure-image (and the 'azure' substring rule)
- staging/alpha exclusion
- Impact derivation rules per entity type
- Terminology guidance for AI summaries

The herald-real-commits-test workflow now inlines CONVENTIONS.md into
the Claude prompt so descriptions use the same terminology a ronin
reviewer would (worker pool, Azure custom image, profile, module,
Hiera).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant