Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/jsweep.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fi
- Exclude test files (`*.test.cjs`)
- 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.

If no uncleaned files remain, start over with the oldest cleaned file (reset `cleaned_files` to only the one just chosen).

Expand Down
13 changes: 13 additions & 0 deletions pkg/workflow/jsweep_workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,19 @@ func TestJSweepWorkflowConfiguration(t *testing.T) {
t.Error("jsweep workflow should batch validation commands into a single chained command")
}
})

// Test 16: Verify Priority 2 uses git-based deterministic ordering
t.Run("GitBasedDeterministicOrdering", func(t *testing.T) {
if !strings.Contains(mdContent, "git log --format") {
t.Error("jsweep workflow Priority 2 should use git log for deterministic file ordering")
}
if strings.Contains(mdContent, "earliest modification timestamp") {
t.Error("jsweep workflow should not use filesystem modification timestamps for file ordering")
}
if !strings.Contains(mdContent, "deterministic") {
t.Error("jsweep workflow should describe the ordering as deterministic")
}
})
}

// TestJSweepWorkflowLockFile validates that the compiled jsweep.lock.yml file
Expand Down