Skip to content

ux: target/-not-ignored trap — warning predicts 'git add -A' would commit ripr's cache but gives no recovery; post-trap advisory then repeats per entry with no cure #12432

Closed

Description

@EffortlessSteven

Governing issue or accepted claim: this filing — feel-check round 11, the target/-not-ignored onboarding trap: a first-run user without /target/ in .gitignore gets warned, but if they git add -A anyway ripr's cache is committed and every subsequent run prints a repeated refusal advisory.

Acceptance delta (one sentence): the cache-tracked-by-git condition should be recoverable in one step (the warning should carry the exact untrack command) and the resulting advisory should state the cure once per run, not repeat per cache entry.

Observed (verbatim, same session)

  1. Warning (good, before the trap): "ripr artifacts under target are not covered by git ignore rules; git add -A would commit ripr's own reports"
  2. The user runs git add -A anyway (it is the natural next command) -> ripr's cache is committed.
  3. Every subsequent run then prints, three times in one run: "ripr: repo file fact cache entry ignored (cache dir .\target\ripr\cache holds files tracked by Git...)" — repeated per entry, with no cure stated.

Expected: (a) the initial warning carries the one-line cure ("add '/target/' to .gitignore; if already added, run: git rm -r --cached target"), (b) the post-trap advisory prints once per run with the cure attached instead of repeating per entry, since it is the same condition every time.

Context: discovered on the diff-flow feel lane (Windows, fresh scratch repo); the trap is self-inflicted but the tool both predicted it and then provided no recovery path — the gap between the two is the friction.

Activity

  1. coderabbitai commented on Nov 2, 2026

    @coderabbitai
    🔗 Related PRs

    #8301 - fix(doctor): bind the untrack remedy to the selected --root (#8276 follow-up) [merged]
    #11903 - ux(check): name the .gitignore line when a first run leaves an uncovered target/ripr (#11879) [open]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. added
    status/needs-work
    on Nov 2, 2026
  3. EffortlessSteven commented on Nov 2, 2026

    @EffortlessSteven
    MemberAuthor

    Investigation (research pass, main 40cb547, 2026-11-02)

    Research only — no fix, no PR. Every anchor below was read at origin/main 40cb547 via git show/git grep; this checkout has core.bare=true, so on-disk working-tree files were not trusted. No build ran: the runtime line counts in the filing are reported (from the issue), not re-executed; everything else is observed in current source.

    Verified — including two premise corrections

    Correction 1: the warning on current main already names the exact .gitignore entry. ripr_artifact_ignore's Unignored warning (crates/ripr/src/cli/commands/doctor.rs:2943-2951) ends with "Add this line to .gitignore: {entries}", where artifact_gitignore_entries (doctor.rs:2956-2962) renders analysis::artifact_root_gitignore_entry (crates/ripr/src/analysis/diff/path.rs:685-700) — /target/ for a Cargo project, because the Cargo probe root maps target/ripr up to target (doctor.rs:2901-2921, #9006). ripr check prints it once per run, stderr-only, for human formats unless --quiet/RIPR_QUIET (crates/ripr/src/cli/commands/check.rs:1600; behavior pinned by crates/ripr/tests/check_first_run_ignore_hint.rs:82-97). That suffix landed in e4af748 (#11937, 2026-11-01, one day before this filing; PR #11903 pursued the same idea and was closed unmerged). The verbatim quote in the issue predates or truncates that suffix. Acceptance (a) therefore narrows to: the warning still names no recovery for the already-committed case.

    Correction 2: the repeated advisory is not per-entry repetition — it is per-build. Per-entry repetition was already fixed at the loop boundary by 76adf76 (#4894 for #4888): emit_corrupt_entries_warning fires once per index build (crates/ripr/src/analysis/facts/build.rs:287, with the count+first-reason aggregation at build.rs:625-632 and the "emitted once on every exit" comment at build.rs:283-286). The 3x repetition comes from build multiplicity: every cache-backed index build constructs its own RepoFileFactCache::at (build.rs:71 streaming, build.rs:181 loaded), whose per-instance OnceLock probe (crates/ripr/src/analysis/seam_cache.rs:2936-2946) classifies the base via cache_base_untrusted_reason (seam_cache.rs:2867-2883); load_file_facts then corrupt-classifies every lookup with that one reason (seam_cache.rs:2954-2961), and each build emits its own line. A single diff run performs several such builds: the dependent-scope admission query builds once per run (crates/ripr/src/analysis/language/rust/dependent_scope.rs:447-472), reach/widening builds more (dependent_scope.rs:1010,1035), and the level-scan parses newly admitted files through the same cache path (dependent_scope.rs:1245). That multiplicity is consistent with the reported three identical lines on a one-file scratch repo; the exact count is flow-dependent and was not re-executed here.

    Also verified against the filing: the advisory is not cure-less. The tracked-cache reason reads "…untrack them or point RIPR_CACHE_DIR outside the repository" (seam_cache.rs:2871-2876) — the filing's quote stops mid-parenthesis. What is missing is what acceptance (a)/(b) actually ask for: the exact bound command.

    Same-owner question (from the investigation brief): no — the two sites have different owners. The warning lives in cli/commands/doctor.rs (surfaced by check through first_check_artifact_ignore_note, doctor.rs:3060-3071); the advisory lives in analysis/facts/build.rs with the reason produced in analysis/seam_cache.rs. The untrack cure already exists, but only in doctor: ripr_artifact_tracking → untrack_artifacts_command (doctor.rs:3146-3152, doctor.rs:3186-3200), rendered in doctor's human output and JSON cache.artifact_tracking (docs/OUTPUT_SCHEMA.md:675). check never surfaces the tracking fact — ripr_artifact_tracking/untrack_artifacts_command have zero references in check.rs — so a first-run user on the check path meets the trap with the note but no command, and the advisory's cure is generic. That is exactly the filing's gap.

    Root cause

    The note and the advisory detect two halves of one trap with no shared cure: the note fires on ignore rules only (git check-ignore --no-index, doctor.rs:2964-3017) and stops mentioning anything once a rule exists, while the advisory fires on the tracked condition (crate::git::tracked_files_under, crates/ripr/src/git.rs:429-460, which answers for the containing repository and never consults ignore rules). After git add -A, both conditions can hold at once — adding /target/ to .gitignore later silences the note but not the advisory, because the files stay tracked; only untracking cures both. The advisory repeats per build (not per entry) because the once-per-instance OnceLock dedupe resets on every new RepoFileFactCache instance, and a diff run builds the index several times.

    Fix plan

    (A) Note gains the conditional untrack cure — size S. In first_check_artifact_ignore_note (doctor.rs:3060-3071), when the verdict is Unignored, consult the existing ripr_artifact_tracking probe (doctor.rs:3081+) and, when it reports Tracked, append one clause naming the exact command from untrack_artifacts_command(root, &tracked_roots) (doctor.rs:3186-3200) — i.e. git --literal-pathspecs rm --cached -r -- target for the default Cargo case. Reuse, do not re-invent: the issue's proposed git rm -r --cached target is correct in the common case but misses the three things the repo's own builder already handles — root binding (#8301: a bare form pasted from another directory untracks the wrong repository), --literal-pathspecs (glob-magic configured roots, PR #8901 review), and the -- separator. The cure must be conditional on the tracked fact: git rm --cached -r errors ("did not match any files") on a first run where nothing is committed yet, and a wrong actionable repair signal is worse than a missed advisory. Keep the relocated-cache boundary as documented (doctor.rs:3057-3059: a relocated cache dir is doctor's to report). Doctor's own output needs no change — it already renders the tracking warning with the command on the same screen, and this keeps doctor's JSON cache.artifact_ignore.warning byte-identical.

    (B) Advisory dedupes to once per run with the bound cure attached — size S–M. Restrict the dedupe to the cache_base_untrusted_reason class: there every lookup in every build carries the byte-identical reason string, so suppressing later emissions loses no information (ordinary per-entry corruption reasons can differ between builds and must keep today's per-build count+first-reason behavior). Recommended shape: a small run-scoped emission guard next to the reason producer in analysis/seam_cache.rs — a process-scoped keyed set (key: resolved cache base path) consulted by the emission sites, so each distinct base reports once: once per process for the CLI is exactly once per run. Route at minimum the file-fact emission (build.rs:287); the same reason surfaces from the seam/scoped/py/ts consumers (seam_cache.rs:2208,2231,2500,2943; analysis/language/python/fact_store.rs:401; analysis/language/typescript/fact_store.rs:291; analysis/seam_cache/scoped_inventory.rs:160; analysis/seam_cache/export.rs:161) whose eprintln sites (analysis/seam_inventory.rs:429,494,865,915,951,2033) show the identical UX on repo scans — covering them through the same helper is one wording for one condition. Attach the exact cure by extending the tracked branch of cache_base_untrusted_reason (seam_cache.rs:2871-2876) with the bound untrack command; the tracked branch only fires when the base lies inside a Git work tree (git.rs:437-439 doc, seam_cache.rs:2858-2866 doc), so the command is always applicable there. The default base reuses doctor's builder; a relocated-but-in-repo RIPR_CACHE_DIR base needs one small generalization (bind -C <worktree-root> with the repo-relative base pathspec) — the only non-trivial bit. In-file tests pin the reason with contains("tracked by Git") (seam_cache.rs:7158,7183,7220,7224,11383), so appending text breaks nothing.

    Alternatives considered and rejected: (1) aggregate emissions at the CLI boundary by threading FileFactCacheStats upward — rejected: builds fire deep inside admission/reach/parse paths (dependent_scope.rs:472,1010,1035,1245); the plumbing crosses many layers for identical UX. (2) Suppress at the cache level (return Miss after first report) — rejected: FileFactCacheStats.corrupt_ignored feeds per-build honesty surfaces; masking lookups understates them. (3) Also change doctor's Unignored warnings to carry the cure — rejected for now: doctor already shows the command via the separate tracking fact, and editing those strings drifts the doctor JSON contract (docs/OUTPUT_SCHEMA.md:675) for zero information gain. (4) Process-global suppression without a key — rejected: a long-lived LSP sidecar and multi-root workspaces would lose per-base reporting; key by base.

    Test plan (discriminating)

    • (A) red/green: extend the doctor unit tests around first_check_artifact_ignore_note (doctor.rs:5545-5553): scratch git repo with Cargo.toml, target/ripr present, one file under target/ added to the index, no ignore rule → the note must contain both the entry line (/target/) and git --literal-pathspecs rm --cached -r -- target; fails on current main (note lacks the command), passes on the fix. Controls: same setup without git add → note must not contain the untrack command (guards against unconditional append = wrong repair signal); covering .gitignore → None; tracking NotChecked (git unavailable) → note keeps the entry line without the clause.
    • (B) red/green: scratch repo with a tracked cache base and ≥2 files; drive one diff-flow build sequence in-process (admission query + main build, or two cache-backed builds over the same root) and count stderr lines matching "repo file fact cache entry ignored" → exactly 1 on the fix; current main emits one per build (≥2) — the red witness. Second-base control: two distinct bases → one line each (proves the key, not a global mute). Format tests for count+first-reason (build.rs:952,957) are untouched by design.
    • Smoke: extend crates/ripr/tests/check_first_run_ignore_hint.rs (real-binary harness, check_first_run_ignore_hint.rs:33-97): a Cargo-variant fixture (the existing one is Python, target/ripr → command binds target; the issue's trap is the Cargo target case) with the cache committed, run ripr check twice; assert the untrack clause appears and the advisory line count is 1 per run. Keep the existing stdout-unchanged and --quiet/machine-format silence pins green.

    Blast radius and rollout

    Stderr-only wording on human surfaces; stdout and machine formats unchanged by construction (note is printed stderr-only before the run, check.rs:1594-1601; the advisory is eprintln). No doctor JSON change under the recommended scope, so no golden re-bless is expected; if reviewers choose alternative (3) (doctor warnings also carry the cure), cache.artifact_ignore.warning text drifts → measure with cargo xtask goldens check and re-bless on the WSL Ubuntu pinned toolchain, never Windows, with the independent semantic justification. Test updates: check_first_run_ignore_hint.rs, doctor unit tests, and any test asserting advisory line counts. Changelog fragment per repo convention (cf. changelog.d/11879-check-first-run-gitignore-note.md from #11937). Cross-check requested by the brief: docs/CI.md:1835-1837 documents that the pilot retry lane deliberately persists target/ripr/cache between runs ("restoring that directory between runs lets the retry resume") — I found no "cache clearing post-run" mention in docs/CI.md; the convention the doc actually establishes is cache persistence, which argues for the untrack cure (files stay on disk, work stays warm) over any delete-the-cache wording.

    Sizing

    A+B together: M (about a day) — A alone S (hours); B is S for the guard plus the relocated-base command binding and wording-blast test updates. No cache schema bump (stderr strings only), no spec delta required; non-goals: not touching doctor's JSON wording, not deduping ordinary per-entry corruption reasons, not changing the relocated-cache-is-doctor's boundary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/needs-work

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions