Skip to content

Use frontmatter hash comparison for workflow timestamp checks with coarse granularity#13213

Merged
pelikhan merged 5 commits into
mainfrom
copilot/update-workflow-hash-check
Feb 2, 2026
Merged

Use frontmatter hash comparison for workflow timestamp checks with coarse granularity#13213
pelikhan merged 5 commits into
mainfrom
copilot/update-workflow-hash-check

Conversation

Copilot AI commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Workflow timestamp checking fails to detect changes when the .md and .lock.yml files have identical commit timestamps but different SHAs. This occurs in batch commits where multiple files are modified simultaneously.

Changes

Detection logic for all timestamp scenarios:

  • When workflowDate > lockDate: Source is newer - always requires recompilation
  • When workflowDate === lockDate but SHAs differ: Compute and compare frontmatter hashes to handle coarse timestamp granularity - fail if hashes differ
  • When workflowDate < lockDate: Lock is newer - always pass (lock was already recompiled). Hash verification is performed for informational purposes only and never causes failure
  • Conservative fallback: pass if hash computation fails

Refactored hash comparison:

  • logFrontmatterHashComparison()compareFrontmatterHashes()
  • Returns { match, storedHash, recomputedHash } for decision-making
  • Enhanced step summaries to include hash comparison details when relevant

Example

// Before: Would pass incorrectly for coarse timestamps
if (workflowDate > lockDate) {
  core.setFailed("outdated");
} else {
  core.info("up to date");  // Wrong for coarse timestamps
}

// After: Uses hash comparison for coarse timestamps only
if (workflowTime > lockTime) {
  // Source is newer - always fail
  core.setFailed("outdated");
} else if (workflowTime === lockTime) {
  // Coarse timestamp - use hash to break tie
  const comparison = await compareFrontmatterHashes();
  if (comparison && !comparison.match) {
    core.setFailed("frontmatter hash mismatch");
  }
} else {
  // Lock is newer - always pass (already recompiled)
  // Hash check is informational only, never fails
  core.info("up to date");
}
Original prompt

Update the JavaScript that checks if a workflow is outdated: if the timestamp is course, compute the frontmatter hash (using GitHub APIs + helpers) and compare to the frontmatter hash in the lock file. If hashes do not match , the workflow need rexompilation.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…mestamps

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update JavaScript for checking outdated workflow Use frontmatter hash comparison for workflows with identical commit timestamps Feb 2, 2026
Copilot AI requested a review from pelikhan February 2, 2026 06:12
@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

🔍 PR Triage Results

Category: chore | Risk: medium | Priority: 40/100

Scores Breakdown

  • Impact: 20/50 - Improves workflow timestamp checking with frontmatter hash comparison
  • Urgency: 10/30 - Just created today, still in draft status
  • Quality: 10/20 - Draft PR with detailed description

📋 Recommended Action: batch_review

This PR improves the reliability of workflow outdated detection by using hash comparison for coarse timestamps. Should be reviewed with other workflow improvement PRs.

Batch: Copilot chore improvements (Batch 2)


Triaged by PR Triage Agent on 2026-02-02

AI generated by PR Triage Agent

@pelikhan

pelikhan commented Feb 2, 2026

Copy link
Copy Markdown
Collaborator

@copilot you need to ha dle the case where the .md file is older than the lock.yml file. In that case , check if the frontmatter hashes are still the same (from lock file va recomputed). If matching, the lock file is still up to date.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Feb 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot you need to ha dle the case where the .md file is older than the lock.yml file. In that case , check if the frontmatter hashes are still the same (from lock file va recomputed). If matching, ...

Added hash verification for the case when lock file is newer than the .md file. The code now computes and compares frontmatter hashes in all three cases:

  1. When .md is newer than lock (workflowTime > lockTime)
  2. When timestamps are equal (workflowTime === lockTime)
  3. When lock is newer than .md (workflowTime < lockTime) ✅ NEW

If hashes don't match in any case, the workflow fails with appropriate error message. Commit: 49e575b

