Skip to content

fix(penpal): add All Markdown source, lazy scanning, and fix review findings - #535

Merged
loganj merged 3 commits into
mainfrom
debug-penpal-markdown-file-dis
Mar 30, 2026
Merged

fix(penpal): add All Markdown source, lazy scanning, and fix review findings#535
loganj merged 3 commits into
mainfrom
debug-penpal-markdown-file-dis

Conversation

@loganj

@loganj loganj commented Mar 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds an always-present __all_markdown__ source type so projects without recognized source markers (thoughts/, .rp1/, ANCHORS.md) now show all their .md files
  • Replaces eager full-scan at startup with a cheap HasFiles bool check + lazy scan on first project open, making startup faster for large workspaces
  • Fixes 8 review findings: dead code removal, AllFiles deduplication, projectHasAnyMarkdown/full-scan alignment, EnsureProjectScanned TOCTOU race, handleProjectInfo without lazy scan trigger, search handler .git walk, and missing test coverage

🤖 Generated with Claude Code

loganj and others added 3 commits March 29, 2026 19:56
…indings

Add an always-present __all_markdown__ source type that discovers all .md
files in any project, solving the issue where projects without recognized
source markers (thoughts/, .rp1/, ANCHORS.md) showed no files.

Key changes:
- Register __all_markdown__ as a proper SourceType with GroupFiles, always
  appended by DetectSources()
- Replace eager full-scan at startup with cheap HasFiles bool check
  (projectHasAnyMarkdown) + lazy scan on first project open
- Replace FileCount/Badges on API types with HasFiles bool
- Remove dead seedRecentActivity; seed activity per-project on first lazy scan
- Fix AllFiles() to deduplicate __all_markdown__ entries (prefer typed source)
- Align projectHasAnyMarkdown with full scan (gitignore, .hg/.svn skips)
- Fix EnsureProjectScanned TOCTOU race via write-lock gating
- Fix handleProjectInfo to use project.HasFiles instead of triggering lazy scan
- Fix search handler walking into .git dirs via __all_markdown__ source
- Skip __all_markdown__ in add-source conflict check

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-file-dis

* origin/main:
  fix(penpal): ensure repo badges are generated when repos are added (#534)
  fix(penpal): show agent selector dropdown below trigger button (#532)
  fix(penpal): filter ANCHORS.md from anchors source (#533)
  fix(penpal): show wave animation in sidebar when run phase is unknown (#531)
  fix(penpal): anchor stability improvements and code block highlights (#530)
  refactor(penpal): decompose Layout.tsx into focused components (#528)

# Conflicts:
#	apps/penpal/frontend/src/components/Layout.tsx
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@loganj
loganj marked this pull request as ready for review March 30, 2026 00:20
@loganj
loganj merged commit 8f75b23 into main Mar 30, 2026
4 checks passed
@loganj
loganj deleted the debug-penpal-markdown-file-dis branch March 30, 2026 00:20

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a03536c0b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +357 to +360
c.projectScanned[projectName] = true
c.mu.Unlock()

c.RefreshProject(projectName)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Block until initial scan completes before returning project files

EnsureProjectScanned marks a project as scanned before RefreshProject finishes, so a concurrent GET /api/project/{name} can observe projectScanned=true and then read an empty ProjectFiles slice while the first scan is still in progress. In practice this shows up when two requests hit the same unopened project at once (e.g., multiple tabs/windows): one request does the scan, the other can return an empty sidebar response even though files exist.

Useful? React with 👍 / 👎.

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