Skip to content

fix(content): pass tenant context to reindex existence check#820

Merged
qin-ctx merged 1 commit intovolcengine:mainfrom
RobertIndie:fix-reindex-ctx
Mar 20, 2026
Merged

fix(content): pass tenant context to reindex existence check#820
qin-ctx merged 1 commit intovolcengine:mainfrom
RobertIndie:fix-reindex-ctx

Conversation

@RobertIndie
Copy link
Copy Markdown
Contributor

@RobertIndie RobertIndie commented Mar 20, 2026

Description

Fix an issue where /api/v1/content/reindex incorrectly returned NOT_FOUND for non-default accounts.

Previously, the URI existence check inside reindex did not use the request's tenant context, causing it to fall back to the default account. As a result, resources created under other accounts could not be reindexed.

This PR ensures the existence check is executed within the correct tenant context.

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Pass request ctx into viking_fs.exists(...) in reindex to ensure tenant-scoped validation
  • Add a regression test to verify existence checks are performed with the caller's tenant context
  • Keep the change minimal and limited to the validation path

Testing

  • Reproduced the issue:

    • Works correctly under the default account
    • Returns NOT_FOUND under non-default accounts before the fix
  • Verified the fix:

    • Reindex works correctly under both default and non-default accounts
  • Added unit test to assert exists() is called with the correct ctx

  • I have added tests that prove my fix is effective or that my feature works

  • New and existing unit tests pass locally with my changes

  • I have tested this on the following platforms:

    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

N/A

Additional Notes

This bug only affects multi-tenant scenarios. Single-tenant (default account) usage remains unaffected, which made the issue less obvious without explicit cross-account testing.

@github-actions
Copy link
Copy Markdown

Failed to generate code suggestions for PR

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 20, 2026

CLA assistant check
All committers have signed the CLA.

@qin-ctx qin-ctx merged commit 3a49c1a into volcengine:main Mar 20, 2026
1 of 2 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Mar 20, 2026
zeattacker pushed a commit to zeattacker/OpenViking that referenced this pull request Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants