test(WriteTool.write): File permissions respect user's umask#21233
test(WriteTool.write): File permissions respect user's umask#21233HaleTom wants to merge 5 commits into
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate Found:
These two PRs are complementary—PR #21233 stabilizes the test, and PR #19077 fixes the production code. Check if both are needed or if there's overlap in scope. |
There was a problem hiding this comment.
Pull request overview
Makes the tool.write permission-related test deterministic across environments by controlling the process umask during the assertion.
Changes:
- Wraps the sensitive-file permission assertion in a
process.umask(0o022)/ restore block to avoid failures under non-default host umasks.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
9719a21 to
3fcdc4a
Compare
3fcdc4a to
90f7ec2
Compare
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
|
@rekram1-node would you please retry the failing e2e CI on this? I wonder how many other PRs are blocked similarly? |
|
@simonklee @thdxr — could one of you take a look at this PR? The e2e CI is failing and it would be great to get a review or a re-run. |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Fixes #19076
Type of change
What does this PR do?
This keeps the PR surgical and limited to
packages/opencode/test/tool/write.test.ts.It updates the write-permission tests to reflect the actual contract: the write path respects the process umask instead of forcing a fixed
0644file mode.The permission coverage now models the real base mode and masking behavior directly:
0o000confirms the unmasked base mode is0o6660o022confirms the common masked result is0o6440o027covers the corner case where the masked result is0o6400o077confirms a restrictive mask produces0o6000o777is kept as a math-only assertion so the suite documents the full masking boundary without creating an unreadable file in-processThis also avoids the competing approach in #19077, which forces
0644after write and would loosen a user's explicit umask-based security boundary.How did you verify your code works?
packages/opencode/test/tool/write.test.tsis clean under LSP diagnostics.bun installto bootstrap the worktree-local dependencies.bun test test/tool/write.test.ts→ 17 pass, 0 fail.bun typecheckinpackages/opencode→ pass.Screenshots / recordings
N/A — non-UI change.
Checklist