feat(agents): deduplicate CLAUDE.md and AGENTS.md in agent context#1189
feat(agents): deduplicate CLAUDE.md and AGENTS.md in agent context#1189
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
nhopeatall
left a comment
There was a problem hiding this comment.
LGTM — clean, focused change. The dedup logic is sound: symlink fast-path via lstatSync/readlinkSync correctly avoids following symlinks, content equality fallback handles copy-paste duplicates and permission errors gracefully. The results.length === 2 guard ensures no unnecessary filesystem calls when only one file exists. Existing tests remain correct because unmocked lstatSync throws → caught → falls to content comparison → different content → both files kept. Six new tests provide solid coverage of the key scenarios (content match, content mismatch, symlink in both directions, lstat failure fallback, single-file short-circuit).
🕵️ claude-code · claude-opus-4-6 · run details
Summary
lstatSync/readlinkSync, falling back to trimmed-content string comparison for copy-paste duplicates or when filesystem calls failsrc/agents/utils/setup.ts(readContextFiles+ newareDuplicateContextFileshelper)Card: https://trello.com/c/H7YTaJag/628-right-now-we-put-agentsmd-and-claudemd-into-the-context-sometimes-they-have-exact-same-contents-checksum-wise-sometimes-one-is-a
Test plan
tests/unit/agents/utils/setup.test.tscovering:CLAUDE.md(content match)AGENTS.mdis a symlink toCLAUDE.md→ deduplicatedCLAUDE.mdis a symlink toAGENTS.md→ deduplicatedlstatthrows → falls back to content comparison correctlylstatSyncnever called)setup.test.tspass (25 original + 6 new)🤖 Generated with Claude Code
🕵️ claude-code · claude-sonnet-4-6 · run details