Skip to content

Gate read-only actions and clarify optional notes field - #35

Merged
panteLx merged 1 commit into
mainfrom
feat/read-only-permission-gating
Jul 30, 2026
Merged

Gate read-only actions and clarify optional notes field#35
panteLx merged 1 commit into
mainfrom
feat/read-only-permission-gating

Conversation

@panteLx

@panteLx panteLx commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Quick-add sheet hides trackers where the current user only has read access, since they can't add transactions/schedules there anyway
  • Dashboard's schedule forecast hides the "book"/"skip" buttons for read-only trackers, matching the gating already used on the schedules page
  • Transaction note field labels now say "Notizen (optional)", consistent with the schedule note-template labels
  • Minor: payee placeholder text changed from "Ohne Angabe" to "Anonym"; some incidental formatting cleanup

Test plan

  • npx tsc --noEmit passes
  • npx eslint passes on changed files
  • Manually verify: a tracker member with read permission does not see it listed in the quick-add sheet's tracker picker
  • Manually verify: a read permission user does not see book/skip buttons on the dashboard's upcoming schedules
  • Manually verify: note field labels show "(optional)" on new transaction and edit-transaction forms

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Scheduled-item actions are now available only when tracker permissions allow content creation.
    • Read-only and archived trackers are excluded from transaction and appointment selection.
    • Newly created and reordered trackers appear in the correct sorted order.
  • UI Improvements

    • Missing payee names are now displayed as “Anonym”.
    • Notes fields are clearly marked as optional.
    • Tracker and transaction updates provide more consistent list behavior.

Read-only tracker members no longer see trackers they can't add
content to in the quick-add sheet, nor booking/skip actions on the
dashboard's schedule forecast, matching the schedules page's existing
permission gating. Also labels transaction note fields as "(optional)"
for consistency with schedule note templates, and swaps the
placeholder payee text from "Ohne Angabe" to "Anonym".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The changes add permission-aware tracker selection and scheduled-item actions, preserve tracker ordering in client caches, and standardize missing-payee and optional-notes labels across transaction interfaces.

Changes

Tracker permissions and transaction presentation

Layer / File(s) Summary
Permission-aware tracker actions
components/layout/quick-add-sheet.tsx, components/dashboard/dashboard-client.tsx
Read-only trackers are excluded from quick-add selection, and scheduled-item actions require content-creation permission.
Tracker cache ordering
components/dashboard/dashboard-client.tsx
Created trackers are sorted in the cache, while optimistic reordering rebuilds entries with updated sort orders and rollback support.
Transaction labels and presentation
app/t/[slug]/page.tsx, components/transactions/*, components/dashboard/dashboard-client.tsx
Missing payees now display “Anonym”, notes labels identify optional input, and unchanged JSX is reformatted.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant QuickAddSheet
  participant DashboardClient
  User->>QuickAddSheet: Open transaction or appointment flow
  QuickAddSheet->>QuickAddSheet: Filter archived and read-only trackers
  User->>DashboardClient: View scheduled tracker items
  DashboardClient->>DashboardClient: Check active tracker permission
  DashboardClient-->>User: Show permitted scheduled-item actions
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main permission gating and notes-label changes in the pull request.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/read-only-permission-gating

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.

@panteLx

panteLx commented Jul 30, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai help

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai rate limit to show your current review rate limit status.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
  • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
  • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai emit path instructions to emit generated path-specific review instructions for this repository.
  • @coderabbitai resolve merge conflict to automatically resolve merge conflicts.
  • @coderabbitai autofix to automatically fix issues identified in unresolved review comments.
  • @coderabbitai fix-ci to automatically fix failing CI checks by creating a stacked PR with fixes.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai generate configuration to create a PR that adds the current resolved configuration as .coderabbit.yaml (or show it if already present).
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit configuration file (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@panteLx
panteLx merged commit 89f5d47 into main Jul 30, 2026
1 of 2 checks passed
@panteLx
panteLx deleted the feat/read-only-permission-gating branch July 30, 2026 10:11

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/layout/quick-add-sheet.tsx`:
- Around line 103-105: Update the active tracker selection logic near
selectableTrackers so the remembered selectedTrackerId is used only when it
matches a tracker in selectableTrackers; otherwise fall back to the existing
valid tracker selection behavior. Ensure resetForm cannot leave a read-only or
otherwise filtered-out tracker as the active submission target.
- Line 49: Make permission handling fail closed and consistent with the server
contract: in components/layout/quick-add-sheet.tsx lines 49-49, require the
permission value or explicitly represent unknown permission; at lines 103-105,
filter through canWriteTracker/canCreateTrackerContent or the equivalent
canonical predicate. In components/dashboard/dashboard-client.tsx line 290,
derive canCreateContent from that same predicate, and at line 848 keep scheduled
actions gated by the corrected boolean.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cb3cf3ab-b7c1-4172-9ae1-85b1ad2ca07f

📥 Commits

Reviewing files that changed from the base of the PR and between ed19fc0 and f1dc3fc.

📒 Files selected for processing (6)
  • app/t/[slug]/page.tsx
  • components/dashboard/dashboard-client.tsx
  • components/layout/quick-add-sheet.tsx
  • components/transactions/entity-picker.tsx
  • components/transactions/transaction-edit.tsx
  • components/transactions/transactions-client.tsx

color: string;
currency: string;
isActive: boolean;
permission?: "owner" | "admin" | "write" | "read";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep UI permission checks aligned with the server contract.

Both UI paths treat any value other than literal "read" as writable, including missing permission data. Use canWriteTracker/canCreateTrackerContent or an equivalent fail-closed allowlist.

  • components/layout/quick-add-sheet.tsx#L49-L49: make permission required if the API guarantees it, or explicitly model unknown permission.
  • components/layout/quick-add-sheet.tsx#L103-L105: filter using the canonical write-capability predicate.
  • components/dashboard/dashboard-client.tsx#L290-L290: derive canCreateContent from that same predicate.
  • components/dashboard/dashboard-client.tsx#L848-L848: keep scheduled actions behind the corrected boolean.
📍 Affects 2 files
  • components/layout/quick-add-sheet.tsx#L49-L49 (this comment)
  • components/layout/quick-add-sheet.tsx#L103-L105
  • components/dashboard/dashboard-client.tsx#L290-L290
  • components/dashboard/dashboard-client.tsx#L848-L848
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/layout/quick-add-sheet.tsx` at line 49, Make permission handling
fail closed and consistent with the server contract: in
components/layout/quick-add-sheet.tsx lines 49-49, require the permission value
or explicitly represent unknown permission; at lines 103-105, filter through
canWriteTracker/canCreateTrackerContent or the equivalent canonical predicate.
In components/dashboard/dashboard-client.tsx line 290, derive canCreateContent
from that same predicate, and at line 848 keep scheduled actions gated by the
corrected boolean.

Comment on lines +103 to +105
const selectableTrackers = trackers.filter(
(t) => t.isActive && t.permission !== "read",
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Revalidate the remembered tracker selection after filtering.

activeTrackerId still prefers selectedTrackerId, and resetForm does not clear it. If the selected tracker becomes read-only, it remains active even though it is no longer in selectableTrackers, allowing the form to submit for a tracker the sheet excludes. Derive the selected ID only when it remains selectable.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/layout/quick-add-sheet.tsx` around lines 103 - 105, Update the
active tracker selection logic near selectableTrackers so the remembered
selectedTrackerId is used only when it matches a tracker in selectableTrackers;
otherwise fall back to the existing valid tracker selection behavior. Ensure
resetForm cannot leave a read-only or otherwise filtered-out tracker as the
active submission target.

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.

1 participant