Copilot AI changed the title Use frontmatter hash comparison for workflows with identical commit timestamps Use frontmatter hash comparison for all workflow timestamp scenarios Feb 2, 2026
@pelikhan pelikhan marked this pull request as ready for review February 2, 2026 07:12
@pelikhan pelikhan added the smoke label Feb 2, 2026
@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

🔧 Agent Container Tool Check

Smoke test results for PR #13213 development tools:

Tool Status Version
bash 5.2.21
sh available
git 2.52.0
jq 1.7
yq 4.50.1
curl 8.5.0
gh 2.86.0
node 24.13.0
python3 3.13.11
go 1.24.12
java NOT FOUND
dotnet NOT FOUND

Result: 10/12 tools available

Status: ⚠️ PARTIAL - Core tools available, Java/dotnet missing


Core development tools (bash, git, jq, yq, curl, gh, node, python3, go) are all present and functional.

AI generated by Agent Container Smoke Test

@pelikhan

pelikhan commented Feb 2, 2026

Copy link
Copy Markdown
Collaborator

@copilot recompile

Copilot AI commented Feb 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot recompile

Recompile completed successfully. All 148 workflow files were processed and no lock files needed updating - they are already up to date with the latest code changes.

@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.52.0
jq 1.7
yq 4.50.1
curl 8.5.0
gh 2.86.0
node 24.13.0
python3 3.13.11
go 1.24.12
java N/A
dotnet N/A

Result: 10/12 tools available
Status: FAIL ❌

Missing Tools:

  • java - Java runtime not available
  • dotnet - .NET runtime not available

AI generated by Agent Container Smoke Test

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Feb 2, 2026

Copy link
Copy Markdown
Contributor Author

@copilot the checkout for outdated lock files should ignore lock file that are newer than the .md file. Those are recompiled. Do the hash check when the .md file is older than the lock file

Fixed the logic. When lock file is newer than .md file, the check now always passes (lock was already recompiled). Hash verification is done for informational purposes only, but no failure occurs even if hashes differ. The failure only happens when .md is newer or when timestamps are equal with mismatched hashes. Commit: e22f7f8

Copilot AI changed the title Use frontmatter hash comparison for all workflow timestamp scenarios Use frontmatter hash comparison for workflow timestamp checks with coarse granularity Feb 2, 2026
@pelikhan pelikhan added smoke and removed smoke labels Feb 2, 2026
@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

🧪 Smoke Project is now testing project operations...

@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰

@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.52.0
jq 1.7
yq 4.50.1
curl 8.5.0
gh 2.86.0
node 24.13.0
python3 3.13.11
go 1.24.12
java not found
dotnet not found

Result: 10/12 tools available - FAIL ⚠️

Missing tools:

  • java - command not found
  • dotnet - command not found

AI generated by Agent Container Smoke Test

@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Test results: Draft ✅ | Field+New ✅ | Field Update ✅ | Issue Add ✅ | PR Add ✅ | Views ✅ | Status ✅ | URL Req ✅
Overall: PASS

AI generated by Smoke Project

@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Smoke Project completed successfully. All project operations validated.

@pelikhan pelikhan merged commit dc1594d into main Feb 2, 2026
84 checks passed
@pelikhan pelikhan deleted the copilot/update-workflow-hash-check branch February 2, 2026 07:58
@github-actions github-actions Bot removed the smoke label Feb 2, 2026
@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Smoke Test Results

✅ PASS - §21581803544

cc @pelikhan @Copilot

AI generated by Smoke Copilot

@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

[WIP] Investigate fronmatter hash mismatch and add integration tests
Update smoke-project workflow to trigger on "smoke" label and use codex engine
Tests: 1✅ 2✅ 3✅ 4✅ 5✅ 6✅ 7✅ 8✅ 9✅
Overall: PASS

AI generated by Smoke Codex

@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Claude - Run 21581803563

✅ GitHub MCP | ✅ Safe Inputs GH CLI | ✅ Serena MCP | ✅ Make Build | ✅ Playwright | ✅ Tavily Search | ✅ File Write | ✅ Bash Tool | ✅ Discussion Interaction

Overall Status: PASS

AI generated by Smoke Claude

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants