Skip to content

fix(claude-memory): count newline-named topic files once in scope-report - #3631

Merged
kyle-sexton merged 1 commit into
mainfrom
cursor/fix-3444-newline-count-df93
Sep 2, 2026
Merged

fix(claude-memory): count newline-named topic files once in scope-report#3631
kyle-sexton merged 1 commit into
mainfrom
cursor/fix-3444-newline-count-df93

Conversation

@kyle-sexton

Copy link
Copy Markdown
Contributor

Closes #3444

Summary

scope-report.sh counted topic files with find | wc -l, which counts newlines in the stream, so a filename containing an embedded newline was counted twice.

Fix

Replaced the pipeline with the sibling null-delimited idiom: find -print0 plus read -r -d ''. Plugin bumped to 0.11.12.

Verification

Added a fixture whose name contains a literal newline and asserted topic files: 2. Confirmed the new assertion fails against the pre-fix script and passes after. scripts/affected-tests.sh --run selected the co-located suite; all 22 checks passed.

Related

N/A

Note: this PR and #3374 both touch scope-report.test.sh. Merge #3374 first, then rebase this one.

Open in Web Open in Cursor 

scope-report.sh piped find output through wc -l, which counts newlines
in the stream rather than files, so a topic filename with an embedded
newline was counted twice. Switch to the null-delimited idiom already
used by the sibling enumerate-all-projects.sh.

Add a fixture file with a newline in its name and assert the report
counts it once.

Co-authored-by: ksextonmelodic <ksextonmelodic@gmail.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T06:19:06.050729Z 856cbe4 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 54s —— View job


Security review complete

  • Gather context (PR diff, custom instructions)
  • Run skip-gate check
  • Review changed files for security-relevant surface
  • Post findings

No security issues found.

This PR only touches plugins/claude-memory/skills/stateless/scripts/scope-report.sh (counting logic), its test file, plugin.json (version bump), and CHANGELOG.md. The fix replaces find ... | wc -l with the null-delimited find -print0 / while IFS= read -r -d '' idiom already used elsewhere in this plugin (scope-report.sh#L114-L118).

Notes from review, none rising to a reportable finding:

  • No new user-controllable input reaches this script; mem_dir comes from the plugin's existing resolver, unchanged by this diff.
  • The null-delimited read loop is the correct fix for embedded-newline/whitespace filenames and introduces no quoting or injection issues (no eval, no unquoted expansion of filenames into a command).
  • No changes to permissions, trust boundaries, or GitHub Actions workflows.

Skip-gate condition 2 (no security-relevant surface after reading the diff) applies here.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Last security-reviewed head: 856cbe4d43af42ac4170f5f658e28f22d73bc31f. On the next push, the relevance gate compares only the commits since this SHA; delete this comment to force a full re-review.

@claude

claude Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 7s —— View job


Code review complete

  • Gather context (PR diff, changed files)
  • Understand the request (invoke /review:code-review per CI lane instructions)
  • Review changed files for correctness/maintainability
  • Post findings

Scope: plugins/claude-memory/skills/stateless/scripts/scope-report.sh, its test file, plugin.json, CHANGELOG.md.

Summary: The fix replaces find | wc -l (which counts newlines in the stream, not files) with the null-delimited find -print0 + while IFS= read -r -d '' idiom already used by the sibling script enumerate-all-projects.sh (scope-report.sh#L114-L118), so a topic filename containing an embedded newline now counts once instead of twice. This exactly mirrors the existing idiom at enumerate-all-projects.sh:56-60, keeping the two scripts consistent.

The regression test (scope-report.test.sh Case 4b) builds on the existing Case 4 fixture, adds a newline-named .md file, asserts topic files: 2, and cleans up after itself — a solid, minimal repro of the bug. plugin.json and CHANGELOG.md updates are consistent with each other and with the changelog's existing formatting conventions.

I read the full diff and the surrounding script/test files. I was not able to execute the test suite myself in this sandboxed environment (bash execution required approval that wasn't available here), so the PR's "22 checks passed" claim is author-reported and unverified by me — the logic reads correct on inspection, and matches an idiom already proven out in the sibling script.

No high-signal findings. The change is small, targeted, matches the high-signal bar's exclusions (no style nits, no pre-existing-issue scope creep), and correctly limits itself to the one broken counting path.

One non-blocking note already disclosed in the PR body: this PR and #3374 both touch scope-report.test.sh, so merge order matters as the author says.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Claude has reviewed this PR 1 time. The lane skips further automatic reviews after 5; deleting this comment resets the count.

@kyle-sexton
kyle-sexton merged commit 30e4925 into main Sep 2, 2026
64 checks passed
@kyle-sexton
kyle-sexton deleted the cursor/fix-3444-newline-count-df93 branch September 2, 2026 07:05
cursor Bot pushed a commit that referenced this pull request Sep 2, 2026
Rebased onto origin/main after #3631. Keep both the isolation cases and
the 0.11.12 newline-count fixture (now routed through iso_env). Add a new
## [0.11.13] heading above the published 0.11.12 release.

Co-authored-by: ksextonmelodic <ksextonmelodic@gmail.com>
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.

claude-memory: stateless scope-report over-counts filenames containing newlines

2 participants