fix(hooks): JSON-escape GT_BIN path on Windows in resolveAndSubstitute (gt-1at)#3246
Closed
baumgold wants to merge 2 commits intogastownhall:mainfrom
Closed
fix(hooks): JSON-escape GT_BIN path on Windows in resolveAndSubstitute (gt-1at)#3246baumgold wants to merge 2 commits intogastownhall:mainfrom
baumgold wants to merge 2 commits intogastownhall:mainfrom
Conversation
…e (gt-1at)
Windows paths contain backslashes which are invalid in JSON strings without
escaping. When {{GT_BIN}} was substituted into JSON templates, it produced
invalid JSON on Windows, causing TemplateContentEqual to fail to unmarshal
the content and incorrectly return false (triggering SyncUpdated instead
of SyncUnchanged).
Fix: escape backslashes before substitution.
Fixes TestSyncForRole_JSONWhitespaceInsensitive on Windows.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… paths (gt-1at) strings.ReplaceAll(original, ":", " : ") in TestSyncForRole_JSONWhitespaceInsensitive corrupts Windows drive letters (C: → C :), making the JSON structurally different and causing the test to fail even after the backslash-escaping fix. Replace with json.Unmarshal + json.MarshalIndent round-trip which changes only indentation whitespace without touching string values.
❌ 5 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Contributor
Author
Build Status NoteThe CI failures on this PR are pre-existing failures on
Merge order: #3242 must land first. Once merged, this PR's CI should pass. The Windows-specific fix ( |
steveyegge
added a commit
that referenced
this pull request
Mar 27, 2026
Fix-merge three baumgold PRs with conflict resolution: - PR #3246: JSON-escape GT_BIN on Windows — use json.MarshalIndent in test reformatter to avoid corrupting Windows drive letters - PR #3243: doctor hooks-sync uses ResolveRoleAgentName + preset directly instead of ResolveAgentConfigByName, preventing false negatives when non-Claude binary not in PATH - PR #3242: hooks-sync uses same preset-based approach for installing hooks for configured agent even when binary not found - Both #3243/#3242: remove t.Parallel() from tests that modify package-level globals, eliminating data races Co-authored-by: baumgold <baumgold@users.noreply.github.com>
htristan
pushed a commit
to htristan/gastown
that referenced
this pull request
Mar 27, 2026
…ooks fixes (gt-91g) Fix-merge three baumgold PRs with conflict resolution: - PR gastownhall#3246: JSON-escape GT_BIN on Windows — use json.MarshalIndent in test reformatter to avoid corrupting Windows drive letters - PR gastownhall#3243: doctor hooks-sync uses ResolveRoleAgentName + preset directly instead of ResolveAgentConfigByName, preventing false negatives when non-Claude binary not in PATH - PR gastownhall#3242: hooks-sync uses same preset-based approach for installing hooks for configured agent even when binary not found - Both gastownhall#3243/gastownhall#3242: remove t.Parallel() from tests that modify package-level globals, eliminating data races Co-authored-by: baumgold <baumgold@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3250
On Windows,
GT_BINpaths contain backslashes (e.g.C:\\tools\\gt.exe). When substituted literally into a JSON template, raw backslashes produce invalid JSON.Changes:
resolveAndSubstitutebefore{{GT_BIN}}substitutionjson.MarshalIndentinstead ofstrings.ReplaceAll(":", " : ")which was corrupting Windows drive letters (C:→C :)