v0.9.20: project membership enforcement, db and perf improvements, re… · simstudioai/sim@d744108 · GitHub
Skip to content

Commit d744108

Browse files
authored
v0.9.20: project membership enforcement, db and perf improvements, realtime and auth hardening, CI and test fixes
2 parents 3f8d13f + d193173 commit d744108

427 files changed

Lines changed: 144677 additions & 8345 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.

‎.agents/skills/add-enrichment/SKILL.md‎

Lines changed: 6 additions & 3 deletions

‎.claude/rules/sim-testing.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ contracts, and demonstrated regressions.
3333
| Suffix | Needs | Run with | In CI |
3434
|--------|-------|----------|-------|
3535
| `*.test.ts(x)` | nothing; global mocks from `vitest.setup.ts` | `bun run --cwd <workspace> test` | `test` jobs |
36-
| `*.integration.ts` | real PostgreSQL (`TEST_DATABASE_URL`), optionally Redis (`TEST_REDIS_URL`) | `bun run --cwd <workspace> test --mode integration` | `integration` jobs, by glob (sharded per provisioning path) |
36+
| `*.integration.ts` | real PostgreSQL (`TEST_DATABASE_URL`), Redis (`TEST_REDIS_URL`; optional locally, required in CI) | `bun run --cwd <workspace> test --mode integration` | `integration` jobs, by glob (sharded per provisioning path) |
3737
| `*.live.test.ts` | provider APIs, hosted sandboxes, local runtimes, or sibling checkouts | `bun run --cwd apps/sim test --mode live <file>` | never |
3838
| `apps/desktop/e2e/*.spec.ts` | the packaged Electron app | Playwright | desktop E2E workflow |
3939
| `apps/sim/scripts/test-*-e2e.ts` | a running app over HTTP | its `package.json` script when one exists (`bun run test:scim:e2e`; `test:workflow-version-compare:e2e` adds `--no-env-file`), else `bun scripts/test-<suite>-e2e.ts` from apps/sim | `e2e` jobs (`.github/scripts/http-e2e.sh`) |
@@ -48,8 +48,8 @@ contracts, and demonstrated regressions.
4848
those checks. Isolate with a unique schema or generated IDs, and clean up in `afterAll`.
4949
- Integration files run one at a time against one shared database. A new `*.integration.ts` is
5050
picked up by CI with no workflow change, and the run writes the JSON report configured in
51-
`vitest.shared.ts`, which CI uploads. Never add a passing suite to the quarantine list in
52-
`apps/sim/vitest.config.ts`.
51+
`vitest.shared.ts`, which CI uploads. Never exclude a failing suite from the run in
52+
`apps/sim/vitest.config.ts`: fix it or delete it.
5353
- `bun run test:integration` starts disposable Postgres and Redis containers, provisions the schema,
5454
and runs both workspaces; pass filenames to narrow the `apps/sim` run.
5555

@@ -169,6 +169,7 @@ The suite's wall time is bound by the single Vite server thread that serves ever
169169
3. Mock heavy graphs a test does not need and the setup does not already mock: `@/blocks`,
170170
`@/triggers/registry`, `@/tools/generated/*`.
171171
4. No real timers: `vi.useFakeTimers()`, `flushMicrotasks()`, or `flushMacrotask()`.
172+
`check:test-patterns` (`real-wait`) fails on a new wall-clock wait in a unit test.
172173
5. Absolute imports only.
173174

174175
### Running

‎.cursor/rules/sim-testing.mdc‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ contracts, and demonstrated regressions.
3131
| Suffix | Needs | Run with | In CI |
3232
|--------|-------|----------|-------|
3333
| `*.test.ts(x)` | nothing; global mocks from `vitest.setup.ts` | `bun run --cwd <workspace> test` | `test` jobs |
34-
| `*.integration.ts` | real PostgreSQL (`TEST_DATABASE_URL`), optionally Redis (`TEST_REDIS_URL`) | `bun run --cwd <workspace> test --mode integration` | `integration` jobs, by glob (sharded per provisioning path) |
34+
| `*.integration.ts` | real PostgreSQL (`TEST_DATABASE_URL`), Redis (`TEST_REDIS_URL`; optional locally, required in CI) | `bun run --cwd <workspace> test --mode integration` | `integration` jobs, by glob (sharded per provisioning path) |
3535
| `*.live.test.ts` | provider APIs, hosted sandboxes, local runtimes, or sibling checkouts | `bun run --cwd apps/sim test --mode live <file>` | never |
3636
| `apps/desktop/e2e/*.spec.ts` | the packaged Electron app | Playwright | desktop E2E workflow |
3737
| `apps/sim/scripts/test-*-e2e.ts` | a running app over HTTP | its `package.json` script when one exists (`bun run test:scim:e2e`; `test:workflow-version-compare:e2e` adds `--no-env-file`), else `bun scripts/test-<suite>-e2e.ts` from apps/sim | `e2e` jobs (`.github/scripts/http-e2e.sh`) |
@@ -46,8 +46,8 @@ contracts, and demonstrated regressions.
4646
those checks. Isolate with a unique schema or generated IDs, and clean up in `afterAll`.
4747
- Integration files run one at a time against one shared database. A new `*.integration.ts` is
4848
picked up by CI with no workflow change, and the run writes the JSON report configured in
49-
`vitest.shared.ts`, which CI uploads. Never add a passing suite to the quarantine list in
50-
`apps/sim/vitest.config.ts`.
49+
`vitest.shared.ts`, which CI uploads. Never exclude a failing suite from the run in
50+
`apps/sim/vitest.config.ts`: fix it or delete it.
5151
- `bun run test:integration` starts disposable Postgres and Redis containers, provisions the schema,
5252
and runs both workspaces; pass filenames to narrow the `apps/sim` run.
5353

@@ -167,6 +167,7 @@ The suite's wall time is bound by the single Vite server thread that serves ever
167167
3. Mock heavy graphs a test does not need and the setup does not already mock: `@/blocks`,
168168
`@/triggers/registry`, `@/tools/generated/*`.
169169
4. No real timers: `vi.useFakeTimers()`, `flushMicrotasks()`, or `flushMacrotask()`.
170+
`check:test-patterns` (`real-wait`) fails on a new wall-clock wait in a unit test.
170171
5. Absolute imports only.
171172

172173
### Running

‎.github/scripts/ci-changes.sh‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env bash
2+
# Prints which checks a pull request's changes can affect, as `<flag>=true|false` lines for
3+
# $GITHUB_OUTPUT. A flag is `false` only when every changed file is on an allowlist whose jobs
4+
# fully cover it. A file on no allowlist sets every flag but `desktop_live` (which keeps its own
5+
# skip list) to `true`; a change under .github/, an empty diff, or any failure to work out the
6+
# diff sets all of them.
7+
#
8+
# full integration, e2e, e2e-build, e2e-mobile: any file not allowlisted below
9+
# test the Vitest shards and test-types: content, docs app, and desktop changes,
10+
# plus `full`
11+
# build the app's `next build`: content changes, plus `full`
12+
# desktop_live the live Electron suite: any file outside its own skip list
13+
#
14+
# lint always runs and is not gated.
15+
#
16+
# Usage: ci-changes.sh <base-sha>
17+
set -u
18+
19+
# Posts, author profiles, and the public assets only posts reference. The test shards read them
20+
# (lib/content/og-image.test.ts) and `next build` prerenders every post with its MDX components,
21+
# which check:library-content compiles but never renders. Components under content/ are code.
22+
content='^apps/sim/content/([^/]+/)*[^/]+\.mdx?$|^apps/sim/content/authors/[^/]+\.json$|^apps/sim/public/(authors|blog|changelog|library)/'
23+
# Its own workspace tests, its type-check and docs-manifest audit in lint, and apps/sim tests
24+
# that read its pages (tools/netsuite/netsuite.test.ts).
25+
docs='^apps/docs/'
26+
# Nothing outside the Electron app imports it; the desktop bridge and protocol packages are
27+
# consumed by apps/sim and stay unlisted.
28+
desktop='^apps/desktop/'
29+
# Agent guidance, read only by the lint job's audits.
30+
guidance='^(\.agents|\.claude|\.cursor)/|^([^/]+/)*(AGENTS|CLAUDE)\.md$|^README\.md$'
31+
# The live desktop suite drives apps/desktop against the app, so it skips more than the rest.
32+
desktop_live_skip="$guidance"'|^(apps/docs/|apps/pii/|apps/sim/content/|apps/sim/public/(authors|blog|changelog|library)/|packages/(python-sdk|ts-sdk)/)|\.mdx?$|(^|/)LICENSE$'
33+
34+
emit() {
35+
printf 'full=%s\ntest=%s\nbuild=%s\ndesktop_live=%s\n' "$1" "$2" "$3" "$4"
36+
}
37+
run_all() {
38+
emit true true true true
39+
echo "Running every check: $1" >&2
40+
exit 0
41+
}
42+
matches() { printf '%s\n' "$names" | grep -qE "$1"; }
43+
outside() { printf '%s\n' "$names" | grep -qvE "$1"; }
44+
45+
base=${1:-}
46+
[ -n "$base" ] || run_all 'no base commit'
47+
git fetch --quiet --depth=1 origin "$base" || run_all "could not fetch $base"
48+
names=$(git diff --no-renames --name-only "$base" HEAD) || run_all "could not diff against $base"
49+
[ -n "$names" ] || run_all 'no changed files listed'
50+
if matches '^\.github/'; then run_all 'a CI file changed'; fi
51+
52+
desktop_live=false
53+
if outside "$desktop_live_skip"; then desktop_live=true; fi
54+
if outside "$content|$docs|$desktop|$guidance"; then
55+
emit true true true "$desktop_live"
56+
unlisted=$(printf '%s\n' "$names" | grep -vE "$content|$docs|$desktop|$guidance" | head -n 1)
57+
echo "Running every check (desktop_live=$desktop_live): $unlisted is not on an allowlist" >&2
58+
exit 0
59+
fi
60+
61+
test=false build=false
62+
if matches "$content|$docs|$desktop"; then test=true; fi
63+
if matches "$content"; then build=true; fi
64+
emit false "$test" "$build" "$desktop_live"
65+
echo "Scoped checks: test=$test build=$build desktop_live=$desktop_live" >&2

‎.github/scripts/ci-gate.sh‎

Lines changed: 40 additions & 0 deletions

‎.github/scripts/desktop-live-changes.sh‎

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)