Repository navigation
Fix #1982: codev update no longer reports unedited CLAUDE.md / AGENTS.md as conflicts; dry run matches the real run - #1984
Open
waleedkadous wants to merge 13 commits into
Open
waleedkadous wants to merge 13 commits into
waleedkadous wants to merge 13 commits into
Conversation
… outside the managed block; dry run reports what the real run does copyRootFiles treated any existing CLAUDE.md / AGENTS.md as a conflict and wrote the template beside it, comparing nothing (the identical-content check was lost when Spec 618 moved update onto this adopt helper). A doc that matches the template outside the managed block is now up to date; an edit inside the block is regenerated and reported as a block refresh; a .codev-new holding exactly the template beside an up-to-date doc is removed. The hot-tier, cold-tier and managed-block steps now run one code path in both modes; --dry-run computes the same result and writes nothing.
…its outside the block conflict and are kept; dry run matches the real run Also pins the known limit: an unedited doc from an older template that changed outside the block is still a conflict.
…hes; report a resolved .codev-new
The template varies only by {{PROJECT_NAME}}, filled from the checkout's directory
name, so a clone under another name was a false conflict on both docs. The
comparison now treats the placeholder as any name. A .codev-new removed beside an
up-to-date doc is reported in update (both modes) and adopt instead of vanishing.
…dev-new is reported, in dry and real runs alike
…opy is judged the way the doc is Line endings are normalised before the comparison, as skills already do, so a Windows checkout with autocrlf is not a false conflict. A leftover .codev-new is resolved when it matches the template the same way the doc does (any project name, outside the block), so a renamed checkout's leftover is cleaned up too.
…t's leftover .codev-new is resolved
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.
Summary
codev updatereported CLAUDE.md and AGENTS.md as conflicts on a project nobody had edited, and wrote.codev-newcopies byte-identical to them. Its--dry-runalso printed hot-tier, cold-tier and managed-block lines the real run did not. Root docs are now compared with the template outside the managed block, and the dry run computes the same result as the real run.Fixes #1982
Root Cause
copyRootFiles(packages/codev/src/lib/scaffold.ts), which update calls withhandleConflicts: true, compared nothing: any existing CLAUDE.md / AGENTS.md was a conflict, and the template was written beside it.update.tsused to skip a doc identical to the template (3cb6232, Dec 2025). That check was lost when Spec 618 (e66a014, Mar 2026) moved update ontocopyRootFiles, a helper written for adopt. The issue's guess (a comparison made before the block is rendered) was wrong: there was no comparison. The templates already carry the rendered managed block, which is why the.codev-newwas byte-identical. The existing "second update" test asserted onlyresult.conflicts(skills), neverrootConflicts, so it never caught this.update.tsprinted the hot-tier, cold-tier and managed-block lines unconditionally under--dry-run. The real run prints only whatcopyHotTierDefaults/copyColdTierDefaultscopied and whatsyncHotContextBlockchanged.Fix
copyRootFilesnow asksmatchesTemplate: does the doc match the template outside the managed block? Both sides go throughwithEmptyHotBlock(managed-block.ts), which leaves them as the block refresh would but with the block emptied. So the block's content, or its absence, never counts as an edit. The template varies only by{{PROJECT_NAME}}, filled from the checkout's directory name, so the placeholder matches any name. A team-mate's clone under another directory name is not a conflict. Line endings are normalised, as skills already do, so a Windows CRLF checkout is not a conflict either..codev-new..codev-newis never written identical to the file beside it.codev/resources/{arch,lessons}-critical.mdon every update (syncHotContextBlockalways did this, and the marker says do not edit). Such an edit is replaced and reported as~ (hot-tier block refreshed) <doc>, never as a conflict.copyHotTierDefaults,copyColdTierDefaultsandsyncHotContextBlocktakedryRun, and the flag only decides whether to write. When rendering the block, a dry run counts the hot files it would have created as present. Both modes print the same per-file lines; the dry run adds "would be". The real run's block line changes from~ (hot-tier block)to~ (hot-tier block refreshed)so that the only difference is that wording..codev-newcopies. A.codev-newbeside an up-to-date doc that matches the template the same way is removed, and reported as- (removed, nothing left to merge) <file>(dry run:would be removed). This cleans up the byte-identical leftovers this bug wrote in adopters' projects, following skills'removeResolvedCodevNewprecedent. A.codev-newwith any other content is kept.codev adopt, which sharescopyRootFiles. An adopted repo whose root doc already matches the template is no longer a conflict; the block is still injected on the nextcodev update, as before. Adopt can now remove a resolved leftover.codev-new, which it logs.codev/resources/commands/codev.mdand its skeleton twin now say how root docs are judged.Known limit (out of scope, pinned by a test)
A doc an adopter never edited, written by an older release whose template has since changed outside the block, is still a conflict. The template changed 11 times since May. Root docs carry no record of the version a release installed, so such a doc cannot be told from an edit. The doc is kept and the new template is offered as
.codev-new, as before. The testknown limit: an unedited doc from an older template that changed outside the block is still a conflictrecords this as a decision. Remedy I see: give root docs a shipped-template hash list like skills'SHIPPED_SKILL_HASHES(generated from git history), hashed after the same normalisation used here (managed block emptied, project name as wildcard, LF). A doc matching any shipped version is then unedited and can be replaced.Test Plan
packages/codev/src/__tests__/bugfix-1982-update-root-docs.test.ts. It runs the realinit()thenupdate(), withexecSyncstubbed only forgit init/codev doctor. The original 10 cases fail on the pre-fix source and pass with the fix. Each later case also failed on the commit before it. It covers:.codev-new, docs unchanged;.codev-new;.codev-newresolved and reported;.codev-new;.codev-new; one hot file, the cold files and AGENTS.md missing. The comparison runs in agent mode. The one documented divergence is the bootstrap-docs hint, which a dry run never prints.npm install -g --prefixinto a scratch prefix; no global install, no Tower restart), outside any repository.codev init fresh --yes && cd fresh && codev update --dry-runprintsAlready up to date!, and so does the real run, with no.codev-new. With CLAUDE.md edited outside the block, a skill edited, and AGENTS.md edited inside the block, both modes print the same two conflicts (edits kept) and an AGENTS.md block refresh. With governance files deleted, both modes print the same per-file+ (new)lines.No platform code (processes, shells, paths, terminals) is touched, so the Windows workflow was not dispatched.
CMAP
chore(porch): …commits lack the[Bugfix #1982]prefix. Rebutted: porch writes those commits itself for state transitions. 78 of the last 200 commits onmainarechore(porch)commits merged unchanged. Rewriting them would mean force-pushing porch's state history. codex found no code, test, security or documentation issue. Its second pass also caught a stale function name in this body, now corrected.