-
Notifications
You must be signed in to change notification settings - Fork 46
Remove version numbers from frontmatter hash computation #13174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
….0.88 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot remove all version numbers from the frontmatter hash compiattion. In go and JavaScript . |
- Removed version information from hash computation in both Go and JavaScript - Removed buildVersionInfo function and VERSIONS constant - Removed SetCompilerVersion and SetIsRelease functions - Updated tests to not check for version information - Recompiled all workflow lock files with new hash computation Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Removed all version numbers from frontmatter hash computation in both Go and JavaScript. Changes include:
Currently investigating hash consistency test failures between Go and JS implementations for certain workflows. The hash computation is working correctly (TestHashConsistencyAcrossLockFiles passes), but TestGoJSHashStability shows mismatches for some workflows. Will debug and fix in next commit. |
|
@copilot investigate tear failures |
…haling Go's json.Marshal escapes <, >, & to \u003c, \u003e, \u0026 for HTML safety, while JavaScript's JSON.stringify does not. This caused hash mismatches for workflows with these characters in frontmatter. Solution: Use json.NewEncoder with SetEscapeHTML(false) to match JavaScript behavior. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed the test failures. The issue was HTML escaping inconsistency between Go and JavaScript:
All tests now pass:
Commit: 47e72b0 |
🔍 PR Triage ResultsCategory: bug | Risk: medium | Priority: 75/100 Scores Breakdown
📋 Recommended Action: fast-trackTop priority fix - Resolves hash mismatch caused by HTML escaping differences (Go's All 148 workflow hash tests now pass. Ready for immediate review. Triaged by PR Triage Agent on 2026-02-02
|
Remove Version Numbers from Frontmatter Hash Computation
Per @pelikhan's request, removed all version numbers from the frontmatter hash computation in both Go and JavaScript implementations.
Changes Made
Go (
pkg/parser/frontmatter_hash.go):buildVersionInfo()functioncanonical["versions"] = buildVersionInfo()calls (2 locations)compilerVersionandisReleaseVersionvariablesSetCompilerVersion()andSetIsRelease()functionsconstantspackage importmarshalJSONWithoutHTMLEscape()helper to match JavaScript JSON encoding behavior<,>,&but JavaScript was not)JavaScript (
actions/setup/js/frontmatter_hash_pure.cjs):VERSIONSconstantcanonical.versions = VERSIONSassignmentMain Entry Point (
cmd/gh-aw/main.go):parser.SetCompilerVersion()andparser.SetIsRelease()parserpackage importTests:
frontmatter_hash_stability_test.goto remove version-checking logicfrontmatter_hash_test_main_test.goto remove version setupWorkflows:
Root Cause of Hash Mismatches
The test failures were caused by a subtle difference in JSON encoding between Go and JavaScript:
json.Marshal: Escapes HTML characters (<→\u003c,>→\u003e,&→\u0026)JSON.stringify: Does NOT escape HTML charactersThis caused different canonical JSON representations for workflows containing
<,>, or&in their frontmatter (e.g., comments like<1000 words), resulting in different hashes.Solution
Created
marshalJSONWithoutHTMLEscape()helper function that usesjson.NewEncoderwithSetEscapeHTML(false)to match JavaScript's behavior.Impact
Testing
✅
TestHashConsistency_KeyOrderingpasses✅
TestHashConsistencyAcrossLockFilespasses (all 148 workflows)✅
TestGoJSHashStabilitypasses (all 10 workflows tested)✅ All parser package tests pass
Remove version information from Go hash computation
Remove version information from JavaScript hash computation
Remove unused version-related functions and variables
Update tests
Recompile all workflow lock files
Fix HTML escaping inconsistency between Go and JavaScript
Verify all tests pass
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.