Skip to content

Extend (fix) definition of public docs in KG Views #4950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2025

Conversation

joachim-danswer
Copy link
Contributor

@joachim-danswer joachim-danswer commented Jun 25, 2025

Description

We covered only 1/2 of the cases how a document can be public. We also need to allow docs with connector_credential_pair.access_type = "PUBLIC"

Linear: https://linear.app/danswer/issue/DAN-2140/bug-definition-of-public-docs-incomplete-in-kg-views

How Has This Been Tested?

Locally, using Github docs. Also explicitly removed email ownership (for test purposes) to make sure that the docs are allowed because of the connector_credential_pair.access_type = "PUBLIC" condition.

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

@joachim-danswer joachim-danswer requested a review from a team as a code owner June 25, 2025 23:51
Copy link

vercel bot commented Jun 25, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 25, 2025 11:51pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Extended public document access in Knowledge Graph views to include documents from connector credential pairs with access_type='PUBLIC', fixing an oversight from previous migration (3b25685ff73c).

  • Modified user_owned_and_public_docs CTE in backend/onyx/db/kg_temp_view.py to check both document-level (d.is_public) and connector-level (ccp.access_type='PUBLIC') public access
  • Verified functionality using GitHub docs and explicit email ownership removal tests
  • Change aligns with migration history that moved from is_public to access_type for access control

1 file reviewed, 1 comment
Edit PR Review Bot Settings | Greptile

@@ -61,7 +61,7 @@ def create_views(
INNER JOIN kg_used_docs kud ON kud.kg_used_doc_id = d.id
WHERE ccp.status != 'DELETING'
AND ccp.access_type != 'SYNC'
AND u.email = :user_email
AND (u.email = :user_email or ccp.access_type::text = 'PUBLIC')
Copy link
Contributor

Choose a reason for hiding this comment

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

style: consider using access_type = 'PUBLIC' instead of access_type::text = 'PUBLIC' since access_type is already a text field according to migration 61ff3651add4

Copy link
Contributor

Choose a reason for hiding this comment

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

damn impressive greptile

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Contributor

@Orbital-Web Orbital-Web left a comment

Choose a reason for hiding this comment

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

looks gud

@@ -61,7 +61,7 @@ def create_views(
INNER JOIN kg_used_docs kud ON kud.kg_used_doc_id = d.id
WHERE ccp.status != 'DELETING'
AND ccp.access_type != 'SYNC'
AND u.email = :user_email
AND (u.email = :user_email or ccp.access_type::text = 'PUBLIC')
Copy link
Contributor

Choose a reason for hiding this comment

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

damn impressive greptile

@joachim-danswer joachim-danswer added this pull request to the merge queue Jun 26, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jun 26, 2025
@Weves Weves removed this pull request from the merge queue due to a manual request Jun 26, 2025
@Weves Weves merged commit 0b2536b into main Jun 26, 2025
12 of 14 checks passed
@Weves Weves deleted the fix_public_doc_definition_in_kg_query branch June 26, 2025 03:01
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.

3 participants