Skip to content

jsweep: use git commit timestamp for deterministic file selection ordering#31335

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/update-jsweep-file-selection
Closed

jsweep: use git commit timestamp for deterministic file selection ordering#31335
Copilot wants to merge 2 commits intomainfrom
copilot/update-jsweep-file-selection

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 10, 2026

✨ Enhancement

What does this improve?

jsweep's Priority 2 file selection previously used filesystem mtime, which is not preserved across git clone or CI runners — making the pick non-deterministic between machines.

Why is this valuable?

  • Selection order is now identical on every runner and fresh checkout
  • Files with no git history (timestamp 0) automatically sort to the front

Implementation approach:

  • jsweep.md — Replace "earliest modification timestamp" with a git log-based lookup:

    git log --format="%at" --follow -- <file> | head -1
    # empty output → treat as timestamp 0 (never committed; bubbles to top)

    Sort uncleaned candidate files ascending by this value; pick the lowest.

  • jsweep_workflow_test.go — Add GitBasedDeterministicOrdering test (Test 16) asserting git log --format is present and earliest modification timestamp is absent from the workflow source.

Replace filesystem modification timestamp ordering in Priority 2 with
git log-based ordering. Files are now selected by their earliest git
commit timestamp (via `git log --format="%at" --follow -- <file>`),
making the selection order reproducible across CI machines and fresh
checkouts. Files never touched by git get timestamp 0 and bubble to
the top automatically.

Also add a test (GitBasedDeterministicOrdering) to verify the workflow
uses git log ordering and no longer references modification timestamps.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update jsweep file selection to use git-based deterministic ordering jsweep: use git commit timestamp for deterministic file selection ordering May 10, 2026
Copilot AI requested a review from pelikhan May 10, 2026 12:41
@pelikhan pelikhan marked this pull request as ready for review May 10, 2026 15:52
Copilot AI review requested due to automatic review settings May 10, 2026 15:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates jsweep’s Priority 2 file selection guidance to use Git commit timestamps (instead of filesystem mtime) so selection ordering is deterministic across CI runners and fresh clones, and adds a regression test to enforce the new wording.

Changes:

  • Update Priority 2 selection in jsweep.md to derive per-file ordering from git log --format="%at" ... timestamps (with empty output treated as 0).
  • Add a workflow test asserting the documentation contains the git log --format approach and no longer mentions filesystem modification timestamps.
Show a summary per file
File Description
pkg/workflow/jsweep_workflow_test.go Adds a test that enforces the new git-based deterministic ordering language in jsweep.md.
.github/workflows/jsweep.md Replaces filesystem mtime ordering with a git-log-based timestamp ordering description for Priority 2 selection.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

- Exclude files already listed in `cleaned_files` in the loaded state
- **Priority 1**: Pick files with `@ts-nocheck` or `// @ts-nocheck` comments (these need type checking enabled)
- **Priority 2**: If no uncleaned files with `@ts-nocheck` remain, pick the **one file** with the earliest modification timestamp that hasn't been cleaned
- **Priority 2**: If no uncleaned files with `@ts-nocheck` remain, determine the last-committed timestamp for each uncleaned file by running `git log --format="%at" --follow -- <file> | head -1` (empty output means the file has never been committed; treat it as timestamp `0`). Sort ascending by that timestamp and pick the **one file** with the earliest git commit timestamp. This ordering is deterministic across CI machines and fresh checkouts, and files never touched by git automatically bubble to the top.
@pelikhan pelikhan closed this May 10, 2026
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.

[q] Update jsweep file selection to use git-based deterministic ordering

3 participants