Commit graph

4 commits

Author SHA1 Message Date
JD Davis
aa811fa91f
ci: allow generated dependency commit bodies (#3012)
## Description

Disable commitlint's per-line body length limit because Dependabot
generates grouped-update commit bodies with dependency/link lines whose
length varies with group contents. PR #2964 currently fails only because
one generated line is 274 characters long.

Closes # N/A

## Type of Change

- [x] 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)

## Changes Made

- Disabled `body-max-line-length` in `.commitlintrc.json`.
- Kept Conventional Commit type, subject, and all other configured
validation rules enforced.

## Testing

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

### Test Output

```text
PR #2964 Dependabot commit (49 lines; maximum line length 274)
exit code: 0

bogus: should fail
type must be one of [build, chore, ci, docs, deps, feat, fix, parity, perf, refactor, revert, style, test] [type-enum]
exit code: 1

fix:
subject may not be empty [subject-empty]
exit code: 1

git diff --check
exit code: 0
```

## Real Behavior Proof

- Environment: Windows PowerShell; Node.js 22; `@commitlint/cli` and
`@commitlint/config-conventional` 19.8.1.
- Exact command / steps: Fetched the current PR #2964 commit message
through the GitHub API and piped the complete message into commitlint
using this branch's `.commitlintrc.json`; then ran negative type and
subject cases.
- Observed result: The exact grouped Dependabot commit passed; an
unapproved type and empty subject remained rejected.
- Not tested: Python/Rust unit tests and runtime behavior; this change
only modifies commit-message validation configuration.

## Runtime Rollout Safety

- Rollout-managed feature(s): N/A; CI configuration only.
- Minimum rollout channel: N/A.
- Stable/default behavior changed: Commit bodies may contain lines of
any length; all other commitlint rules remain active.
- Kill switch / disable path: Revert this commit or restore a numeric
`body-max-line-length` limit.
- Unsafe override required: No.
- Qualification impact: Generated Dependabot group descriptions no
longer fail CI due solely to a long dependency/link line.
- Rollback path: Revert this commit.

## 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)

## Screenshots (if applicable)

N/A; this change has no user interface.

## Additional Notes

- The comment and documentation checklist items are not applicable to
this one-line commitlint configuration change.
- No automated test file was added; the exact positive and negative
commitlint cases were run manually as shown above.
- Full application tests were not run because no application code or
runtime behavior changed.
- Keep this PR unmerged pending maintainer review.
2026-08-13 22:31:47 -05:00
JD Davis
7e3128057c
ci: allow Dependabot deps commits (#3009)
## Description

Allow the `deps:` Conventional Commit type emitted by Dependabot.
Dependabot PRs currently fail the CI `commitlint` job because `deps` is
not included in the repository's configured `type-enum`.

Closes # N/A

## Type of Change

- [x] 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)

## Changes Made

- Added `deps` to the allowed commit types in `.commitlintrc.json`.
- Existing and future Dependabot commits using `deps: ...` can pass the
commit-message policy.

## Testing

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

### Test Output

```text
deps: bump ruff from 0.15.22 to 0.16.2
exit code: 0

bogus: should fail
type must be one of [build, chore, ci, docs, deps, feat, fix, parity, perf, refactor, revert, style, test] [type-enum]
exit code: 1

git diff --check
exit code: 0
```

## Real Behavior Proof

- Environment: Windows PowerShell; Node.js 22; `@commitlint/cli` and
`@commitlint/config-conventional` 19.8.1.
- Exact command / steps: Ran commitlint with `.commitlintrc.json`
against a real failing Dependabot subject, then against an unapproved
`bogus:` type.
- Observed result: The `deps:` subject passed; the unapproved type
remained rejected by `type-enum`.
- Not tested: Python/Rust unit tests and runtime behavior; this change
only modifies commit-message validation configuration.

## Runtime Rollout Safety

