Skip to content

feat(web): company brain entitlement helper, hook + ?org deep-link activation#1110

Merged
graphite-app[bot] merged 1 commit into
mainfrom
company-control-0612
Jun 22, 2026
Merged

feat(web): company brain entitlement helper, hook + ?org deep-link activation#1110
graphite-app[bot] merged 1 commit into
mainfrom
company-control-0612

Conversation

@MaheshtheDev

@MaheshtheDev MaheshtheDev commented Jun 13, 2026

Copy link
Copy Markdown
Member

Add hasCompanyBrain helper + useHasCompanyBrain hook reading the company_brain add-on from org metadata to gate Company Brain UI.

Fixes ENG-806

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 13, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
supermemory-mcp 5049404 Jun 22 2026, 06:11 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 13, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
supermemory-app 5049404 Commit Preview URL

Branch Preview URL
Jun 22 2026, 06:13 PM

MaheshtheDev commented Jun 13, 2026

Copy link
Copy Markdown
Member Author

How to use the Graphite Merge Queue

Add the label Main to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@linear-code

linear-code Bot commented Jun 13, 2026

Copy link
Copy Markdown

ENG-806

@MaheshtheDev MaheshtheDev force-pushed the company-control-0612 branch from fdb69fa to 5377aa3 Compare June 13, 2026 01:20
@MaheshtheDev MaheshtheDev force-pushed the company-control-0612 branch from 5377aa3 to b5e5337 Compare June 13, 2026 16:59
@MaheshtheDev MaheshtheDev force-pushed the company-control-0612 branch from b5e5337 to 2d8845e Compare June 14, 2026 08:09
@MaheshtheDev MaheshtheDev changed the title feat(web): company brain entitlement helper and hook feat(web): company brain entitlement helper, hook + ?org deep-link activation Jun 14, 2026
@MaheshtheDev MaheshtheDev force-pushed the company-control-0612 branch 3 times, most recently from 003c758 to ecbb048 Compare June 18, 2026 00:23
@MaheshtheDev MaheshtheDev marked this pull request as ready for review June 18, 2026 04:52
@graphite-app graphite-app Bot requested a review from Dhravya June 18, 2026 04:52
@claude

claude Bot commented Jun 18, 2026

Copy link
Copy Markdown

Claude finished @MaheshtheDev's task in 1m 28s —— View job


Re-review complete

  • Load required tools
  • Get PR diff and review existing comments
  • Review changed files for bugs/security issues
  • Submit review

Summary: Re-reviewed after fixes to the two P2 issues from the previous review. Both fixes are correctly implemented — useHasCompanyBrain now respects explicit overrides before the team fallback, and useProject normalizes the selection consistently. No bugs, security issues, or logic errors found. Score: 10/10

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overview: Adds hasCompanyBrain helper and useHasCompanyBrain hook to gate Company Brain UI based on org metadata, plus a ?org=<slug> deep-link mechanism for org activation.

Issues found: None — this looks good to ship.

The implementation handles edge cases well:

  • hasCompanyBrain correctly handles both string and object metadata (better-auth returns JSON strings), with proper try/catch on JSON.parse
  • Feature overrides take precedence over activeProducts array — correct priority
  • useHasCompanyBrain also checks brainMode === "team" to cover the async webhook delay — good defensive coding
  • consumeRequestedOrgSlug properly checks for SSR (typeof window === "undefined"), strips the param with replaceState to prevent re-triggering on refresh/back-navigation
  • The cancelled flag in the auth effect correctly prevents stale state updates
  • All schema/type additions are optional, so no breaking changes

Score: 10/10

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ecbb048209

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/stores/index.ts
Comment thread apps/web/hooks/use-company-brain.ts
@MaheshtheDev MaheshtheDev force-pushed the company-control-0612 branch from ecbb048 to bd3a8f1 Compare June 18, 2026 15:25

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overview: Adds hasCompanyBrain helper and useHasCompanyBrain hook to gate Company Brain UI based on org metadata, plus a ?org=<slug> deep-link mechanism for org activation.

Issues found: None — the previous feedback has been correctly addressed.

The fixes look good:

  • useHasCompanyBrain now checks getCompanyBrainOverride first and returns it directly when set, so an explicit allow: false properly bypasses the brainMode: "team" fallback
  • useProject now returns normalizedProjects as selectedProjects, so the selector, counts, and queries all use the same default tag

Other implementation details are solid:

  • hasCompanyBrain handles both string and object metadata with proper try/catch
  • consumeRequestedOrgSlug checks for SSR and strips the param with replaceState
  • The cancelled flag correctly prevents stale state updates
  • All schema/type additions are optional — no breaking changes

Score: 10/10

@graphite-app

graphite-app Bot commented Jun 22, 2026

Copy link
Copy Markdown

Merge activity

…tivation (#1110)

Add hasCompanyBrain helper + useHasCompanyBrain hook reading the company_brain add-on from org metadata to gate Company Brain UI.

Fixes ENG-806
@graphite-app graphite-app Bot force-pushed the company-control-0612 branch from bd3a8f1 to 5049404 Compare June 22, 2026 17:54
@graphite-app graphite-app Bot merged commit 5049404 into main Jun 22, 2026
5 of 7 checks passed
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.

2 participants