Skip to content

fix: align chat permission tests across editions - #21589

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
buua436:go135
Oct 28, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
buua436:go135

Conversation

@buua436

@buua436 buua436 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Chat permission tests assumed every denied cross-tenant resource returns permission denied, while enterprise hides those resources as Resource not found. The successful chat pipeline test also lacked the active tenant context and dataset owner.

Make denial assertions accept either edition's safe response, and give the successful test an explicit tenant context and owner.

Type of change

  • Bug Fix (non-breaking change which fixes an issue)

@buua436
buua436 requested a review from wangq8 October 28, 2026 04:01
@buua436 buua436 added the ci Continue Integration label Oct 28, 2026
@coderabbitai

coderabbitai Bot commented Oct 28, 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: c910ccaa-0de3-4f4f-a34b-38bc15f97e12
Commits

Reviewing files that changed from the base of the PR and between 84bc1ca and 4c71bd6.

Files selected for processing: 3
  • internal/service/chat_pipeline_test.go
  • internal/service/chat_rest_update_test.go
  • internal/service/test_helpers_test.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

The chat service tests now accept either access-denied or hidden-resource errors for unauthorized dataset cases. The empty-response integration test assigns its knowledge base to a user and runs AsyncChat with a user- and tenant-scoped context.

Changes: Chat service test updates

Layer / File(s) Summary
Error assertion updates
internal/service/test_helpers_test.go, internal/service/chat_pipeline_test.go, internal/service/chat_rest_update_test.go
A shared helper recognizes permission-denied and resource-not-found errors. Unauthorized dataset tests use this helper instead of requiring only the permission-denied error.
Scoped empty-response test
internal/service/chat_pipeline_test.go
The test assigns the knowledge base to user-1 and runs AsyncChat with a context scoped to that user and tenant.

Priority: Low

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

Change: Bug fix

Suggested reviewers: wangq8

Merge Risk: Minimal · up to 4c71b

The test updates are contract-correct and present no actionable merge-blocking risk.

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 "fix: align chat permission tests across editions" matches the main change. The PR changes chat permission tests so denial assertions accept either the permission-denied error or the hidden-…
Description check Passed The description states the problem. Chat permission tests assume a denied cross-tenant resource returns a permission-denied error, but the enterprise edition returns a resource-not-found error. The su…
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: Title check

Explanation

The title "fix: align chat permission tests across editions" matches the main change. The PR changes chat permission tests so denial assertions accept either the permission-denied error or the hidden-resource error, and it adds tenant context and owner to the successful pipeline test. The title is specific and short, and it names the change. It does not name the tenant context or owner change, but that detail is secondary.

Full details: Description check

Explanation

The description states the problem. Chat permission tests assume a denied cross-tenant resource returns a permission-denied error, but the enterprise edition returns a resource-not-found error. The successful chat pipeline test also lacks tenant context and dataset owner. The description states the fix: denial assertions accept either safe response, and the successful test gets an explicit tenant context and owner. It includes the Bug Fix type checkbox. It does not include a separate Summary heading from the repository template, so the template structure is only partly followed. The required information is present, so the check passes.

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 5 functions across 3 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 error sign,
Two hidden paths now both align.
A scoped context guides the chat,
The test runs true beneath its hat.
Soft paws mark the updates done,
Then hop away beneath the sun.

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

@wangq8
wangq8 merged commit 61da347 into infiniflow:main Oct 28, 2026
7 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