Skip to content

refa: remove permission service wrappers - #21856

Merged
wangq8 merged 4 commits into
infiniflow:mainfrom
buua436:go145
Nov 2, 2026
Merged

wangq8 merged 4 commits into
infiniflow:mainfrom
buua436:go145

Conversation

@buua436

@buua436 buua436 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Remove service-layer permission wrappers that only forwarded calls, and invoke the permission layer directly at call sites. Keep composite authorization rules with their owning business flows.

Type of change

  • Refactor (no functional change)

@buua436
buua436 requested a review from wangq8 November 2, 2026 07:49
@buua436 buua436 added the ci Continue Integration label Nov 2, 2026
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7a1186fa-0a5c-4797-821a-de2480995ca4
Commits

Reviewing files that changed from the base of the PR and between 76ba035 and 34ecd1d.

Files selected for processing: 1
  • internal/handler/file_commit.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

Handlers and services now use database-backed permission checker methods for resource checks, scoped queries, feature checks, ownership grants, and access resolution. The change removes service-specific permission helpers and updates permission-error normalization in several service flows.

Changes: Permission checker consolidation

Layer / File(s) Summary
Handler authorization
internal/handler/*, internal/router/router.go
Handlers use database-backed resource checks for canvas, dataset, and document access. Retrieval handler wiring and tests use a permission checker. The router comment now refers to “the permission checker.”
Canvas, agent, and bot access
internal/service/agent.go, internal/service/agent_sessions.go, internal/service/bot*.go, internal/service/canvas_permission.go
Agent and bot services use checker resource checks and scopes for canvas access. The canvas permission helper file was removed.
Chat, channel, and session access
internal/service/chat*.go, internal/service/chat_channel*.go
Chat, channel, and session services use checker resource checks and scopes. Their service-specific permission helpers were removed.
Dataset and document access
internal/service/chunk/chunk.go, internal/service/dataset*.go, internal/service/dataset/*, internal/service/document/*
Dataset, document, and chunk services use database-backed resource checks. Dataset access and operator-permission helpers were removed.
Connector and sync-task access
internal/service/connector*.go
Connector operations use resource checks and scopes for sync tasks. Connector permission helpers were removed.
MCP server access
internal/service/mcp*.go
MCP operations use database checker methods and hidden-error normalization. MCP permission helpers were removed.
Memory access and scopes
internal/service/memory*.go
Memory operations use checker checks, scopes, and resource filtering. Memory permission helpers were removed.
Skill-space access
internal/service/skill_space*.go, internal/service/skill_search.go
Skill-space and skill-search operations use checker scopes and hidden-error normalization. Skill-space permission helpers were removed.
Feature checks and ownership grants
internal/service/chat.go, internal/service/chat_channel.go, internal/service/mcp.go, internal/service/memory.go, internal/service/model_service.go, internal/service/search.go, internal/service/tenant_context.go, internal/service/operator_permission.go
Services call database checker feature and ownership methods directly. Shared feature, ownership, and operator-permission helpers were removed.

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Refactor

Suggested reviewers: ccclucky

Merge Risk: Minimal · up to 34ecd

No concrete merge-blocking risk was identified in this change.

Pre-merge checks: Passed 4 · Failed 1

Failed 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%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: removing permission service wrappers.
Description check Passed The description explains the problem, intended refactor, authorization scope, and change type. It does not use the template's exact “### Summary” heading, but the required information is present.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 36 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks each gate with care,
The canvas paths and datasets there.
One checker now can scope the view,
And hidden errors keep their cue.
Helpers hop away from sight,
While grants and checks align just right.

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

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread internal/service/connector.go Resolved
Comment thread internal/service/memory.go Resolved
@buua436 buua436 added ci Continue Integration and removed ci Continue Integration labels Nov 2, 2026
@buua436 buua436 added ci Continue Integration and removed ci Continue Integration labels Nov 2, 2026
@wangq8
wangq8 merged commit e9b1b6b into infiniflow:main Nov 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants