Skip to content

fix(mountsync): preserve scoped write path case#232

Merged
khaliqgant merged 1 commit into
mainfrom
codex/canwrite-path-case
Jun 1, 2026
Merged

fix(mountsync): preserve scoped write path case#232
khaliqgant merged 1 commit into
mainfrom
codex/canwrite-path-case

Conversation

@khaliqgant

Copy link
Copy Markdown
Member

Summary

  • preserve the case of the path segment in scopeGrantsWrite
  • keep plane:resource:action matching case-insensitive
  • add a regression for uppercase file and CamelCase directory write scopes

Fixes #231.

Context

The Tier-2 production scoped-writeback harness exposed that mountsync lowercased the full write scope before comparing its path segment to the case-preserved remote path. Narrow write scopes over real repo paths such as README.md, LAYOUT.md, or CamelCase directories could therefore deny the member's own in-scope writeback.

ClaudeGateB also audited the Cloud TS read-side matcher: it already preserves scope path case and only lowercases non-path scope metadata. This change restores Go write-side parity with the already-correct read-side semantics.

Verification

  • RED anchor: go test ./internal/mountsync -run TestScopeGrantsWritePreservesPathCase -count=1 failed on origin/main before this fix
  • go test ./internal/mountsync -run 'TestScopeGrantsWritePreservesPathCase|TestCanWritePathWithRelayauthScopes|TestCanWritePathWithShortScopes' -count=1
  • go test ./internal/mountsync -run 'TestScopeGrantsWritePreservesPathCase' -count=1
  • go test ./internal/mountsync -count=1

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 87739075-83d6-4e8e-91f8-50e19291f76a

📥 Commits

Reviewing files that changed from the base of the PR and between dbbd973 and 544b8b9.

📒 Files selected for processing (2)
  • internal/mountsync/syncer.go
  • internal/mountsync/syncer_test.go

📝 Walkthrough

Walkthrough

scopeGrantsWrite is enhanced to normalize scope input by trimming whitespace and applying case-insensitive matching to scope segments. Short-form scopes and long-form plane/resource/action components are now matched case-insensitively while preserving path case, with a new test validating this behavior.

Changes

Scope Normalization and Case-Insensitive Matching

Layer / File(s) Summary
Scope input normalization and case-insensitive segment matching
internal/mountsync/syncer.go, internal/mountsync/syncer_test.go
Short-form scope comparisons (fs:write, fs:manage) now use EqualFold for case-insensitive matching after trimming input. Long-form scopes trim and lowercase the plane, res, and act segments before validation. New test TestScopeGrantsWritePreservesPathCase validates that path case is preserved while plane/resource/action components are treated case-insensitively.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

  • AgentWorkforce/relayfile#227: Adds tier-1 scoped syncer tests validating relayfile:fs:write/* grant parsing and write-scope filtering, which exercises the same scope-evaluation logic now enhanced with case/whitespace normalization.

Poem

🐰 Whitespace trims and cases fold,
Short-form scopes now warm and bold,
Plane and resource, action too,
Normalized to match on cue,
Paths keep their case pristine and true!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: preserving path case in scoped write matching, which is the core fix addressed in the PR.
Description check ✅ Passed The description clearly explains the changes, context, and verification steps related to the case-preservation fix in scopeGrantsWrite.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/canwrite-path-case

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request modifies scopeGrantsWrite in internal/mountsync/syncer.go to preserve the case of the path segment in scopes, making path authorization case-sensitive while keeping the plane, resource, and action segments case-insensitive. It also adds corresponding unit tests in internal/mountsync/syncer_test.go to verify this behavior. There are no review comments, so I have no feedback to provide.

@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown

Relayfile Eval Review

Run: .relayfile/evals/runs/2026-06-01T07-22-05-061Z-HEAD-provider
Mode: provider
Git SHA: 176df1d

Passed: 4 | Needs human: 0 | Reviewable: 0 | Missing output: 0 | Failed: 0 | Skipped: 0

Human Review Cases

No reviewable human-review cases captured Relayfile output.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 2 files

Re-trigger cubic

@khaliqgant khaliqgant merged commit 7497f16 into main Jun 1, 2026
9 checks passed
@khaliqgant khaliqgant deleted the codex/canwrite-path-case branch June 1, 2026 07:32
@agent-relay-code

Copy link
Copy Markdown
Contributor

Reviewed PR #232 and made one scoped fix: internal/mountsync/syncer_test.go now delegates canWritePathForScope to the production scopeGrantsWrite matcher, preventing parser drift around SplitN, fs:manage, and case-insensitive scope segments.

I checked the local bot-review artifacts; they were stale or already resolved and included files outside this PR’s actual surface. I did not run Go tests because go/gofmt are not installed in this environment.

@agent-relay-code

Copy link
Copy Markdown
Contributor

pr-reviewer applied fixes — committed and pushed 009cfb6 to this PR. The notes below describe what changed.

Reviewed PR #232 and made one scoped fix: internal/mountsync/syncer_test.go now delegates canWritePathForScope to the production scopeGrantsWrite matcher, preventing parser drift around SplitN, fs:manage, and case-insensitive scope segments.

I checked the local bot-review artifacts; they were stale or already resolved and included files outside this PR’s actual surface. I did not run Go tests because go/gofmt are not installed in this environment.

@agent-relay-code agent-relay-code Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pr-reviewer applied fixes — committed and pushed 009cfb6 to this PR. The notes below describe what changed.

Reviewed PR #232 and made one scoped fix: internal/mountsync/syncer_test.go now delegates canWritePathForScope to the production scopeGrantsWrite matcher, preventing parser drift around SplitN, fs:manage, and case-insensitive scope segments.

I checked the local bot-review artifacts; they were stale or already resolved and included files outside this PR’s actual surface. I did not run Go tests because go/gofmt are not installed in this environment.

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.

mountsync scoped write paths fail when path segment contains uppercase

1 participant