fix(init): restore CONTEXTCRAWLER.md filename + legacy migration + regression-pinning test - #21
Merged
Merged
Conversation
…ession-pinning test (#19) Commit bcddd06 ("fix(hooks): rename hardcoded \`rtk hook\` commands + RTK.md deployment") silently flipped the downstream rebrand constants from "CONTEXTCRAWLER.md" / "@CONTEXTCRAWLER.md" back to upstream's "RTK.md" / "@RTK.md" during the upstream-rebase merge. The rebrand sweep (c0349b2, 540413e) missed it. The result: - `contextcrawler init -g --codex` wrote `~/.codex/RTK.md` instead of `~/.codex/CONTEXTCRAWLER.md` - AGENTS.md ended up with BOTH a stale `@CONTEXTCRAWLER.md` (from the previous install) and a fresh `@RTK.md` (from the new init), with the CONTEXTCRAWLER.md file left orphaned on disk - `patch_claude_md` wrote a hardcoded `@RTK.md\n` literal while the presence check used `RTK_MD_REF` (= "@CONTEXTCRAWLER.md") — meaning every run would re-append the same line, never detecting it was already present Fix: 1. **Constants restored** to "CONTEXTCRAWLER.md" / "@CONTEXTCRAWLER.md". 2. **Pinning regression test** (`test_rtk_md_constant_pinned_to_contextcrawler_filename`) makes any future revert blow up the test suite with a comment pointing back to issue #19. The "never do it again" insurance. 3. **`patch_claude_md` write paths** now use `RTK_MD_REF` interpolation instead of hardcoded `@RTK.md` literal — fixes the silent never-idempotent bug noted above. 4. **`cleanup_legacy_codex_files()`** runs as part of `run_codex_mode` so users upgrading from a regressed install get their orphan `~/.codex/RTK.md` removed and the stale `@RTK.md` reference stripped from AGENTS.md automatically. Idempotent — safe to run when nothing legacy is present. Future renames just add filenames to `LEGACY_RTK_MD_FILES` and old users get clean upgrades. 5. **`strip_at_reference_line()` helper** removes a matching `@<name>` line and collapses the surrounding blank lines so AGENTS.md doesn't accumulate extra vertical space across repeated cleanups. 6. **6 existing tests** that hardcoded "RTK.md"/"@RTK.md" updated to use the `RTK_MD` / `RTK_MD_REF` constants — they now track the constant value automatically. Cosmetic follow-up (separate issue): ~30 print/eprintln/doc-comment occurrences still hardcode "RTK.md"/"@RTK.md" labels. Non-functional but misleading; tracked separately so this PR stays reviewable. Tests: 5 new (pinning, 3 cleanup scenarios, blank-line collapse). All 2024 binary tests pass. Closes #19
Two P2 gaps raised by `codex review` on the initial fix: 1. **CLAUDE.md migration was incomplete.** On an upgraded install, `CLAUDE.md` may still contain `@RTK.md` from the regressed era. `content.contains(RTK_MD_REF)` only matched the new `@CONTEXTCRAWLER.md`, so the contains-check fell through and the appender added a second line, leaving both references in place. Fix: in `patch_claude_md`, scan for any whole-line `@<legacy>` from `LEGACY_RTK_MD_FILES` and rewrite each to `RTK_MD_REF` before the contains-check runs. Whole-line match avoids corrupting prose that incidentally mentions the legacy name. 2. **`uninstall_codex_at` and `show_codex_config` ignored legacy artifacts.** Both only looked for the new `RTK_MD` value, so a regressed install that had `~/.codex/RTK.md` / `@RTK.md` would be reported as unconfigured by `init --show` and would be left behind by `uninstall --codex`. Fix: extend `uninstall_codex_at` to iterate over the canonical name *and* every entry in `LEGACY_RTK_MD_FILES`, both as on-disk files and as @-references (relative + absolute forms). Extend `show_codex_config` to surface legacy artifacts with a `[!!]` marker hinting at the cleanup-on-next-init behaviour, and to include all legacy @-ref forms in the has_rtk_reference probe so the global/local AGENTS.md checks recognise a regressed install as configured-but-stale rather than unconfigured. Two new tests (`test_patch_claude_md_migrates_legacy_at_ref_in_place`, `test_uninstall_codex_at_removes_legacy_rtk_md_file_and_ref`) pin both codepaths so the next person who touches this can't quietly regress the upgrade path. All 2026 binary tests pass. Co-Authored-By: Codex review <noreply@openai.com>
This was referenced May 18, 2026
Merged
noogalabs
pushed a commit
to noogalabs/contextcrawler
that referenced
this pull request
Jun 4, 2026
… branding-lint extension **Version bump 0.39.0 → 0.1.7.** The upstream rebase pulled in rtk's `0.39.0` version; restoring the downstream `0.1.x` numbering line per the maintainer's call. `.release-please-manifest.json` updated to match. Last downstream tag was `v0.1.6` (2026-05-15); this is the next in the sequence. **release-please-config.json `package-name: "rtk"` → "contextcrawler".** Caught by manual audit during release prep. Same regression-family as thehoff#19 / thehoff#20 / thehoff#22: a rebrand gap the prior branding-lint (src/-scoped) didn't catch because release-please-config.json lives at repo root. Without this fix, release-please would have produced `rtk-vX.Y.Z` tags and release-PR titles. **Cargo.toml `extended-description` rebrand.** Line 77 still read "rtk filters and compresses..." — same upstream-leak family. Fixed. **Extended `tests/branding_lint.rs`** with a third test — `branding_lint_config_files_pin_canonical_package_name` — that: - Parses Cargo.toml and asserts `[package].name == "contextcrawler"` - Parses release-please-config.json and asserts `packages["."]["package-name"] == "contextcrawler"` This closes the gap that let release-please-config.json silently drift to `"rtk"` post-rebase. Any future rebase that re-introduces an upstream package-name fails `cargo test --test branding_lint` with an explicit error pointing at issues thehoff#19/thehoff#20/thehoff#22 history. **CHANGELOG.md** entry for v0.1.7 added, summarizing all PRs merged today (thehoff#10 thehoff#15 thehoff#16 thehoff#21 thehoff#24 thehoff#25 thehoff#30) plus the deferred follow-ups (thehoff#26 thehoff#27 thehoff#28 thehoff#29). Tests: 2027 bin + 3 branding-lint (1 new) + 1 harness = all pass. Verified: `contextcrawler --version` now prints `contextcrawler 0.1.7`. Refs thehoff#19 thehoff#20 thehoff#22 thehoff#29
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
Restores the downstream rebrand of the slim instructions file to
CONTEXTCRAWLER.md(commitbcddd06silently flipped it back toRTK.mdduring the upstream-rebase merge) and adds the never-do-it-again insurance.Functional fixes
RTK_MD/RTK_MD_REFconstants restored to"CONTEXTCRAWLER.md"/"@CONTEXTCRAWLER.md"patch_claude_md's write paths now interpolateRTK_MD_REF(was hardcoded@RTK.mdliteral — meaning the contains-check would miss its own writes and re-append every run)patch_claude_mdalso migrates pre-existing legacy@RTK.mdlines to the canonical form before the contains-check (codex P2)uninstall_codex_atcleans up both canonical ANDLEGACY_RTK_MD_FILESentries — file + relative + absolute @-refs (codex P2)show_codex_configsurfaces legacy artifacts with a[!!]marker and includes legacy refs in the has_rtk_reference probe (codex P2)Auto-migration for upgrading users
cleanup_legacy_codex_files()runs as part ofrun_codex_mode. Any user with a stale~/.codex/RTK.md+@RTK.mdline gets:Idempotent — safe to re-run when nothing legacy is present. Future renames just add filenames to
LEGACY_RTK_MD_FILES.Reviewed by Codex
LEGACY_RTK_MD_FILES)Regression insurance
The next person who tries to revert this gets a failing test pointing at the issue. The "never do it again" requirement is enforced by the test suite, not just by reviewer attention.
Cosmetic follow-up
#20 tracks the remaining ~30 hardcoded
RTK.md/@RTK.mdliterals in print strings and doc comments (non-functional, just misleading labels). Kept out of this PR so the regression fix stays reviewable.Test plan
cargo test --bin contextcrawler— 2026 passed, 0 failed (+8 new across both commits)Closes #19