- Rollout-managed feature(s): N/A; CI configuration only.
- Minimum rollout channel: N/A.
- Stable/default behavior changed: Commitlint now accepts the `deps`
type.
- Kill switch / disable path: Revert this commit or remove `deps` from
`type-enum`.
- Unsafe override required: No.
- Qualification impact: Dependabot PR commit messages no longer fail
solely because their type is `deps`.
- Rollback path: Revert this commit.

## 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)

## Screenshots (if applicable)

N/A; this change has no user interface.

## Additional Notes

- The comment and documentation checklist items are not applicable to
this one-line commitlint configuration change.
- No automated test file was added; the exact positive and negative
commitlint cases were run manually as shown above.
- Full application tests were not run because no application code or
runtime behavior changed.
- Keep this PR unmerged pending maintainer review.
2026-08-13 21:45:16 -05:00
chopratejas
d6a00ee89c ci: fix smart_crusher branch CI failures + add make ci-precheck pre-push gate
Five gates broke on the 2026-04-27 push of the smart_crusher branch.
Each is fixed below; the second half adds a `make ci-precheck` target
(plus an installable git pre-push hook) so the same dance never happens
again.

Failures fixed:

1. cargo fmt — 22 files had formatting drift introduced over the
   stage 3c.1 work. `cargo fmt --all` reformatted them; no semantic
   changes. `cargo test --workspace` still green (388 + supporting).

2. wheels job (macOS x86_64) — `fastembed -> ort -> ort-sys` does not
   publish prebuilt ONNX Runtime binaries for `x86_64-apple-darwin`.
   Removed that target from `.github/workflows/rust.yml`'s wheels
   matrix. Apple Silicon (`aarch64-apple-darwin`) covers macOS
   distribution; Intel macOS users can build from source. The matrix
   now has 2 targets: linux x86_64 + macOS aarch64.

3. test-extras (relevance.py) — `tests/test_relevance.py::TestSmartCrusherIntegration`
   constructs a `SmartCrusher`, which hard-imports `headroom._core`
   since the python implementation was retired in stage 3c.1b. The
   test-extras job didn't build the rust extension. Added the same
   `maturin build + symlink` block the main `test` job uses.

4. smoke-test (eval.yml) — same root cause:
   `compression_only.evaluate_ccr_lossless` instantiates a SmartCrusher.
   Same fix: build the rust extension before the smoke test runs.

5. commitlint — three rules tripped:
   - `subject-case` rejects PascalCase identifiers in subjects, but
     the project deliberately names classes (SmartCrusher, HfTokenizer,
     ContentRouter, DiffCompressor) in commit subjects. Disabled.
   - `footer-leading-blank` is a warning that the wagoid action turns
     into a CI failure; lines like `Module: foo.rs` in our bodies
     match the conventional footer pattern and trip it. Disabled.
   - `type-enum` doesn't include `parity`, but the project ships
     parity-test infrastructure as its own concern (separate from
     `test:`); added `parity` to the allowed types.

Pre-push verification — the prevention half:

`make ci-precheck` runs all of the above CI gates locally:
- `ci-precheck-rust`: cargo fmt --check + clippy + test --workspace.
- `ci-precheck-python`: builds the rust extension via maturin, then
  runs the smart_crusher-affected python test files (185 tests across
  test_transforms/, test_relevance*, test_ccr, test_acceptance,
  test_critical_fixes, test_quality_retention).
- `ci-precheck-commitlint`: `npx commitlint --from origin/main --to
  HEAD` against the same config CI uses. Skipped silently if npx is
  not on PATH (install Node 18+ to enable).

`make install-git-hooks` (or `scripts/install-git-hooks.sh`) installs
a git pre-push hook that runs `make ci-precheck` automatically.
Bypass with `--no-verify` only when truly needed.

When new CI gates land in `.github/workflows/`, mirror them into a
`make ci-precheck-*` target. The Makefile is the local mirror of the
CI configuration; keeping them in sync is a load-bearing invariant.

Verification: `make ci-precheck` runs green on this commit.
2026-04-27 11:13:47 -07:00
JerrettDavis
272c9736ac ci: add commitlint for conventional commit enforcement 2026-04-15 19:36:49 -05:00