Commit Graph
8 Commits
Author SHA1 Message Date
70273db0af fix(ci): pin checkout in release notification smoke workflow (#4399)
## Description

Pin `actions/checkout` to a full commit SHA in the local `act` smoke
workflow `.github/act/release-slack-notification.yml`, so a mutable tag
cannot be silently repointed (CWE-1357). This is defence-in-depth
hardening, not a demonstrated exploit.

Closes #

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring (no functional changes)

None of the boxes fit exactly: this is CI/security hardening of one
workflow line (see Additional Notes).

## Changes Made

- Replace `actions/checkout@v7` with
`actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7` in
`.github/act/release-slack-notification.yml`.
- Amend the commit subject to satisfy commitlint (<=100 chars) and
retitle the PR as a Conventional Commit.

## Testing

- [ ] Unit tests pass (`pytest`)
- [ ] Linting passes (`ruff check .`)
- [ ] Type checking passes (`mypy headroom`)
- [ ] New tests added for new functionality
- [x] Manual testing performed

`pytest`, `ruff`, `mypy` and new tests are N/A: no Python code changed.

### Test Output

```text
$ python3 -I -c "import yaml; yaml.safe_load(open('.github/act/release-slack-notification.yml'))"
yaml ok  (step 0: uses: actions/checkout@3d3c42e5aa)

$ git ls-remote https://github.com/actions/checkout 'refs/tags/v7*'
3d3c42e5aac5ba805825da76410c181273ba90b1	refs/tags/v7
3d3c42e5aac5ba805825da76410c181273ba90b1	refs/tags/v7.0.1

$ ls .github/actions/release-slack-notification
action.yml  build_payload.py
```

## Real Behavior Proof

- Environment: macOS, local checkout of this branch.
- Exact command / steps: the three commands above.
- Observed result: the workflow YAML parses; the pinned SHA equals the
current `refs/tags/v7` (also `v7.0.1`); the local composite action
referenced by the workflow exists.
- Not tested: the workflow was **not executed** (`act` is not installed
here), so there is no end-to-end evidence that the smoke job resolves
the pinned checkout or that the notification component runs. No Slack
delivery or production release was exercised. `release.yml` still uses
`actions/checkout@v7` and is out of scope.

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [x] I did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Additional Notes

- **Unchecked boxes** are N/A for a one-line workflow pin (no code, docs
or tests touched), not skipped work.
- **`pip-audit` / `cargo-audit` failures are pre-existing on `main`**,
not caused by this change (it touches one YAML line). The Security
workflow has failed on recent `main` runs, e.g.
[39724115555](https://github.com/headroomlabs-ai/headroom/actions/runs/39724115555).
Advisories seen on this PR's run: pip-audit `certifi 2026.1.4`
PYSEC-2026-4320 and `pillow 12.3.0` CVE-2026-112895; cargo-audit
RUSTSEC-2026-0381 and RUSTSEC-2026-0382. I deliberately did not modify
dependency files here to keep the PR scoped; I'll rebase once `main`
carries the remediation.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
2026-10-24 08:43:39 -07:00
JD Davis 7f44a64490 ci(release): announce completed GitHub Releases in Slack (#3607)
## Description

- announce a GitHub Release in Slack only after `create-release` has
successfully uploaded its assets
- build an accessible Block Kit payload with the exact release name,
tag, repository, actor, and GitHub Release link
- isolate the incoming webhook to the delivery step and fail closed on
missing configuration or an unexpected Slack response
- add a reproducible `act` smoke workflow whose `ACT=true` guard builds
and validates the production payload without sending network traffic

## Changes Made

- Adds a gated release-notification job, a local composite action, a
payload builder, and smoke/regression coverage.

## Boundary and rollout

This notification means **the GitHub Release and its assets are ready**.
It intentionally does not claim that every package registry publish
succeeded, matching the existing `create-release` contract.

Configure `SLACK_RELEASES_WEBHOOK_URL` as a repository Actions secret
containing an incoming webhook already bound to `#headroom`. Slack
incoming webhooks cannot override their configured channel. No Slack
request was made while developing or validating this PR.

This is additive to the current publication flow and does not implement
or bypass the future Gate B work tracked by Linear HEAOSS-19.

## Testing

- Rebased onto current `main` at `94206e265`; refreshed focused
qualification on `477f68047`.

- [x] Focused tests pass

### Test Output

```text
68 passed
```

- `uv run --extra dev pytest tests/test_release_workflows.py
tests/test_release_version.py -q` (68 passed)
- `uv run --extra dev ruff check
.github/actions/release-slack-notification/build_payload.py
tests/test_release_workflows.py`
- `uv run --extra dev ruff format --check
.github/actions/release-slack-notification/build_payload.py
tests/test_release_workflows.py`
- `actionlint .github/act/release-slack-notification.yml
.github/workflows/release.yml`
- `act workflow_dispatch -W .github/act/release-slack-notification.yml
-j smoke --pull=false`

## Type of Change

- [x] CI / release automation

## Real Behavior Proof

- Environment: maintainer macOS/Python 3.13 checkout at aedf2c2e.
- Exact command / steps: `python -m pytest
tests/test_release_workflows.py tests/test_release_version.py -q`.
- Observed result: 68 passed; current hosted build, test and security
checks pass. Payload and workflow guards are covered by the focused
tests.
- Not tested: delivery to the production Slack webhook. No notification
or release was sent during this review.

## Runtime Rollout Safety

- Rollout-managed feature(s): no runtime feature; release notification
only.
- Minimum rollout channel: human-reviewed repository workflow
deployment.
- Stable/default behavior changed: successful GitHub Release asset
publication triggers the notification.
- Kill switch / disable path: disable or revert the notification job;
missing webhook configuration fails that job.
- Unsafe override required: no.
- Qualification impact: notification signifies GitHub Release assets
ready, not registry-wide publication success.
- Rollback path: revert the additive notification workflow/action.

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review
2026-09-23 22:57:50 -05:00
3077ac81e8 feat: add deterministic runtime rollout controls (#1490)
## Description

Establish one centrally resolved, observable, deterministic, versioned
runtime rollout-control mechanism for Headroom. Runtime rollout controls
which behaviors an already-built artifact may expose; it does not select
or qualify a Headroom release/version.

## Type of Change

- [x] New feature (non-breaking change that adds functionality)
- [x] Bug fix (non-breaking change that fixes rollout enforcement
regressions)
- [x] Documentation update
- [x] Code refactoring (no functional changes)

## Changes Made

- Added `RolloutChannel`, `HEADROOM_ROLLOUT_CHANNEL`,
`--rollout-channel`, and a versioned immutable `RolloutSnapshot` shared
by Python configuration boundaries.
- Added schema/policy versions, canonical registry and snapshot SHA-256
identities, per-feature decision reasons, disable precedence, unsafe
qualification poisoning, strict CLI validation, and fail-closed
environment handling.
- Added `headroom rollout status --json`, Python `/stats.rollout`, and
Rust `/rollout/status` runtime provenance.
- Added equivalent Rust snapshot semantics and shared Python/Rust policy
vectors while retaining language-specific feature registries.
- Enforced rollout policy at alternate Python server composition roots
so `HEADROOM_READ_MATURATION=1` cannot bypass its beta gate.
- Preserved typed rollout snapshots across multi-worker serialization
with schema, policy, registry, snapshot-digest, type, and feature-name
validation.
- Made loopback runtime output-shaper updates replace the immutable
snapshot atomically for request readers, retain explicit request/disable
provenance, preserve channel and kill-switch precedence, invalidate
cached stats, and return the effective rollout decision.
- Made `headroom learn --verbosity --apply` report a channel-blocked
update instead of claiming the shaper is live.
- Made explicit CLI feature flags fail loudly when their current channel
blocks them.
- Made persistent interceptor installation select canary automatically,
or reject an explicitly insufficient channel unless the break-glass
override is set.
- Updated architecture, proxy, rollout, learn, and output-shaper
documentation with required channels and hot-reload semantics.

## Testing

- [x] Unit tests pass
- [x] Linting passes (`ruff check .` and `ruff format --check .`)
- [x] Type checking passes (`mypy headroom --ignore-missing-imports`)
- [x] New regression tests added for every corrected behavior
- [x] Rust tests and production-target Clippy pass
- [x] Documentation build passes

### Test Output

```text
Focused rollout coverage suite
57 passed; headroom.rollout + rollout CLI: 98% coverage

Affected proxy/rollout/transform/governance suites
222 passed; 0 failed

Final changed regression suites
100 passed; 0 failed

Cross-module hot-reload isolation regression
6 passed; 0 failed

cargo test -p headroom-core -p headroom-proxy --quiet
headroom-core: 924 passed; 1 ignored
headroom-proxy and integration suites: all passed

cargo clippy -p headroom-core -p headroom-proxy --lib --bins -- -D warnings
cargo fmt --all -- --check
ruff check .
ruff format --check .
mypy headroom --ignore-missing-imports
git diff --check
All passed

cd docs && npm run build
Compiled successfully; 164 static pages generated
```

The unsharded Windows-only CI selection exposed unrelated baseline
failures, principally the existing `sqlite:///C:\\...` URL parser
producing an invalid `\\C:\\...` path. At commit `8e793a80`, all 52
completed GitHub checks passed; the only other conclusions are expected
skips and superseded governance jobs.

## Real Behavior Proof

- **Environment:** Windows checkout on Python 3.13.3 and the current
Rust workspace, based on upstream `main` at `93f2d7a2`.
- **Exact command / steps:** Exercised canary and beta feature requests
through CLI status, Python `/stats.rollout`, Rust `/rollout/status`,
multi-worker payload round trips, loopback `/admin/runtime-env`, real
proxy request shaping before/after hot reload, installer manifest
generation, and shared Python/Rust policy vectors.
- **Observed result:** Stable blocks unstable requests; disable wins
over explicit/default/legacy/unsafe paths; unsafe state reports
`qualification_eligible=false`; worker handoff rejects tampering;
running output shaping changes only when the effective beta policy
permits it; explicit blocked flags fail with actionable diagnostics.
- **Not tested:** Live production traffic requiring provider
credentials, or future artifact qualification/promotion automation
(intentionally out of scope).

## Runtime Rollout Safety

- **Rollout-managed features:** Python `tool_result_interceptors`,
`proxy_output_shaper`, `read_maturation`; Rust `native_bedrock`,
`openai_responses_streaming`, `canary_probe`.
- **Minimum rollout channel:** Registry-defined per feature; process
default is `stable`.
- **Stable/default behavior changed:** No unstable feature becomes
enabled by default. Explicit blocked CLI flags now fail instead of
silently doing nothing.
- **Kill switch / disable path:**
`HEADROOM_DISABLE_FEATURES=<comma-separated feature names>`; explicit
disable has highest precedence, including over the unsafe override.
- **Unsafe override required:** No.
`HEADROOM_UNSAFE_ALLOW_UNSTABLE_FEATURES=1` is break-glass only and
makes qualification evidence ineligible.
- **Qualification impact:** Adds machine-readable policy/snapshot
identities and eligibility; does not implement qualification itself.
- **Rollback path:** Set the named disable list for operational
rollback, lower the channel, or revert this PR.

## Review Readiness

- [x] I have performed a full diff review
- [x] This PR is ready for human review

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented hard-to-understand areas
- [x] I have made corresponding documentation changes
- [x] My changes generate no new warnings
- [x] I added tests that reproduce and prevent every regression fixed
during review
- [x] New and existing affected tests pass locally
- [x] I did **not** edit `CHANGELOG.md`; release-please generates it
from the Conventional Commit PR title

## Additional Notes

Out of scope: artifact candidates, benchmark orchestration,
qualification manifests/gates, promotion automation, release branches,
publication guards, and release-risk classification. Those workflows can
consume the rollout registry digest, runtime snapshot digest, decision
reasons, and qualification eligibility through supported black-box
interfaces.

---------

Co-authored-by: JD Davis <jd@jds-macbook-air.tail2a279.ts.net>
Co-authored-by: JD Davis <jd@JDH-AIR-00.local>
2026-08-12 23:16:54 -05:00
96a7d7cbbe Fix CI lint failure by formatting PR governance scripts (#933)
`CI / lint (pull_request)` failed because `ruff format --check` detected
formatting drift in the new PR governance script and its tests. This PR
aligns those files with repository formatting rules so the lint job can
pass.

- **Root cause**
  - `ruff format --check .` reported two files as non-canonical:
    - `scripts/pr-governance.py`
    - `scripts/tests/test_pr_governance.py`

- **Change set**
  - Applied `ruff` formatting to only the two flagged files.
- No behavioral or logic changes; edits are line-wrap/format
normalization only.

- **Representative update**
  ```python
  parser.add_argument(
"--event", type=Path, required=True, help="Path to the GitHub event
payload JSON."
  )
  ```

---------

Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-06-12 17:11:39 -05:00
chopratejas 11f59aed16 ci(release): fix workflow-validation for new release trigger
scripts/validate-workflows.sh exercises release.yml with an `act`
dry-run that posted a synthesized push-to-main event. After the
previous commit retired that trigger in favor of `release:
published`, the dry-run started failing in CI because release.yml
no longer responds to push events.

Simulate the new trigger instead: feed release.yml a
release-published event (.github/act/release-published.json) and
move the push-to-main dry-run onto release-please.yml — the
workflow that now owns that event.
2026-05-25 18:36:12 -07:00
JerrettDavis c6c43f41f1 fix: skip commitlint for PR merge commits 2026-04-20 22:52:20 -05:00
JerrettDavisandCopilot d8c2ae88cd ci: validate release workflows with act
Add a workflow-validation CI job that installs actionlint and act,
checks the release and Docker workflows against checked-in event
fixtures, and shares the same validation script developers can run
locally.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-18 15:38:10 -05:00
JerrettDavis 910796ded2 feat: add act testing config, fix gitignore, make workflow production-ready
- Add .actrc with act defaults (Ubuntu runner, reuse, quiet)
- Add .github/act/dry-run.json and push-feat.json for local workflow testing
- Add .actrc.local.example for local overrides (gitignored)
- Add .env.act.example documenting required secrets
- Fix .gitignore: .env.act excluded, .env.act.example allowed
- Replace all bash git commands with Python subprocess (act compatibility)
- Add pip install build wheel for python -m build step
- Use absolute paths for artifact uploads (github.workspace)
- All publish jobs: dry_run + *_SKIP vars as safety gates
2026-04-15 20:28:29 -05:00