← 输入框|github.com|刷新
Skip to content

refactor: save a git call when the author is on ignore_authors - #694

Merged
shenxianpeng merged 2 commits into
mainfrom
claude/project-thread-pofwgp
Nov 11, 2026
Merged

shenxianpeng merged 2 commits into
mainfrom
claude/project-thread-pofwgp

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Before: since #692, an author check that gets no message asks git whether a commit exists before it reads ignore_authors. An author on the list costs one git command more than in 2.20.4. Git commands run by commit-check --author-name (from GIT_TRACE) when the last commit is by dependabot[bot], who is on the list:

git rev-parse --git-dir
git rev-parse --verify HEAD
git log -n 1 '--pretty=format:%an' HEAD
⊘ skipped (not validated): author-name

CodSpeed reported two author benchmarks 18% slower on #692; both ran this extra lookup.

After: the same two commands as 2.20.4.

git rev-parse --git-dir
git log -n 1 '--pretty=format:%an' HEAD
⊘ skipped (not validated): author-name

How

  • AuthorValidator.validate reads ignore_authors first again and looks up whether a commit exists only when the list said no. In a repository with no commits it then asks the list a second time about the identity the first commit will carry, so what fix: check the first commit's author, name author.* in the CC017 advice #692 fixed stays fixed.
  • test_get_author_value_with_email_format mocks git but ran the commit lookup against the real repository. It now passes has_head=True, so nothing is looked up. Patching the lookup instead was slower than the git call by CodSpeed's count (callgrind, per run: 1.47M instructions on main, 1.92M with the extra patch, 1.26M with has_head=True).
  • No change in results. Across the whole suite these two tests are the only ones whose git command count changes (1 to 0); coverage stays at 100%.

The author checks asked git whether a commit exists before they read
ignore_authors, so an author on the list cost one `git rev-parse` more
than in 2.20.4. Read the list first again, and look the commit up only
when the list said no; a repository with no commits then asks the list
a second time about the identity the first commit will carry.

One test of the fallback to the last commit's author ran that lookup
against the real repository. It now patches it like the other git calls.
@shenxianpeng
shenxianpeng requested a review from a team as a code owner November 11, 2026 05:10
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor
Pre-merge checks: Passed 1 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Passed Passed checks: 1 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot added the chore label Nov 11, 2026
@shenxianpeng shenxianpeng added refactor Refactor source code and removed chore labels Nov 11, 2026 — with Claude
@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (079bb74) to head (5305273).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #694   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           15        15           
  Lines         2598      2600    +2     
  Branches       507       508    +1     
=========================================
+ Hits          2598      2600    +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed

codspeed Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 27.34%

2 warnings

⚠️ 133 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ 4 benchmarks with a significant change ran on different hardware

Their base and head results were measured on machines with a different CPU, core count or memory, so the changes might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

⚡ 4 improved benchmarks
✅ 681 untouched benchmarks
⏩ 131 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_docs_url_points_at_the_published_site 313.4 µs 206.9 µs +51.47%
⚡ test_author_validator_ignored_author 2.4 ms 1.9 ms +24.12%
⚡ test_get_author_value_with_email_format 2.5 ms 2.1 ms +22.57%
⚡ test_docs_url_derives_from_id 284.6 µs 249.5 µs +14.1%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing claude/project-thread-pofwgp (5305273) with main (079bb74)

Open in CodSpeed

Footnotes

  1. 131 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Patching has_commits in the fallback test built a mock that costs more
than the git call it replaced, by CodSpeed's count. The test now tells
_get_author_value that a commit exists, so nothing is looked up.
@github-actions github-actions Bot added the chore label Nov 11, 2026
@sonarqubecloud

Copy link
Copy Markdown

@shenxianpeng shenxianpeng removed the refactor Refactor source code label Nov 11, 2026 — with Claude
@shenxianpeng
shenxianpeng merged commit c5904d6 into main Nov 11, 2026
33 checks passed
@shenxianpeng
shenxianpeng deleted the claude/project-thread-pofwgp branch November 11, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant