Commit 1a1487d
fix(search): gate every Sim Search surface on the flag that already refuses it (#7523)
* fix(search): gate every Sim Search surface on the flag that already refuses it
Sim Search shipped behind `knowledge-member-access`, and in production that
flag is off: the AppConfig feature-flags document has no entry for it, so the
server refuses every per-member connect and hides every member-scoped
document. The UI never asked. The Search tab, the Search page and its whole
connector catalog, the composer's Search and Assistant modes, and the source
chips all rendered unconditionally, so an unreleased feature was visible to
everyone — and the connect it offered failed with a message that reads like a
plan limit rather than a feature that has not shipped.
The flag was only ever wired to the actions and the data, never to the
surfaces. Wire the surfaces to the same judgement:
- one reader, `useMemberAccessAvailable`, replacing five copies of
`features?.knowledgeMemberAccess === true`, so no surface can drift
- the Search tab appears only where the page it links to is served
- the Search page authenticates and 404s where the feature is off, so the
route cannot be typed, linked, or bookmarked into
- `useMothershipMode` is the single choke point for the composer: Search and
Assistant read as Build and refuse to be written where the feature is off,
so a stale `?mode=search` link cannot strand a composer whose switcher is
not rendered to leave it; the switcher itself is hidden through the
`canSearch` prop the composer already had
The search page's module-graph baseline is re-recorded for the session read
its gate now performs, matching `settings/[section]/page.tsx`. The modules are
already in the route's server bundle through the workspace layout, which reads
the same session.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014JmUGTitFeoQXVf9T3skEa
* fix(search): stop asking the model to cite where the chat cannot render one
The `<source>` citation contract shipped with Sim Search in #7385: the tag, the
inline chip, and the sources strip under a reply all arrived together. The tool
that asks for it did not arrive gated. `manage_knowledge_base`'s query result
appends the citation instruction unconditionally, and that tool runs in ordinary
Build turns — so in a workspace without per-member access the model is still told
to emit `<source>` tags and the chat still renders the chips and the sources
popover. An unreleased surface, reachable today without touching Search at all.
Ask for the citation only where per-member access is on. The gate belongs at the
emission rather than at the renderer: a client that merely declined to render the
tag would leave the raw `<source>{...}</source>` JSON sitting in the visible
reply. Resolved alongside the search it accompanies, so the gate costs no round
trip.
Also from the review round:
- `handleSubmit` re-applies the gate where the mode is consumed. `modeOverride`
is passed straight in and never passes through `useMothershipMode`, so the
hook alone was not the choke point the last commit claimed.
- the `?q=` effect returns early instead of calling a setter the hook would
drop, so the gate reads at the call site rather than at a distance.
- `setMode` keeps returning its promise, so the `void` at its three call sites
still means what it says.
- comments: restore the subject the shortened one-liners had lost, drop a
duplicated why, and stop the client hook from re-listing the server
predicate's ingredients.
- drop three hook tests the switcher's own tests already cover through the same
adapter, and the container one of them leaked.
Kept deliberately, against a reviewer's suggestion to delete them as now
unreachable: the `memberAccessAvailable` guards on the member-connector queries.
`useWorkspaceMemberConnectors` sets `placeholderData: keepPreviousData`, so a
disabled observer can still surface previously cached rows — the render-time
coercion to `EMPTY_MEMBER_CONNECTORS` is what stops rows from a flag-on render
leaking into a flag-off one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014JmUGTitFeoQXVf9T3skEa
* fix(search): never fail a knowledge query over a citation decision
Whether to ask for a citation is answered by a billing-backed availability
lookup, and it sat in the same `Promise.all` as the search itself — so a
rejection there discarded a search that had already succeeded and returned
"Failed to query knowledge base". A presentation choice could take out the
query it decorates.
Settle it to "do not cite" instead — the same answer the feature being off
gives — and log why, so the lookup failing is visible without being fatal.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014JmUGTitFeoQXVf9T3skEa
---------
Co-authored-by: Waleed Latif <waleed@simstudio.ai>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent a5badf0 commit 1a1487d
18 files changed
Lines changed: 366 additions & 59 deletions
File tree
- apps/sim
- app/workspace/[workspaceId]
- components/integration-tabs-header
- home
- components
- knowledge-search-results
- search-sources
- user-input
- components/mode-switcher
- hooks
- knowledge/[id]/components
- add-connector-modal
- edit-connector-modal
- search
- hooks
- lib/copilot/tools/server/knowledge
- scripts
Lines changed: 64 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
Lines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
20 | 28 | | |
21 | 29 | | |
22 | 30 | | |
| |||
25 | 33 | | |
26 | 34 | | |
27 | 35 | | |
| 36 | + | |
| 37 | + | |
28 | 38 | | |
29 | 39 | | |
30 | 40 | | |
| |||
33 | 43 | | |
34 | 44 | | |
35 | 45 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
39 | 51 | | |
40 | 52 | | |
41 | 53 | | |
| |||
Lines changed: 4 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
189 | 188 | | |
190 | | - | |
191 | | - | |
192 | | - | |
| 189 | + | |
| 190 | + | |
193 | 191 | | |
194 | | - | |
| 192 | + | |
195 | 193 | | |
196 | 194 | | |
197 | 195 | | |
| |||
Lines changed: 3 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
| 143 | + | |
| 144 | + | |
149 | 145 | | |
150 | 146 | | |
151 | 147 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
20 | 25 | | |
21 | 26 | | |
22 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
184 | 185 | | |
185 | 186 | | |
186 | 187 | | |
| 188 | + | |
187 | 189 | | |
188 | 190 | | |
189 | 191 | | |
190 | 192 | | |
191 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
192 | 196 | | |
193 | 197 | | |
| 198 | + | |
194 | 199 | | |
195 | | - | |
| 200 | + | |
196 | 201 | | |
197 | 202 | | |
198 | 203 | | |
| |||
490 | 495 | | |
491 | 496 | | |
492 | 497 | | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
493 | 502 | | |
494 | | - | |
| 503 | + | |
| 504 | + | |
495 | 505 | | |
496 | 506 | | |
497 | 507 | | |
| |||
534 | 544 | | |
535 | 545 | | |
536 | 546 | | |
| 547 | + | |
537 | 548 | | |
538 | 549 | | |
539 | 550 | | |
| |||
803 | 814 | | |
804 | 815 | | |
805 | 816 | | |
806 | | - | |
| 817 | + | |
807 | 818 | | |
808 | 819 | | |
809 | 820 | | |
| |||
835 | 846 | | |
836 | 847 | | |
837 | 848 | | |
838 | | - | |
| 849 | + | |
839 | 850 | | |
840 | 851 | | |
841 | 852 | | |
| |||
Lines changed: 113 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
0 commit comments