Skip to content

fix(knowledge): let Slack reach per-member access, and scope the v1 document delete to the caller - #7455

Closed
waleedlatif1 wants to merge 2 commits into
stagingfrom
fix/slack-members-access-field
Closed

fix(knowledge): let Slack reach per-member access, and scope the v1 document delete to the caller#7455
waleedlatif1 wants to merge 2 commits into
stagingfrom
fix/slack-members-access-field

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Five real defects the v0.8.21 release review found in the permission-aware knowledge work, plus the consolidation the review passes asked for.

  • Slack could not enter or leave per-member access. The settings Access control resolved only the providers Sim owns an OAuth client for, so it never rendered for a Slack connector — which could sync per member on the server but had no way in, and, once there, no way back out. It now resolves every Credential Group provider, and offers only options the server would go on to pick.
  • The v1 document delete was unscoped at the write. It looked the document up under the caller's access and then deleted by id, so access withdrawn in between still deleted. The orchestration now takes that access and deletes through the re-checking path every other surface already uses. The parameter is required rather than optional, so a future caller has to answer the question rather than silently skip it.
  • Editing a queued Build message with a live search stranded the edit. Restoring the mode left the query in the URL, which pulled the composer straight back to Search — the one mode the edit cannot be sent from. Restoring now clears the query, the same way switching modes and answering from a result already do.
  • The workspace-level member-connector list concealed refusals as "Knowledge base not found", although the request names a workspace and no knowledge base. It gets its own unconcealed policy, beside the bulk routes that carve out the same case.
  • Enrollment failures surfaced as 500s. A missing, disabled, or account-less Credential Group reached the connector enroll route as an internal error instead of the 404/409 the sibling use case returns.

The status mapping behind that last one existed in four near-identical copies and this would have been a fifth, so it now lives once beside the error class that defines the statuses. Likewise, the option-selection rule was written twice — the client copy drifting from the server's is precisely the first bug above — so both sides now share one predicate.

Reviewed and deliberately not changed

Three further comments on the release PR are not defects. The Build composer keeping search text is the person's own draft, and discarding it would fight the draft-persistence the composer is built around. The chat sanitizer's no-backtick constraint is load-bearing — it is what separates a real tag from prose quoting the tag name — and needs a backtick inside a source title to bite. The Ask-mode comment already documents the integration exception it was said to omit.

Type of Change

  • Bug fix

Testing

  • The connector Access resolver is now covered by a registry-driven test: every connector that crawls per member must resolve to a Credential Group provider, so the class of gap that hid Slack cannot return silently. Slack and a non-collectable connector are pinned explicitly.
  • The document-delete test pins the access-scoped call and its arguments, and adds a case asserting that a document the caller may no longer read reports as missing and audits nothing.
  • Type-check, lint, check:audits (45 audits), and 9,113 tests across the credential-group, knowledge, API, workspace, and hooks suites pass.
  • /cleanup (effects, state, memo, callback, React Query, url-state, emcn, comments) and /simplify (reuse, simplification, efficiency, altitude) were run over the diff; every finding is either applied here or recorded above with the reason it was not.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 3, 2026 9:21pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes permission-aware knowledge and composer-state regressions while consolidating shared credential-group logic.

  • Enables per-member access controls for Slack and filters options using the server’s selection predicate.
  • Rechecks caller access at the v1 document-delete write.
  • Restores queued edits outside Search mode and clears the live search state.
  • Corrects workspace connector and enrollment error projection.
  • Consolidates credential-group provider lookup and enrollment-error mapping.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/lib/knowledge/orchestration/documents.ts Requires caller access for document deletion and delegates to the knowledge-base-scoped, access-checking delete path.
apps/sim/app/api/v1/knowledge/[id]/documents/[documentId]/route.ts Resolves one caller access scope and passes it through both document lookup and deletion.
apps/sim/lib/credential-groups/providers.ts Adds shared provider lookup and selectable-option predicates used consistently by client and server paths.
apps/sim/lib/knowledge/connectors/member-provisioning.ts Uses shared credential-group selection and enrollment-error projection while preserving existing readiness requirements.
apps/sim/app/workspace/[workspaceId]/home/home.tsx Clears live search state when restoring a queued message to its original sendable composer mode.
apps/sim/lib/credential-groups/enrollments.ts Centralizes enrollment status conversion into orchestration errors for consistent API responses.

Reviews (2): Last reviewed commit: "fix(credential-groups): map every enroll..." | Re-trigger Greptile

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 14 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/credential-groups/application/send-invite.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 14 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@waleedlatif1
waleedlatif1 deleted the fix/slack-members-access-field branch September 4, 2026 00:20
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