Skip to content

DEVOPS-1320: speedup pre-commit hook extracting issue number from branch - #22

Merged
sebhmg merged 14 commits into
mainfrom
DEVOPS-1320
Dec 3, 2026
Merged

sebhmg merged 14 commits into
mainfrom
DEVOPS-1320

Conversation

@sebhmg

@sebhmg sebhmg commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

DEVOPS-1320 - speedup pre-commit hook extracting issue number from branch

Copilot AI balanced review requested due to automatic review settings October 28, 2026 22:06
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Force push detected - Previous Copilot review comments may no longer be relevant to the current code. Please resolve any outdated threads and re-request a Copilot review when ready.

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

The dependency-group migration is incompatible with CI’s pinned Poetry 2.1.3, and the hook’s hard-coded .git path can cause incorrect JIRA-ID handling when GIT_DIR selects another repository.

2 open issues
What changed in this PR

This PR updates packaging and branch detection for the pre-commit hooks, adding Git-based dynamic versioning and direct reading of repository metadata.

Changes:

  • Replace Git branch-list parsing with HEAD and rebase-state inspection, with tests for normal repositories and worktrees.
  • Introduce generated version files, fallback version handling, and updated Poetry configuration.
  • Refresh pre-commit tool revisions and copyright notices.
File Description
tests/​version_test.py Test fallback versions and generated-version consistency.
tests/​git_message_hook_test.py Cover repository discovery, worktrees, and rebase states.
tests/​check_copyright_test.py Update copyright year.
tests/​__init__.py Update copyright year.
README.rst Refresh copyright notices and company name.
pyproject.toml Configure dynamic versioning and migrate development dependency groups.
poetry.lock Update lockfile format and dependency metadata.
mirageoscience/​hooks/​git_message_hook.py Read branch information from Git metadata files.
mirageoscience/​hooks/​check_copyright.py Update copyright year.
mirageoscience/​hooks/​__init__.py Load the generated version with a dated development fallback.
mirageoscience/​__init__.py Update copyright year.
LICENSE Refresh copyright years and company name.
.pre-commit-config.yaml Update hook revisions.
.gitignore Ignore generated version files.

Review effort: Balanced

Comment thread pyproject.toml Resolved
@RomFloreani
RomFloreani self-requested a review November 5, 2026 15:32
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Force push detected - Previous Copilot review comments may no longer be relevant to the current code. Please resolve any outdated threads and re-request a Copilot review when ready.

@github-actions github-actions Bot changed the title Devops 1320 DEVOPS-1320: speedup pre-commit hook extracting issue number from branch Nov 17, 2026
@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

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

Branch discovery no longer finds the enclosing repository from subdirectories, causing missing-JIRA validation errors and preventing branch ticket IDs from being added during message preparation.

1 open issue
2 resolved since last review

Review effort: Balanced

@RomFloreani RomFloreani left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See small comment about dead code

@sebhmg
sebhmg requested review from RomFloreani and a balanced review from Copilot December 2, 2026 19:28

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

In trailer mode, the commit-message hook selects a leading blank line as the subject instead of the actual subject, causing messages with a sufficiently long subject and an issue trailer to fail the minimum-length check.

1 open issue
1 resolved since last review

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.

🔵 Needs a closer look

Replay handling depends on Git’s runtime hook arguments and transient rebase/cherry-pick state files. Clean cherry-pick behavior remains uncertain because CHERRY_PICK_HEAD is not guaranteed to exist, so integration verification is still needed.

No open issues 🎉

1 resolved since last review

Review effort: Lite

RomFloreani
RomFloreani previously approved these changes Dec 2, 2026
@sebhmg

sebhmg commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

here is the way it behaves for rebase:

  • regular rebase: adds the JIRA issue number automatically from branch name on the message if it was missing. It neither checks that the existing JIRA ID matches branch name, nor enforces having a JIRA ID
  • interactive rebase with user editing the message ("reword"):
    • if JIRA ID is present in the message header: leaves it as is
    • if JIRA ID is absent: automatically adds it in the editor according to the branch name
    • when closing the editor to commit: takes the message as is and neither checks the JIRA ID nor enforces it

Other said the prepare-message hooks does run while the check-message does not.

This is the behaviour I intended.

@sebhmg
sebhmg merged commit 6b87f3b into main Dec 3, 2026
21 checks passed
@sebhmg
sebhmg deleted the DEVOPS-1320 branch December 3, 2026 19:53
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.

3 participants