chore(commits): introduce conventional commits#221
Conversation
2a265b7 to
c568a41
Compare
|
@SoheylM Also added you as a reviewer as I now also added an |
|
One point of discussion:
|
SoheylM
left a comment
There was a problem hiding this comment.
Nice addition - conventional commits are a good fit for this project (and others). A few issues to address, one of which, if I am not mistken, is a CI bug that will break on pushes to main.
| - uses: actions/setup-python@v5 | ||
| - uses: pre-commit/action@v3.0.1 | ||
|
|
||
| conventional-commits: |
There was a problem hiding this comment.
My cursor agent says this:
Bug: this job inherits the top-level on: push trigger, but uses github.event.pull_request.base.sha/head.sha which are undefined on push events. The git fetch origin main:main will also fail when already on main. Needs a guard:
| conventional-commits: | |
| conventional-commits: | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest |
There was a problem hiding this comment.
Good catch. Addressed in the latest revision: the conventional-commits job now has if: github.event_name == pull_request, so pull_request fields are only evaluated in PR context.
.github/workflows/pre-commit.yaml
Outdated
| - name: Fetch main branch ref (not available in PR context) | ||
| run: git fetch origin main:main | ||
|
|
||
| - uses: itiquette/gommitlint-action@v0.8.11 |
There was a problem hiding this comment.
This uses v0.8.11. Isn't there a conflict with the local pre-commit hook that uses the Docker image at v0.9.1? In that case, this could cause a commit to pass locally but fail in CI (or vice versa). Worth aligning if this is the case.
There was a problem hiding this comment.
Aligned now. CI installs conventional-commit-lint pinned to 0.9.0, matching the local pre-commit hook version and avoiding local versus CI drift.
.pre-commit-config.yaml
Outdated
| See: https://codeberg.org/Itiquette/gommitlint | ||
| entry: | ||
| codeberg.org/itiquette/gommitlint:v0.9.1 validate --message-file | ||
| language: docker_image |
There was a problem hiding this comment.
Do I understand correctly that this means contributors need a running Docker daemon to commit? That would then be a significant new requirement that isn't mentioned anywhere in the docs. Worth noting in README or CONTRIBUTING, or documenting how to skip the hook if Docker isn't available.
There was a problem hiding this comment.
This concern is resolved in the current version. The Docker-based gommitlint hook was removed, and commit-message linting now uses conventional-commit-lint as a Python commit-msg hook.
AGENTS.md
Outdated
| ## Setup of a local virtual environment | ||
|
|
||
| - Run `python -m venv .venv` to create a virtual environment. | ||
| - `. .venv/bin activate` to activate the environment. |
There was a problem hiding this comment.
Missing slash — this will error out.
| - `. .venv/bin activate` to activate the environment. | |
| - `. .venv/bin/activate` to activate the environment. |
There was a problem hiding this comment.
Fixed in the current AGENTS file: the activation command is now . .venv/bin/activate.
AGENTS.md
Outdated
| - `build`: Changes to build system or dependencies, i.e. [pyproject.toml](pyproject.toml) | ||
| - `ci`: Changes to CI configuration [.github/](.github) | ||
| - `chore`: Other changes that don't modify files in the directories [engibench](engibench), [docs](docs) or [tests](tests) | ||
| - `optional scope`: Optional but recommended. Describes the changed component or module name (enclosed in square brackets). |
There was a problem hiding this comment.
I think conventional commit scopes use parentheses, not square brackets: feat(parser): add ability.
| - `optional scope`: Optional but recommended. Describes the changed component or module name (enclosed in square brackets). | |
| - `optional scope`: Optional but recommended. Describes the changed component or module name (enclosed in parentheses). |
There was a problem hiding this comment.
Updated as suggested. The scope description now uses parentheses, for example feat(parser): ...
README.md
Outdated
| pip install -e ".[dev]" | ||
| ``` | ||
|
|
||
| Our pre-commit config also include a hook to ensure compliance with [conventional commit](https://www.conventionalcommits.org) |
There was a problem hiding this comment.
Nit: subject-verb agreement.
| Our pre-commit config also include a hook to ensure compliance with [conventional commit](https://www.conventionalcommits.org) | |
| Our pre-commit config also includes a hook to ensure compliance with [conventional commit](https://www.conventionalcommits.org) |
There was a problem hiding this comment.
Fixed in the latest README update: the sentence now uses includes.
| @@ -0,0 +1,73 @@ | |||
| # AGENTS instructions | |||
There was a problem hiding this comment.
Some suggestions to make this file more useful for AI agents:
Project structure - A short section would save significant exploration time (although that may need to be updated if we expect EngiBench structure to change). Something like:
Project structure
engibench/core.py—Problembase class,OptiStep,ObjectiveDirectionengibench/constraint.py— constraint systemengibench/problems/<name>/— one subpackage per problem, each exports a singleProblemsubclassengibench/utils/— container runtimes, slurm, CLI helpers, problem discoverytests/— pytest suite;test_problem_implementations.pyparametrizes over all builtin problemsdocs/— Sphinx (MyST), built withcd docs && make dirhtml
There was a problem hiding this comment.
Implemented. AGENTS now includes a dedicated Project structure section with core modules, problem layout, tests, and docs build guidance.
f650d60 to
52f2663
Compare
|
@SoheylM @markfuge
|
.github/workflows/pre-commit.yaml
Outdated
| - name: Lint all commit messages within the PR | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install git+https://gitlab.ethz.ch/sis/tools/conventional-commit-lint.git |
There was a problem hiding this comment.
Could we pin this install to the same version as local pre-commit (rev: 0.9.0)? CI currently installs from Git HEAD, while local hooks are pinned, so upstream changes can create pass-local/fail-CI drift. Suggestion: pip install git+https://gitlab.ethz.ch/sis/tools/conventional-commit-lint.git@0.9.0.
There was a problem hiding this comment.
Applied. CI now pins to git+https://gitlab.ethz.ch/sis/tools/conventional-commit-lint.git@0.9.0, matching the local pinned hook version.
AGENTS.md
Outdated
|
|
||
| ### Validation of the commit message | ||
|
|
||
| - Use [gommitlint](https://codeberg.org/Itiquette/gommitlint) with the configuration of this repo, [.gommitlint.yml](.gommitlint.yml) as follows: |
There was a problem hiding this comment.
Same mismatch as CONTRIBUTING: this still instructs gommitlint validate ..., but the project now uses conventional-commit-lint. Please align this with the current toolchain so agent guidance remains accurate.
There was a problem hiding this comment.
Aligned. AGENTS now documents conventional-commit-lint and no longer references gommitlint.
CONTRIBUTING.md
Outdated
| ### Commit Message Format | ||
|
|
||
| We follow the rules of [conventional commit](https://www.conventionalcommits.org). | ||
| This will be checked in our CI by [gommitlint](https://codeberg.org/Itiquette/gommitlint) using |
There was a problem hiding this comment.
This section says CI checks commit messages with gommitlint + .gommitlint.yml, but the workflow now runs conventional-commit-lint. Could we update this text to match the actual CI enforcement so contributors follow the right tool?
There was a problem hiding this comment.
Aligned. CONTRIBUTING now points to conventional-commit-lint as the CI commit-message checker.
52f2663 to
29df9f7
Compare
|
@SoheylM Thanks again for the careful review! |
|
Final review pass on latest head 29df9f7:
From my side, this is ready for merge. |
Description
In this PR, a new commit-msg hook is introduced which also will be checked in CI.
This should enforce conventional commits.
The convention is also mentioned in [CONTRIBUTING.md] and [README.md].
Bonus: a new AGENTS.md is included (to be read by AI agents).
Type of change
Please delete options that are not relevant.
Checklist:
pre-commitchecks withpre-commit run --all-filesruff check .andruff formatmypy .Reviewer Checklist: