Skip to content

[Repo Assist] test: add regression test for findFiles parent-escape bug (PR #94)#111

Draft
github-actions[bot] wants to merge 1 commit intomasterfrom
repo-assist/test-findfiles-escape-bug-2026-03-28-d3f23afac95167dc
Draft

[Repo Assist] test: add regression test for findFiles parent-escape bug (PR #94)#111
github-actions[bot] wants to merge 1 commit intomasterfrom
repo-assist/test-findfiles-escape-bug-2026-03-28-d3f23afac95167dc

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This is an automated draft PR from Repo Assist, an AI assistant.

Summary

Adds a regression test to test/unit.test.js that documents a confirmed bug in findFiles: when directory is a relative path that resolves above parent (e.g. ".."), the function escapes the workspace root boundary and can return a config file that lives above the parent directory.

The test is marked { todo: "Known bug — fixed by PR #94" } so it:

What the test shows

AssertionError: findFiles escaped parent boundary and returned
  /tmp/phpcbf-unit-xyz/relative-escape-sentinel.xml

The config file at tmpRoot/relative-escape-sentinel.xml is above tmpRoot/ws-escape (the parent/workspace root), yet the current code finds it when directory = "..".

How this differs from existing tests

Test Directory arg File exists above parent? Shows escape?
Existing: "stops at parent boundary" "." (starts at parent) Yes No — loop starts at parent, breaks immediately
PR #76: "outside parent boundary" "/tmp" (absolute, outside) No (sentinel) No — just null return
This PR: escape via relative path ".." (relative, goes up) Yes Yes — returns the file (bug!)

Test Status

Check Result
npm run test:unit ✅ Exit code 0: 7 pass, 0 fail, 1 todo
node --check test/unit.test.js ✅ No syntax errors

Relates to: PR #94 (fix: prevent findFiles from escaping parent when directory is outside workspace)

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

Add a todo-marked test that demonstrates findFiles can escape above the
parent workspace root when 'directory' is a relative path (e.g. '..') that
resolves above parent, and a matching config file exists there.

The test is marked { todo: ... } so it fails with exit code 0 on master
(documenting the known bug) and will pass once PR #94 is merged.

This complements the existing boundary test (which uses '.', not '..') and
PR #76's outside-parent test (which uses an absolute path and a file that
does not exist, rather than a relative path and a file that does).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants