Skip to content

Document workspace file visibility constraints#1071

Merged
j178 merged 3 commits intomasterfrom
copilot/fix-sensing-files-workspaces
Nov 14, 2025
Merged

Document workspace file visibility constraints#1071
j178 merged 3 commits intomasterfrom
copilot/fix-sensing-files-workspaces

Conversation

Copy link
Contributor

Copilot AI commented Nov 14, 2025

Users expect hooks in nested workspace projects to access files from sibling directories, but workspace mode enforces strict isolation—each project only sees files within its own directory tree.

Changes

  • Add "File Visibility Constraints" subsection under "File Collection" in docs/workspace.md
  • Clarify that hooks in frontend/.pre-commit-config.yaml cannot match files in backend/
  • Document the solution: place cross-project hooks in a common ancestor directory

Example

Won't work:

# frontend/.pre-commit-config.yaml
- id: watch-backend
  files: .*backend/src/.*  # Cannot see ../backend/

Solution:

# .pre-commit-config.yaml (workspace root)
- id: watch-backend
  files: backend/src/.*  # ✓ Root sees all projects
Original prompt

This section details on the original issue you should resolve

<issue_title>Sensing files in other workspaces</issue_title>
<issue_description>Let's say I have a setup like this:

repo/
├── .pre-commit-config.yaml
├── frontend/
│   ├── .pre-commit-config.yaml
│   └── package.json
└── backend/
    ├── .pre-commit-config.yaml
    └── src/some/dir/somefile.json

I have a hook owned by frontend workspace (e.g. npm run something) where it needs to run when a rile in the backend workspace changes. Is this possible? I feel like it should be, but can't tell if this is a workspace limitation or if I'm just not properly constructing the files regex.

example frontend/.pre-commit-config.yaml

          - id: do-something
            name: do-something
            entry: npm run something
            language: system
            types: [file]
            files: .*backend/src/some/dir/somefile\.json$
            pass_filenames: false

FWIW, I can manually run it, I just can't seem to get it working from the config file:

# works fine
prek run do-something --files ../backend/src/some/dir/somefile.json

Prior to workspaces existing, the config was always in the root directory, so I'm wondering if relative pathing upwards would have been an overlooked use case. Any thoughts would be appreciated! </issue_description>

<agent_instructions>Add document to docs/workspace.md, mentioning that each project can only see files inside its directory. Addressing this comment: "I think that makes sense as a coherent philosophy for what each sub-project should have access to. It may have been well documented and I could have missed it but if not perhaps something worth emphasizing if not"</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@j178 Thanks for the report!

I can manually run it:

# works fine
prek run do-something --files ../backend/src/some/dir/somefile.json

I think this is a bug - the frontend project shouldn’t be able to see files from another project. This should get fixed by #1064.

This actually follows our workspace design rules: each sub-project should only see files within its own root directory. If hooks need to reference files from another project, they should be moved up to a common ancestor directory.</comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits November 14, 2025 05:26
Co-authored-by: j178 <10510431+j178@users.noreply.github.com>
Co-authored-by: j178 <10510431+j178@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix sensing files in other workspaces issue Document workspace file visibility constraints Nov 14, 2025
Copilot AI requested a review from j178 November 14, 2025 05:31
@j178 j178 added the documentation Improvements or additions to documentation label Nov 14, 2025
@j178 j178 marked this pull request as ready for review November 14, 2025 05:31
@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.82%. Comparing base (dc3d061) to head (98fc5c9).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1071   +/-   ##
=======================================
  Coverage   89.82%   89.82%           
=======================================
  Files          72       72           
  Lines       13294    13294           
=======================================
  Hits        11941    11941           
  Misses       1353     1353           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@j178 j178 merged commit 04377fe into master Nov 14, 2025
30 of 38 checks passed
@j178 j178 deleted the copilot/fix-sensing-files-workspaces branch November 14, 2025 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants