Skip to content

Fix edge-case bugs found in the 3.1 review#2081

Merged
bbatsov merged 1 commit into
masterfrom
fix/v3.1-review-followups
Jul 8, 2026
Merged

Fix edge-case bugs found in the 3.1 review#2081
bbatsov merged 1 commit into
masterfrom
fix/v3.1-review-followups

Conversation

@bbatsov

@bbatsov bbatsov commented Jul 8, 2026

Copy link
Copy Markdown
Owner

A careful review of the recent v3.1 work (sessions, watches, async scan, reviewable replace/search, frecency, file kinds) turned up mostly solid code with a handful of real edge-case bugs. This fixes the six worth acting on, each with a regression test.

  • projectile-toggle-related-file breaks under a symlinked project root - it hand-rolled the relative path and didn't file-truename, so you'd get a spurious "No related files found". Same class as the frecency fix in 196e45c; routed through the documented projectile--project-relative-name helper.
  • Replace/Search help advertised the wrong quit key - \[quit-window] rendered as "C-x w q quit" instead of the actual q. Now \[projectile-replace--quit] in both help lines.
  • projectile-purge-file/dir-from-cache leaked watches - they mutated the cache without re-deriving the file-notify watches, so watches stayed on the purged path and a later create-event re-added the just-purged entries. Now call projectile--maybe-watch-project on the shrunken cache, like projectile-cache-project.
  • Session restore could block startup on a prompt - find-file-noselect can fire a large-file warning or an unsafe-file-locals prompt, which the surrounding ignore-errors won't suppress. Restore now visits files non-interactively.
  • A corrupt :window-state aborted the whole restore - now caught (matching the buffer-recreation guard right above it), so the recreated buffers are kept.
  • A stale async-scan chunk could bleed into a fresh scan - the scan now carries a generation token; a timer that fires after its scan was superseded/canceled no-ops instead of appending to a newer scan's match list.

Nice-to-haves, doc drifts, the version-metadata 3.1.0-vs-3.2.0 inconsistency, and the suggested test-coverage gaps (rg-vs-elisp parity, etc.) are left for follow-ups. 882 specs green, clean --warnings-as-errors, relint clean.

Six independent fixes surfaced by a careful review of the recent work,
each with a regression test:

- projectile-toggle-related-file: truename the visited file before
  spelling it relative to the (symlink-resolved) project root, so a
  project reached through a symlinked root no longer reports a spurious
  "No related files found" (same class as the frecency fix in 196e45c).
- The reviewable replace/search help lines advertised \\[quit-window]
  (rendered as "C-x w q quit") instead of the actual `q' binding; use
  \\[projectile-replace--quit].
- projectile-purge-file/dir-from-cache mutated the cache but never
  re-derived the file-notify watches, so watches leaked on the purged
  path and a later create-event re-added the just-purged entries. Call
  projectile--maybe-watch-project on the shrunken cache, like
  projectile-cache-project does.
- Session restore now visits files non-interactively (large-file
  warnings and unsafe file-local prompts suppressed), so restoring a
  session - especially on startup - never blocks Emacs on a yes-or-no-p.
- A corrupt :window-state that still passes the version check no longer
  aborts the whole session restore; the layout error is caught and the
  recreated buffers are kept.
- The async search/replace scan now carries a generation token, so a
  chunk timer that fires after its scan was superseded or canceled
  no-ops instead of appending to a newer scan's match list.
@bbatsov bbatsov merged commit 47d22c6 into master Jul 8, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant