compile: stop adding ineffective merge=ours to lock.yml .gitattributes entry#50639
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. No ADR enforcement needed: PR does not have the implementation label and has ≤100 new lines of code in business logic directories (38 additions detected). |
|
✅ Test Quality Sentinel completed test quality analysis. |
|
|
There was a problem hiding this comment.
Pull request overview
Removes ineffective merge=ours handling while preserving repository-owned .gitattributes policies.
Changes:
- Adds exact legacy-entry migration.
- Updates tests and documentation.
- Updates the repository’s own lock-file attribute.
Show a summary per file
| File | Description |
|---|---|
.gitattributes |
Removes merge=ours. |
create.md |
Updates authoring guidance. |
pkg/cli/add_gitattributes_test.go |
Updates add-command expectations. |
pkg/cli/git.go |
Restricts migration to the exact legacy entry. |
pkg/cli/gitattributes_test.go |
Tests migration and policy preservation. |
pkg/cli/init_command_test.go |
Updates initialization expectations. |
pkg/cli/init_integration_test.go |
Updates integration expectations. |
pkg/cli/init_test.go |
Updates initialization tests. |
pkg/constants/README.md |
Updates the generated constants appendix, but incompletely. |
pkg/constants/constants.go |
Defines current and legacy entries. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 10/10 changed files
- Comments generated: 1
- Review effort level: Balanced
| | `constants.go` | `const` | `WorkflowsDir` | `const WorkflowsDir = ".github/workflows"` | WorkflowsDir is the GitHub Actions workflow directory path (without trailing slash). | | ||
| | `constants.go` | `const` | `WorkflowsDirSlash` | `const WorkflowsDirSlash = WorkflowsDir + "/"` | WorkflowsDirSlash is WorkflowsDir with a trailing slash. | | ||
| | `constants.go` | `const` | `WorkflowsLockYmlGitAttributesEntry` | `const WorkflowsLockYmlGitAttributesEntry = WorkflowsLockYmlGlob + " linguist-generated=true merge=ours"` | WorkflowsLockYmlGitAttributesEntry is the . | | ||
| | `constants.go` | `const` | `WorkflowsLockYmlGitAttributesEntry` | `const WorkflowsLockYmlGitAttributesEntry = WorkflowsLockYmlGlob + " linguist-generated=true"` | WorkflowsLockYmlGitAttributesEntry is the . | |
There was a problem hiding this comment.
The change is correct and well-implemented.
merge=ourswithout a configuredmerge.ours.driveris a no-op, so removing it fixes a misleading gitattributes entry.- The migration uses an exact-match against the legacy constant rather than
HasPrefix, which correctly prevents clobbering repository-owned policy (e.g.merge=union). - The duplicate-entry case for repo-owned lines is intentional and tested: git unions attributes from both matching lines.
- Tests cover all four scenarios (absent, legacy, current, repo-owned), and docs are updated consistently.> 🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 16 AIC · ⌖ 10.2 AIC · ⊞ 5.4K
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /codebase-design — approving with one minor documentation note.
📋 Key Themes & Highlights
Key Themes
- Root cause properly addressed: the
merge=oursattribute was silently inert without a configured merge driver; removing it eliminates the false assurance. - Surgical migration logic: switching from
strings.HasPrefixto exact match on the legacy constant ensures only gh-aw's own prior entry is touched — repository-owned policy lines are preserved. - Good test coverage: new cases for legacy-entry migration and repo-owned-policy preservation directly capture the previously missing scenarios.
Minor Finding
WorkflowsLockYmlGitAttributesEntryLegacyis not yet reflected inpkg/constants/README.md— see inline comment.
Positive Highlights
- ✅ Clear naming: legacy constant name makes the intent unmistakable.
- ✅ Behaviour table in the PR description precisely documents all three cases.
- ✅ All existing tests updated consistently.
| | `constants.go` | `const` | `WorkflowsDir` | `const WorkflowsDir = ".github/workflows"` | WorkflowsDir is the GitHub Actions workflow directory path (without trailing slash). | | ||
| | `constants.go` | `const` | `WorkflowsDirSlash` | `const WorkflowsDirSlash = WorkflowsDir + "/"` | WorkflowsDirSlash is WorkflowsDir with a trailing slash. | | ||
| | `constants.go` | `const` | `WorkflowsLockYmlGitAttributesEntry` | `const WorkflowsLockYmlGitAttributesEntry = WorkflowsLockYmlGlob + " linguist-generated=true merge=ours"` | WorkflowsLockYmlGitAttributesEntry is the . | | ||
| | `constants.go` | `const` | `WorkflowsLockYmlGitAttributesEntry` | `const WorkflowsLockYmlGitAttributesEntry = WorkflowsLockYmlGlob + " linguist-generated=true"` | WorkflowsLockYmlGitAttributesEntry is the . | |
There was a problem hiding this comment.
[/codebase-design] The new WorkflowsLockYmlGitAttributesEntryLegacy constant is missing from the README appendix — only WorkflowsLockYmlGitAttributesEntry appears on this line.
If this README is auto-generated (e.g. via make), re-run the generator to include the new constant. If it is manually maintained, add the missing row so the constant is discoverable.
@copilot please address this.
🧪 Test Quality Sentinel Report✅ Test Quality Score: N/A — No New Tests
📊 Metrics
Changed test files:
All changes are string-literal updates reflecting the new Verdict
|
PR Triage: #50639Category: refactor | Risk: low | Priority Score: 50/100 (impact 20, urgency 15, quality 15)
|
|
@copilot please follow up on the latest review feedback on this PR:
|
…ME appendix, update counts Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Fixed in the latest commit: added the missing |
|
@copilot please follow up on the latest review feedback on this PR:
|
gh aw compileappendedmerge=oursto the lock-file.gitattributesentry.merge=oursis not a built-in git merge driver — withoutmerge.ours.driverconfigured it is inert, falsely implying generated-file conflicts are auto-resolved. The old code also rewrote any pre-existing line starting with the lock-yml glob, clobbering repository-owned policy on every compile.Changes
pkg/constants/constants.go:WorkflowsLockYmlGitAttributesEntrydropsmerge=ours→.github/workflows/*.lock.yml linguist-generated=true. AddedWorkflowsLockYmlGitAttributesEntryLegacyfor the old value, used only to detect entries gh-aw previously wrote.pkg/cli/git.go(ensureGitAttributes): replaced thestrings.HasPrefix(glob)match with an exact match against the legacy entry. Only gh-aw's own prior entry is migrated; other repo-owned lock-yml lines are left untouched.create.mdandpkg/constants/README.md.Behavior
... linguist-generated=true... linguist-generated=true merge=ours(legacy gh-aw)merge=oursremoved... linguist-generated=true merge=union(repo-owned)The repository's own legacy entry will be migrated on the next
compilerun.merge=oursto .gitattributes, overwriting repo-owned policy #50583