Skip to content

Commit 3e8141c

Browse files
Merge origin/staging: align table v2 surface with the v2 endpoint standard
Conflict resolution + reconciliation of the two v2 table surfaces: - contracts/v2/tables unified into one module (staging's tables/index.ts folded into tables.ts): adds the POST /query contract, drops `position` from the public row shape, restricts v2 bulk filters to the typed predicate grammar, and slims the rows GET to a plain cursor page - table v2 routes (list + query from staging) rewritten to the v2 envelope standard (v2Data/v2CursorList/v2Error, resolveWorkspaceAccess, contract-bound parseRequest); tables-v2-api rollout gate extended across the whole v2 tables surface, rendered in the v2 envelope - toApiRow now uses namedRowMapper so select cells surface option names - Cache-Control: private, no-store baked into all v2 response helpers - v1 audit-logs auth: staging's org-scoped lookup + self-hosted billing-off path merged into the resolve/render split - v2 knowledge/workflows routes updated to staging's evolved service signatures (billing attribution, deleteRowsByIds, deploy/rollback) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CiHhAk2R1NryaS3R8n2yFz
2 parents 98c8567 + 32293f4 commit 3e8141c

6,452 files changed

Lines changed: 1048885 additions & 97096 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
name: add-block-preview
3+
description: Gate a block's visibility — ship an unreleased block as a preview (hidden until revealed via AppConfig/env), reveal it to admins/orgs, GA it, or kill-switch a shipped block
4+
argument-hint: <block-type>
5+
---
6+
7+
# Add Block Preview Skill
8+
9+
You manage **block visibility gating** in Sim — hiding blocks from every discovery surface (toolbar, cmd+K search, copilot @-mentions, agent tool picker, mothership VFS/metadata/tools, Access Control list, public docs/catalog) while **never** gating execution of already-placed instances.
10+
11+
## The model
12+
13+
Three levers, evaluated in `apps/sim/lib/core/config/block-visibility.ts` and folded into the registry accessors (`apps/sim/blocks/registry.ts`):
14+
15+
1. **`preview: true`** on the `BlockConfig` (static, in code) — the block is default-hidden EVERYWHERE (hosted, self-hosted, dev, SSR) until revealed. Fail-closed.
16+
2. **The hosted `block-visibility` AppConfig document** — per-block rule keyed by the existing block type:
17+
18+
```jsonc
19+
{
20+
"<block-type>": {
21+
"enabled": false, // required. true = GA (visible to everyone)
22+
"orgIds": ["org_..."], // optional allowlist clauses (any match reveals)
23+
"userIds": ["user_..."],
24+
"adminEnabled": true // platform admins (user.role === 'admin')
25+
}
26+
}
27+
```
28+
29+
3. **`PREVIEW_BLOCKS` env** (comma-separated block types) — the off-AppConfig reveal path for self-hosters and local dev.
30+
31+
A revealed block that is not globally GA (`enabled !== true`, or env-revealed) renders with a **" (Preview)"** name suffix on discovery surfaces. `getBlock()` stays pure, so placed instances keep their canonical name and always execute.
32+
33+
## Lifecycle of a preview block
34+
35+
1. **Author** the block normally (`/add-block` etc.) and set `preview: true` on its `BlockConfig`. **Ship no `BlockMeta` and no docs until GA**`check-block-registry` deliberately skips preview blocks in meta coverage, and `generate-docs` skips them at every gate.
36+
2. **Local dev:** set `PREVIEW_BLOCKS=<block-type>` in your env to see it (with the suffix).
37+
3. **Merge/deploy.** The block's code is live everywhere but visible nowhere — no AppConfig rule exists and self-hosters have no env entry.
38+
4. **Hosted preview:** add a rule to the `block-visibility` AppConfig document and start a deployment (no code deploy):
39+
- Admins only: `{ "enabled": false, "adminEnabled": true }`
40+
- Design-partner org: `{ "enabled": false, "orgIds": ["org_123"] }`
41+
- GA via config (code cleanup pending): `{ "enabled": true }` — suffix disappears everywhere within ~30s (AppConfig TTL) + client refetch.
42+
43+
Same runbook as `feature-flags`: edit the hosted document, `aws appconfig start-deployment` with the `sim-<env>-fast` strategy (see the infra README).
44+
5. **GA cleanup:** delete `preview: true` from the block (now visible to self-hosters on their next upgrade), add its `BlockMeta` + regen docs, and drop the AppConfig entry. For a v2 upgrade, this is also when v1 gets `hideFromToolbar: true` (the superseded-version paradigm).
45+
46+
## Kill switch (shipped blocks)
47+
48+
To pull an already-GA block from discovery surfaces on hosted (incident, deprecation): add `{ "<block-type>": { "enabled": false } }` to the document. Allowlist clauses can carve out exceptions. **Execution is NOT stopped** — workflows already using the block keep running; the kill switch only prevents new placement/discovery.
49+
50+
## Invariants (do not violate)
51+
52+
- **Execution is never gated.** The executor, serializer, drop-naming, and `isBlockTypeAccessControlExempt` resolve via pure `getBlock`. Do not add visibility checks to execution paths.
53+
- **Clone-not-remove:** gated blocks stay in `getAllBlocks()` output as clones with `hideFromToolbar: true``.find`-by-type consumers rely on this. Never filter them out.
54+
- **Keys are registry block types.** Never `custom_block_*` (parse drops them — custom blocks have their own enabled/disabled lifecycle).
55+
- **The shared hidden-predicate is `isHiddenUnder`** (`apps/sim/blocks/visibility/context.ts`). Never restate the preview/disabled rule inline at a new consumer.
56+
- **Process-global caches stay ungated.** `getStaticComponentFiles` (VFS) and `getExposedIntegrationTools` build the ungated universe; per-viewer filtering happens at stamp/consumer time. Never move gating into a shared builder.
57+
- Gating is **surface hiding, not secrecy** — the full config ships in the client JS bundle. Anything truly secret cannot be a registered block.
58+
59+
## Tests
60+
61+
Evaluation semantics: `apps/sim/lib/core/config/block-visibility.test.ts`. Registry projection: `apps/sim/blocks/visibility/visibility.test.ts`. When gating behavior changes, extend those — mock `isPlatformAdmin` for the admin clause; use the local `withAppConfig` harness.

0 commit comments

Comments
 (0)