Skip to content

Conversation

@waltergalvao
Copy link
Contributor

@waltergalvao waltergalvao commented Jan 24, 2026

Summary by CodeRabbit

  • Bug Fixes

    • More accurate cycle time and time-to-code calculations, including cases where commits are dated before PR creation (rebases/edge cases).
  • Refactor

    • Improved commit date tracking using author/committer date fallbacks and preserving the earliest observed commit date across updates.

✏️ Tip: You can customize this high-level summary in your review settings.

@sweetr-dev sweetr-dev bot added the small Small PR - Quick and easy to review label Jan 24, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

Walkthrough

Renames getCycleTime parameter from firstCommitAt to fromDate and updates PR tracking to compute a preserved earliest firstCommitAt, derive startedCodingAt, and recompute timeToCode and cycleTime using the appropriate anchor between first commit and PR creation.

Changes

Cohort / File(s) Summary
Parameter rename
apps/api/src/app/github/services/github-pull-request-tracking.service.ts
Renamed getCycleTime second parameter from firstCommitAt to fromDate and updated internal null-checks and usage in differenceInBusinessMilliseconds.
Cycle time & first-commit preservation
apps/api/src/app/github/services/github-pull-request.service.ts
Adds candidateFirstCommitAt (author.date fallback to committer.date); preserves earliest firstCommitAt across observations; computes startedCodingAt as earlier of firstCommitAt and PR creation; recomputes timeToCode and cycleTime; minor GraphQL formatting tweaks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

medium

Suggested reviewers

  • sweetrdev
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: a fix to the firstCommitAt calculation logic, which is the core functional change across both modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/api/src/app/github/services/github-pull-request.service.ts`:
- Around line 331-356: The computed timeToCode currently uses
tracking?.firstReadyAt (stale/missing) instead of the freshly computed
firstReadyAt; update the call to getTimeToCode to pass the newly computed
firstReadyAt (with a fallback to tracking.firstReadyAt if needed) so timeToCode
= getTimeToCode(firstCommitAt, firstReadyAt ?? tracking?.firstReadyAt) (locate
symbols: firstCommitAt, firstReadyAt, tracking, getTimeToCode, timeToCode) and
ensure the rest of the logic still falls back correctly when no ready date
exists.

@waltergalvao waltergalvao merged commit dbaf5e6 into main Jan 24, 2026
8 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jan 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

small Small PR - Quick and easy to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants