Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
580 commits
Select commit Hold shift + click to select a range
009d274
docs(stack-bench): drop the code blocks for animated diagrams
bradleyshep Aug 18, 2026
893dde3
docs(stack-bench): one visual per slide
bradleyshep Aug 18, 2026
0a4542e
docs(stack-bench): make the swap and the loop actually do something
bradleyshep Aug 18, 2026
19cdb73
docs(stack-bench): state what the benchmark does
bradleyshep Aug 18, 2026
30d8520
docs(stack-bench): fix parallelism and unify terminology
bradleyshep Aug 18, 2026
c46cc94
docs(stack-bench): let the audience click through what gets broken
bradleyshep Aug 18, 2026
5194b16
feat(stack-bench): qualify comprehensive ecommerce L2
bradleyshep Aug 18, 2026
aa41a02
chore(stack-bench): qualify neutral campaign guidance
bradleyshep Aug 18, 2026
e80f11c
fix(stack-bench): preserve qualified Spacetime fixture bytes
bradleyshep Aug 18, 2026
592978a
docs(stack-bench): keep the pre-animation deck as a separate document
bradleyshep Aug 18, 2026
baa8dad
fix(stack-bench): keep campaign grading comparable
bradleyshep Aug 18, 2026
a220d5f
docs(stack-bench): correct the scores, cut the premise slide's diagra…
bradleyshep Aug 18, 2026
e09d046
docs(stack-bench): give the measurement a visual and make the loop di…
bradleyshep Aug 18, 2026
37d4ef1
docs(stack-bench): let the fixes land and the spend climb on the meas…
bradleyshep Aug 18, 2026
7c95ff7
docs(stack-bench): fix the text that ran outside its box, and rebuild…
bradleyshep Aug 18, 2026
c5a039d
docs(stack-bench): use american spellings
bradleyshep Aug 18, 2026
956c2d3
docs(stack-bench): say what the bill slide is actually claiming
bradleyshep Aug 18, 2026
e0ee728
docs(stack-bench): say that the warehouse side is part of the build
bradleyshep Aug 18, 2026
146033e
feat(stack-bench): run campaign attempts in parallel
bradleyshep Aug 18, 2026
3fc2dba
docs(stack-bench): show the race instead of listing the chores
bradleyshep Aug 18, 2026
7e1bdcf
feat(stack-bench): record campaign parallel scope
bradleyshep Aug 18, 2026
bb2b014
docs(stack-bench): drop the slide that argued the mechanism
bradleyshep Aug 18, 2026
c3160f1
docs(stack-bench): put the subject and the verb at the front of the s…
bradleyshep Aug 18, 2026
d827f9a
docs(stack-bench): name the loop slide after what the loop does
bradleyshep Aug 18, 2026
072b5c4
docs(stack-bench): show the suite and show the directory
bradleyshep Aug 18, 2026
6e81da8
docs(stack-bench): make receipts the trace, not the inventory
bradleyshep Aug 18, 2026
fb73816
docs(stack-bench): use the criterion counts the track actually declares
bradleyshep Aug 18, 2026
944bf46
docs(stack-bench): put all 21 adversarial criteria in the picker
bradleyshep Aug 18, 2026
86b6f5c
fix(stack-bench): accept declared spacetime module layouts
bradleyshep Aug 18, 2026
644072a
docs(stack-bench): make receipts the evidence pack it actually is
bradleyshep Aug 18, 2026
9af97e0
feat(stack-bench): add local operator dashboard
bradleyshep Aug 18, 2026
764b81e
fix(stack-bench): align dashboard with SpacetimeDB branding
bradleyshep Aug 18, 2026
30aab07
fix(stack-bench): gate later levels on correctness
bradleyshep Aug 18, 2026
fe34ba8
fix(stack-bench): validate modular prompt treatments
bradleyshep Aug 18, 2026
8e0fda5
fix(stack-bench): make prompt bytes platform-stable
bradleyshep Aug 18, 2026
6f190bc
fix(stack-bench): expose dashboard on Docker Desktop
bradleyshep Aug 18, 2026
a1b679b
docs(stack-bench): open a receipt when its tile is clicked
bradleyshep Aug 18, 2026
ed4bd0d
fix(stack-bench): show prepared attempts as waiting
bradleyshep Aug 18, 2026
f68bd0f
feat(stack-bench): expose campaign evidence in dashboard
bradleyshep Aug 18, 2026
de10ab8
fix(stack-bench): remove dashboard marketing hero
bradleyshep Aug 18, 2026
fa5b41e
fix(stack-bench): recover interrupted coding sessions
bradleyshep Aug 18, 2026
b8f30fe
fix(stack-bench): keep campaign history readable
bradleyshep Aug 18, 2026
a55a0eb
fix(stack-bench): repair generated app setup failures
bradleyshep Aug 18, 2026
86ef56f
chore(stack-bench): keep working notes local
bradleyshep Aug 18, 2026
36fe527
refactor(stack-bench): organize command and source modules
bradleyshep Aug 18, 2026
9bc1b99
chore(stack-bench): harden reorganized module paths
bradleyshep Aug 18, 2026
3e86fd7
refactor(stack-bench): separate commands from runtime
bradleyshep Aug 18, 2026
74e5fac
docs(stack-bench): remove internal working history
bradleyshep Aug 18, 2026
7b1cc22
fix(stack-bench): complete failed grades and recover sessions
bradleyshep Aug 18, 2026
9aa3fe9
fix(stack-bench): hide interrupted runs from active view
bradleyshep Aug 18, 2026
e8400c5
chore(stack-bench): remove obsolete probe scripts
bradleyshep Aug 18, 2026
651c3fa
docs(stack-bench): align local workflow with appliance
bradleyshep Aug 18, 2026
4e76012
refactor(stack-bench): keep validators with commands
bradleyshep Aug 18, 2026
646f5a6
fix(stack-bench): verify startup seed after reset
bradleyshep Aug 18, 2026
3c4d77e
fix(stack-bench): make L1 product checks implementation-neutral
bradleyshep Aug 18, 2026
90eda0b
fix(stack-bench): harden L1 grading evidence
bradleyshep Aug 18, 2026
3660d5c
fix(stack-bench): make grading evidence internally consistent
bradleyshep Aug 18, 2026
c119617
fix(stack-bench): require executable server evidence
bradleyshep Aug 18, 2026
d406a55
test(stack-bench): complete L1 defect coverage
bradleyshep Aug 18, 2026
17e30cf
feat(stack-bench): rebuild the dashboard around the campaign log
bradleyshep Aug 18, 2026
fb808f3
fix(stack-bench): isolate L1 qualification checks
bradleyshep Aug 18, 2026
c9da342
fix(stack-bench): tighten the dashboard's measurement columns
bradleyshep Aug 18, 2026
6bb5d8a
fix(stack-bench): close L1 qualification gaps
bradleyshep Aug 19, 2026
0862eff
fix(stack-bench): isolate final L1 mutation probes
bradleyshep Aug 19, 2026
f8edf69
fix(stack-bench): isolate Mongo qualification defects
bradleyshep Aug 19, 2026
7b5c7d7
fix(stack-bench): require reconnect state catch-up
bradleyshep Aug 19, 2026
137c7c3
fix(stack-bench): validate resumed cart catch-up
bradleyshep Aug 19, 2026
2146669
fix(stack-bench): isolate parallel Spacetime qualifiers
bradleyshep Aug 19, 2026
c5d5baa
feat(stack-bench): promote qualified ecommerce L1 2.4
bradleyshep Aug 19, 2026
ba8d380
feat(stack-bench): rebase ecommerce L2 onto L1 2.4
bradleyshep Aug 19, 2026
e273f4f
feat(stack-bench): add L2 1.5 reference fixtures
bradleyshep Aug 19, 2026
8a6c2be
test(stack-bench): cover MongoDB L2 1.5 defects
bradleyshep Aug 19, 2026
98c5603
test(stack-bench): cover PostgreSQL L2 1.5 defects
bradleyshep Aug 19, 2026
39844fa
test(stack-bench): cover SpacetimeDB L2 1.5 defects
bradleyshep Aug 19, 2026
f4da3d5
fix(stack-bench): enforce defect coverage after promotion
bradleyshep Aug 19, 2026
9c5d02a
feat(stack-bench): wire L2 1.5 qualification candidate
bradleyshep Aug 19, 2026
9c51b88
fix(stack-bench): harden qualification and cleanup
bradleyshep Aug 19, 2026
ab002e9
fix(stack-bench): retain grader crash evidence
bradleyshep Aug 19, 2026
5b79837
Clean Stack Bench release context
bradleyshep Aug 19, 2026
ab72d33
Merge branch 'master' into bradley/stackbench-test
bradleyshep Aug 19, 2026
82bd0a0
docs(stack-bench): add dependency progression presentation
bradleyshep Aug 19, 2026
b752cad
docs(stack-bench): clarify prompt and test flow
bradleyshep Aug 19, 2026
af34787
docs(stack-bench): refocus dependency mode presentation
bradleyshep Aug 19, 2026
950f1c4
docs(stack-bench): add product overview slide
bradleyshep Aug 19, 2026
9a79c53
docs(stack-bench): merge testing overview slides
bradleyshep Aug 19, 2026
84f248f
docs(stack-bench): animate dependency progression
bradleyshep Aug 19, 2026
63ebde0
docs(stack-bench): reorder repair and dependency slides
bradleyshep Aug 19, 2026
d885309
docs(stack-bench): remove redundant prompt slide
bradleyshep Aug 19, 2026
e484efb
docs(stack-bench): visualize grader validation
bradleyshep Aug 19, 2026
438a752
docs: explain Stack Bench run inputs
bradleyshep Aug 19, 2026
ee04227
docs: merge Stack Bench scoring story
bradleyshep Aug 19, 2026
52813f2
docs: use app stack terminology
bradleyshep Aug 19, 2026
4e0624f
docs: smooth testing flow animation
bradleyshep Aug 19, 2026
3f22cc0
docs: simplify testing visual
bradleyshep Aug 19, 2026
c8eb8e3
docs: standardize slide titles
bradleyshep Aug 19, 2026
de0c98d
docs: remove redundant self-test banner
bradleyshep Aug 19, 2026
87d3f24
docs: simplify run diagram copy
bradleyshep Aug 19, 2026
7c77b8e
docs: clarify repair run status
bradleyshep Aug 19, 2026
e8f10eb
docs: simplify Stack Bench deck name
bradleyshep Aug 19, 2026
ca38c31
docs: redesign run plan slide
bradleyshep Aug 19, 2026
476bf93
docs: fix repair diagram label
bradleyshep Aug 19, 2026
1b497ce
docs: clarify dependency graph states
bradleyshep Aug 19, 2026
f2c6c28
docs: add run comparison slide
bradleyshep Aug 19, 2026
859531e
docs: fix run plan spacing
bradleyshep Aug 19, 2026
d71833f
fix(stack-bench): isolate provider credentials
bradleyshep Aug 19, 2026
2d2b105
fix(stack-bench): repair Spacetime L2 mutation
bradleyshep Aug 20, 2026
480984b
fix(stack-bench): isolate parallel Mongo qualification
bradleyshep Aug 20, 2026
17b97e1
feat(stack-bench): parallelize mutation qualification
bradleyshep Aug 20, 2026
a896563
fix(stack-bench): validate parallel worker evidence
bradleyshep Aug 20, 2026
497117d
fix(stack-bench): bind reference clients to leased ports
bradleyshep Aug 20, 2026
c02e214
fix(stack-bench): correct Spacetime mutation defects
bradleyshep Aug 20, 2026
24770c9
feat(stack-bench): qualify ecommerce L2 1.5
bradleyshep Aug 20, 2026
61eeef2
fix(stack-bench): initialize dependencies without agent auth
bradleyshep Aug 20, 2026
a3e9737
fix(stack-bench): harden long campaign attempts
bradleyshep Aug 20, 2026
2b90f78
fix(stack-bench): keep model-free campaigns runnable
bradleyshep Aug 20, 2026
7dc9e0f
fix(stack-bench): wait out provider throttling in coding sessions
bradleyshep Aug 23, 2026
ebf421a
fix(stack-bench): report a missing run selection as a mismatch
bradleyshep Aug 23, 2026
661322f
feat(stack-bench): declare every callable testing operation in the task
bradleyshep Aug 23, 2026
d631758
feat(stack-bench): declare the startup data probe endpoint
bradleyshep Aug 23, 2026
e039148
feat(stack-bench): require startup seeding whenever data is missing
bradleyshep Aug 24, 2026
7cd8c5a
fix(stack-bench): harden candidate campaign recovery
bradleyshep Aug 24, 2026
5c97a72
fix(stack-bench): align reference SDK installs
bradleyshep Aug 24, 2026
a362d90
fix(stack-bench): refresh all Spacetime reference locks
bradleyshep Aug 24, 2026
3422109
test(stack-bench): include draft calibrations
bradleyshep Aug 24, 2026
3c34795
feat(stack-bench): qualify L1 independent checks
bradleyshep Aug 24, 2026
310073a
fix(stack-bench): share run slot locks across controllers
bradleyshep Aug 24, 2026
6458236
feat(stack-bench): define modular L3 checks
bradleyshep Aug 24, 2026
216e314
feat(stack-bench): dashboard reads as a control room
bradleyshep Aug 24, 2026
d759d85
feat(stack-bench): expand campaigns into per-attempt rows
bradleyshep Aug 24, 2026
5818555
feat(stack-bench): mission-control dashboard layout
bradleyshep Aug 24, 2026
8da236a
feat(stack-bench): honest history rows, side-panel detail, load bar
bradleyshep Aug 24, 2026
b4c06bb
fix(stack-bench): result column is a stat block, not a sentence
bradleyshep Aug 24, 2026
bdc2420
refactor(stack-bench): history is an index, not a scoreboard
bradleyshep Aug 24, 2026
50d5b21
fix(stack-bench): separate setup and scoring timeouts
bradleyshep Aug 24, 2026
0cc226b
fix(stack-bench): preserve reference fixture bytes
bradleyshep Aug 24, 2026
cc99b01
fix(stack-bench): normalize versioned text inputs
bradleyshep Aug 24, 2026
e5e1717
feat(stack-bench): qualify ecommerce L2 1.6
bradleyshep Aug 24, 2026
33c1f45
Harden Stack Bench grading and repair runs
bradleyshep Aug 25, 2026
a07c8b9
Harden Stack Bench campaign recovery and qualification
bradleyshep Aug 25, 2026
bd3706e
Preserve PostgreSQL schema during Stack Bench resets
bradleyshep Aug 25, 2026
15c670f
Isolate Stack Bench qualification scope by stack
bradleyshep Aug 25, 2026
ca8ab30
Preflight parallel mutation worker resources
bradleyshep Aug 25, 2026
ed8a036
Refresh scoped Stack Bench L1 evidence
bradleyshep Aug 25, 2026
252a7bb
Refresh scoped Stack Bench L2 evidence
bradleyshep Aug 25, 2026
b489934
Finish Stack Bench qualification release checks
bradleyshep Aug 25, 2026
14d534c
Add Stack Bench dependency mode explainer
bradleyshep Aug 25, 2026
41e090c
Replace dependency deck with graph viewer
bradleyshep Aug 25, 2026
5885309
Show the full ecommerce feature graph
bradleyshep Aug 25, 2026
18ceb1c
Simplify the dependency graph view
bradleyshep Aug 25, 2026
406c18a
Clarify ecommerce feature dependencies
bradleyshep Aug 25, 2026
6e5f86c
Remove ambiguous dependency connectors
bradleyshep Aug 25, 2026
769c7fd
Make dependency paths interactive
bradleyshep Aug 25, 2026
522b840
Clarify dependency graph connections
bradleyshep Aug 25, 2026
238394a
Exclude runtime logs from source provenance
bradleyshep Aug 25, 2026
af22db5
Add executable L3 candidate recipe
bradleyshep Aug 25, 2026
988f3a1
Add dependency-gated Stack Bench progression core
bradleyshep Aug 25, 2026
feec4b4
Harden dependency progression state and runner
bradleyshep Aug 25, 2026
1e5f757
Add five-level ecommerce progression model
bradleyshep Aug 25, 2026
643ee23
Refine ecommerce progression questlines
bradleyshep Aug 25, 2026
8764b77
Make campaign run mode explicit
bradleyshep Aug 25, 2026
fa7178a
Integrate dependency progression campaign inputs
bradleyshep Aug 25, 2026
26a5396
Persist dependency progression runs safely
bradleyshep Aug 25, 2026
f334698
Align progression prompt module selection
bradleyshep Aug 25, 2026
48421b8
Connect dependency mode to live execution
bradleyshep Aug 25, 2026
0bc3f0b
Validate dependency graph prompt and feature scope
bradleyshep Aug 25, 2026
aade1f6
Prove dependency campaign execution end to end
bradleyshep Aug 25, 2026
f4670f0
Resume dependency campaigns from exact saved work
bradleyshep Aug 25, 2026
e00ca9c
Add dependency campaign controls and status
bradleyshep Aug 25, 2026
7c7a461
Isolate catalog and support feature contracts
bradleyshep Aug 25, 2026
9196230
Isolate identity and staff feature contracts
bradleyshep Aug 25, 2026
7729af5
Bind all dependency features to one recipe
bradleyshep Aug 25, 2026
3e57a7e
Isolate promotion and notification contracts
bradleyshep Aug 25, 2026
d25b21f
Wire promotion and notification checks into graph
bradleyshep Aug 25, 2026
3b9cf9a
Isolate purchasing and cart contracts
bradleyshep Aug 25, 2026
2ab39a5
Isolate timed feature contracts
bradleyshep Aug 25, 2026
65b5657
Isolate review catalog and payment prompts
bradleyshep Aug 25, 2026
f2e901e
Fix dependency-owned ecommerce checks
bradleyshep Aug 25, 2026
185ceea
Isolate fulfilment and operational view contracts
bradleyshep Aug 25, 2026
9930289
Isolate warehouse administration prompt
bradleyshep Aug 25, 2026
9611be4
Harden reorder recovery and recommendation checks
bradleyshep Aug 25, 2026
69fc77f
Update dependency graph check total
bradleyshep Aug 25, 2026
21a6c2e
Isolate activity and feedback contracts
bradleyshep Aug 25, 2026
755c339
Isolate order cancellation contract
bradleyshep Aug 25, 2026
ecfdd4e
Isolate inventory and return feature contracts
bradleyshep Aug 25, 2026
0c24308
Correct dependency fulfilment ownership
bradleyshep Aug 25, 2026
9c15259
Harden advanced support feature contracts
bradleyshep Aug 25, 2026
259b009
Use whole advanced support modules
bradleyshep Aug 25, 2026
1269960
Bind catalog management to staff roles
bradleyshep Aug 25, 2026
2f02171
Isolate profile and staff role contracts
bradleyshep Aug 25, 2026
e78f69b
Isolate staff and support entry contracts
bradleyshep Aug 25, 2026
5640589
Isolate catalog and faceted search checks
bradleyshep Aug 25, 2026
4796049
Enforce minimal dependency feature modules
bradleyshep Aug 25, 2026
03a8fbe
Validate progression scenario contracts
bradleyshep Aug 25, 2026
58cbc8f
Keep grader checks within graph paths
bradleyshep Aug 25, 2026
6755b1e
Add MongoDB progression reference app
bradleyshep Aug 25, 2026
9140e44
Align MongoDB reference with current progression contracts
bradleyshep Aug 25, 2026
17d54af
Make MongoDB cart reservations atomic
bradleyshep Aug 25, 2026
b78effc
Update MongoDB reference Vite toolchain
bradleyshep Aug 25, 2026
622e196
Add PostgreSQL progression reference app
bradleyshep Aug 25, 2026
e4aedeb
Align PostgreSQL progression app with scenarios
bradleyshep Aug 25, 2026
ddc4e5b
Serialize progression timer processing
bradleyshep Aug 25, 2026
652d65d
Update progression reference build dependencies
bradleyshep Aug 25, 2026
7134b70
Remove unused progression migration tooling
bradleyshep Aug 25, 2026
0ad2edf
Make progression checks pagination-safe
bradleyshep Aug 25, 2026
bc15544
Add SpacetimeDB progression backend candidate
bradleyshep Aug 25, 2026
47f3e62
Complete SpacetimeDB progression reference app
bradleyshep Aug 25, 2026
2dca2db
Harden SpacetimeDB progression runtime paths
bradleyshep Aug 25, 2026
50d922a
Isolate progression purchase access check
bradleyshep Aug 25, 2026
0e039f1
Register progression reference candidates
bradleyshep Aug 25, 2026
98116a4
Add focused reference build selection
bradleyshep Aug 25, 2026
bf629f4
Support progression reference upgrades
bradleyshep Aug 25, 2026
2f75bfb
Audit progression reference evidence
bradleyshep Aug 25, 2026
759cb14
Add ecommerce progression reference campaign
bradleyshep Aug 25, 2026
366c3c5
Update reference campaign adapter identity
bradleyshep Aug 25, 2026
6017660
Validate dependency campaign preflight
bradleyshep Aug 25, 2026
47d9f4f
Make campaign qualification tests hermetic
bradleyshep Aug 25, 2026
2429dd7
Fix Docker clock preflight measurement
bradleyshep Aug 25, 2026
4e2cac8
Pass dependency campaign plans by file
bradleyshep Aug 25, 2026
4375dc4
Resolve dependency recipes during startup
bradleyshep Aug 25, 2026
e3b9e26
Bind dependency scope in run preflight
bradleyshep Aug 25, 2026
c7bfb81
Route sandbox probes by agent capability
bradleyshep Aug 25, 2026
e43e023
Poll for startup data after reset
bradleyshep Aug 25, 2026
9ffd83b
Bound reset readiness polling
bradleyshep Aug 25, 2026
26516dc
Add deterministic grading shard plans
bradleyshep Aug 25, 2026
37ece68
Audit completed progression reference campaigns
bradleyshep Aug 25, 2026
55e1973
Keep campaign status output compact
bradleyshep Aug 25, 2026
f68435f
Document compact campaign status
bradleyshep Aug 25, 2026
a4b27fe
Align progression catalog pagination
bradleyshep Aug 25, 2026
cbc9d36
Preserve generated dependencies across reference upgrades
bradleyshep Aug 25, 2026
74a8554
Surface campaign process failures
bradleyshep Aug 25, 2026
0ef3b91
Keep stored campaign evidence inspectable
bradleyshep Aug 25, 2026
fd6aee4
Keep reference runtime config out of source
bradleyshep Aug 25, 2026
46b8402
Audit progression reference action inputs
bradleyshep Aug 25, 2026
c89470f
Add PostgreSQL progression action inputs
bradleyshep Aug 25, 2026
3f86319
Fix Spacetime cart action metadata
bradleyshep Aug 25, 2026
0f77128
Bind MongoDB progression action inputs
bradleyshep Aug 25, 2026
8229f35
Bind progression reference action inputs
bradleyshep Aug 25, 2026
6341931
Bind direct grading writes to the run lease
bradleyshep Aug 25, 2026
5ac730c
Scale grading timeout with selected sources
bradleyshep Aug 25, 2026
4f6a63a
Isolate progression grading scenarios
bradleyshep Aug 25, 2026
1cac30c
Harden model-free dependency repair runs
bradleyshep Aug 25, 2026
fc9f46b
Fix progression grading false failures
bradleyshep Aug 26, 2026
1c5ff30
Validate scenario contracts by run mode
bradleyshep Aug 26, 2026
2321cd0
Fix PostgreSQL progression reference setup
bradleyshep Aug 26, 2026
5509ef9
Preserve Spacetime reference source identity
bradleyshep Aug 26, 2026
3cd5ecc
Fix progression L2 grading evidence
bradleyshep Aug 26, 2026
a48455b
Share feature catalog across run modes
bradleyshep Aug 26, 2026
bbdde48
Replace fixed grading reset delay
bradleyshep Aug 26, 2026
4642d8e
Bind runs to exact campaign identity
bradleyshep Aug 26, 2026
0349d2a
Separate feature catalogs from dependency policy
bradleyshep Aug 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
**/ModuleBindings/** linguist-generated=true eol=lf
/docs/llms/** linguist-generated=true
/docs/llms/*-details.json linguist-generated=false
/tools/stack-bench/** text eol=lf
/tools/stack-bench/**/*.woff2 -text -diff
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ function Root() {
DbConnection.builder()
.withUri(SPACETIMEDB_URI)
.withDatabaseName(MODULE_NAME)
// Paired with the setItem in App.tsx below — read here, saved there.
// Without the save, every reload connects anonymously and is issued a
// new Identity, so the signed-in account appears to vanish.
.withToken(localStorage.getItem('auth_token') || undefined),
[]
);
Expand All @@ -53,7 +56,8 @@ function App() {
const { isActive, identity: myIdentity, token, getConnection } = useSpacetimeDB();
const conn = getConnection() as DbConnection | null;

// Save auth token
// Save the auth token. Required: without it the withToken read in main.tsx
// always misses, and a reload gets a new Identity instead of the account.
useEffect(() => { if (token) localStorage.setItem('auth_token', token); }, [token]);

// Subscribe when connected. Prefer typed query builders over raw SQL
Expand Down
49 changes: 47 additions & 2 deletions codex-plugin/plugins/spacetimedb/skills/typescript-server/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,33 @@ Every column is a `t` builder value:

Modifiers: `.primaryKey()`, `.autoInc()`, `.unique()`, `.index('btree')`, `.default(value)`.

`.primaryKey()` and `.unique()` apply to **one column**. There is no composite
primary key and no multi-column unique constraint — a uniqueness rule spanning
two columns cannot be declared, and the database will not enforce it for you.

For a table that is naturally keyed by a pair — stock per item per warehouse,
membership per group per user — give it a surrogate key, add a multi-column
index for lookups, and enforce the pair's uniqueness in the reducer that
inserts:

```typescript
export const stock = table(
{ name: 'stock', indexes: [{ accessor: 'by_item_warehouse', algorithm: 'btree',
columns: ['itemId', 'warehouseId'] }] },
{
id: t.u64().primaryKey().autoInc(), // surrogate: the pair cannot be the key
itemId: t.u64(),
warehouseId: t.u64(),
quantity: t.i32(),
}
);

// The reducer is what keeps the pair unique:
const existing = [...ctx.db.stock.by_item_warehouse.filter([itemId, warehouseId])][0];
if (existing) ctx.db.stock.id.update({ ...existing, quantity: existing.quantity + n });
else ctx.db.stock.insert({ id: 0n, itemId, warehouseId, quantity: n });
```

Use `.default(value)` only for a newly appended migration-safe field. Do not put defaults on primary-key, unique, or auto-increment columns.

Optional columns: `nickname: t.option(t.string())`
Expand Down Expand Up @@ -130,7 +157,7 @@ export { default } from './schema'; // re-export the schema for the module ent

## Reducers

Reducers are created with `spacetimedb.reducer(...)`; the export name becomes the reducer name:
Reducers are created with `spacetimedb.reducer(...)`; the export name becomes the reducer name. Clients call it by that name, but the **wire name is snake_case**, so `spacetime call` and `describe` want `sign_up` for an exported `signUp`:

```typescript
export const createEntity = spacetimedb.reducer(
Expand Down Expand Up @@ -278,17 +305,35 @@ const Shape = t.enum('Shape', {
A client subscribing to a view receives only the rows it returns. Use a per-user view
(keyed on `ctx.sender`) for per-viewer access control: deleting a row it depends on
(e.g. a membership row) automatically drops the rows it was exposing from that client.
Index accessors keep a view's work proportional to the rows it returns. A view covering
several keys reads the index once per key: `for (const roomId of myRoomIds) for (const m
of ctx.db.message.roomId.filter(roomId)) out.push(m);`.

`t.row(...)` and `t.object(...)` return schema builders, not TypeScript runtime row types. Let a view callback infer its result, or annotate a separately declared structural type such as `Array<{ sku: bigint; label: string }>`. A named output type must not reuse the generated PascalCase name of its view accessor (for example, reserve `DiscountedProduct` for a `discounted_product` view).

A view context is `ViewCtx<S>` (and `AnonymousViewCtx<S>`), both exported from
`spacetimedb/server`. It carries `sender`, a read-only `db`, and `from`; it is
not a `ReducerCtx`, so a helper shared between a reducer and a view must accept
either:

```typescript
import type { ReducerCtx, ViewCtx, InferSchema } from 'spacetimedb/server';
type S = InferSchema<typeof spacetimedb>;
function stockOf(ctx: ReducerCtx<S> | ViewCtx<S>, itemId: bigint) { ... }
```

Passing a view context where a `ReducerCtx` is expected reports the mismatch as
a fully expanded structural type, not as the name `ViewCtx` — so read the
parameter, not the error.

Both `spacetimedb.view(...)` and `spacetimedb.anonymousView(...)` take three arguments: view options, the declared return schema, and the callback.

```typescript
// Anonymous view (same for all clients):
export const activeUsers = spacetimedb.anonymousView(
{ name: 'active_users', public: true },
t.array(entity.rowType),
(ctx) => [...ctx.db.entity.iter()].filter(e => e.active)
(ctx) => [...ctx.db.entity.active.filter(true)] // active: t.bool().index('btree')
);

// Per-user view (varies by ctx.sender):
Expand Down
32 changes: 20 additions & 12 deletions crates/bindings-typescript/src/lib/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,19 +248,27 @@ export type NamespacedQueryBuilder<SchemaDef extends UntypedSchemaDef> =
* A runtime reference to a table. This materializes the RowExpr for us.
* TODO: Maybe add the full SchemaDef to the type signature depending on how joins will work.
*/
export type TableRef<TableDef extends TypedTableDef> = Readonly<{
type: 'table';
sourceName: TableDef['sourceName'];
accessorName: string;
cols: RowExpr<TableDef>;
indexedCols: IndexedRowExpr<TableDef>;
tableDef: TableDef;
// Declared as an interface, not `Readonly<{ ... }>`, and that is load-bearing:
// TypeScript prints anonymous object types STRUCTURALLY and interfaces BY NAME.
// As an anonymous type, every constraint failure involving a table reference
// recited all ten members with `cols` expanding through four levels of type
// functions — 637 characters even after TypeScript's own truncation had fired.
// As an interface the same error reads
// `Type 'TableRef<...>' does not satisfy the constraint 'UntypedTableDef'`.
// See tests/table_ref_error_message.test.ts.
export interface TableRef<TableDef extends TypedTableDef> {
readonly type: 'table';
readonly sourceName: TableDef['sourceName'];
readonly accessorName: string;
readonly cols: RowExpr<TableDef>;
readonly indexedCols: IndexedRowExpr<TableDef>;
readonly tableDef: TableDef;
// Delegated UntypedTableDef properties for compatibility.
columns: TableDef['columns'];
indexes: TableDef['indexes'];
rowType: TableDef['rowType'];
constraints: any;
}>;
readonly columns: TableDef['columns'];
readonly indexes: TableDef['indexes'];
readonly rowType: TableDef['rowType'];
readonly constraints: any;
}

class TableRefImpl<TableDef extends TypedTableDef>
implements TableRef<TableDef>, From<TableDef>
Expand Down
37 changes: 30 additions & 7 deletions crates/bindings-typescript/src/sdk/connection_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ class ConnectionManagerImpl {
clearTimeout(managed.reconnectTimer);
managed.reconnectTimer = null;
managed.reconnectAttempt = 0;
if (managed.builder) {
this.#buildManagedConnection(managed, managed.builder);
}
this.#reconnectManagedConnection(managed);
continue;
}

Expand Down Expand Up @@ -179,9 +177,7 @@ class ConnectionManagerImpl {
connection.disconnect();
this.#updateState(managed, { isActive: false });
managed.reconnectAttempt = 0;
if (managed.builder) {
this.#buildManagedConnection(managed, managed.builder);
}
this.#reconnectManagedConnection(managed);
}

/** Generates a unique key for a connection based on URI and module name. */
Expand Down Expand Up @@ -294,6 +290,33 @@ class ConnectionManagerImpl {
}
}

/**
* Reconnect as the identity we were last issued.
*
* A client that first connects anonymously builds its builder *before* it has
* a token, so that builder's token stays `undefined` for the lifetime of the
* page. Rebuilding from it presents no credentials, the host mints a **new**
* identity, and every row owned by the previous one silently becomes
* invisible — no error, and no callback in between for the application to
* intervene. Saving the token diligently does not help, because the stale
* builder is what gets rebuilt.
*
* The token is already known here: the connection adopts it on
* `IdentityToken` and `#updateState` records it, one line from where it was
* needed.
*
* Only the automatic reconnect paths use this. `retain()` and `rebuild()`
* take the caller's builder verbatim, because supplying a *different* token is
* exactly what `rebuild()` is for — swapping an anonymous session for a
* signed-in one, or logging out.
*/
#reconnectManagedConnection(managed: ManagedConnection): void {
if (!managed.builder) return;
const token = managed.state?.token;
if (token) managed.builder.withToken(token);
this.#buildManagedConnection(managed, managed.builder);
}

#buildManagedConnection<T extends DbConnectionImpl<any>>(
managed: ManagedConnection,
builder: DbConnectionBuilder<T>
Expand Down Expand Up @@ -349,7 +372,7 @@ class ConnectionManagerImpl {
return;
}

this.#buildManagedConnection(managed, managed.builder);
this.#reconnectManagedConnection(managed);
}, delay);
}

Expand Down
Loading
Loading