Skip to content

Bradley/stackbench test - #5766

Draft
bradleyshep wants to merge 452 commits into
masterfrom
bradley/stackbench-test
Draft

bradleyshep wants to merge 452 commits into
masterfrom
bradley/stackbench-test

Conversation

@bradleyshep

Copy link
Copy Markdown
Contributor

Description of Changes

This PR adds Stack Bench, a reproducible benchmark for coding agents building applications against SpacetimeDB, PostgreSQL, and MongoDB.

Benchmark definitions and grading

  • Adds versioned tracks, levels, feature packs, specification packs, recipes, prompts, checks, and dependency declarations.
  • Supports selecting complete recipes, individual packs, or individual checks.
  • Separates what the agent is asked to build from what the finished application is evaluated against.
  • Adds typed scenario actions for browser interaction, authenticated server calls, concurrent operations, direct database writes, reconnects, reloads, and service lifecycle operations.
  • Records each check as passed, failed, inconclusive, or harness_failure.
  • Keeps the declared score denominator fixed when evidence is missing or inconclusive.
  • Adds reference, mutation, and null-control qualification:
    • reference applications for all three stacks;
    • source-bound mutation manifests;
    • exact mutation-target and collateral-failure validation;
    • blank-application controls;
    • versioned calibrations and promotion catalogs.
  • Adds immutable identities for recipes, prompts, fixtures, mutations, checks, runtime images, adapters, and evidence.

Ecommerce benchmark

  • Adds ecommerce L1 coverage for accounts, sessions, storefronts, carts, checkout, purchases, warehouses, reviews, authorization, accounting, concurrency, live updates, persistence, reconnects, and direct database writes.
  • Adds ecommerce L2 coverage for fulfilment, shipping, warehouse transfers, cancellations, returns, historical pricing, operational views, recommendations, authorization, stock conservation, and refund accounting.
  • Adds complete ecommerce reference applications for MongoDB, PostgreSQL, and SpacetimeDB.
  • Promotes qualified ecommerce L1 modular 2.4.
  • Keeps ecommerce L2 1.4 as the promoted L2 release.
  • Adds L2 1.5 as a draft cumulative successor based on L1 2.4:
    • 76 checks;
    • 117 available points;
    • static mutation coverage for all 74 scored checks on every supported stack;
    • candidate reference fixtures, mutation manifests, and calibration;
    • live qualification still required before promotion.

Runs, repairs, and campaigns

  • Adds bounded correction rounds with rollback when a repair loses previously established evidence.
  • Stops cumulative execution when a lower level remains incomplete.
  • Adds source checkpoints and operator-granted continuation rounds without rewriting the original result.
  • Adds campaign manifests containing exact stacks, repetitions, parallelism, recipes, models, pricing, prompt treatments, and correction budgets.
  • Supports concurrent attempts of the same or different stacks using isolated ports, databases, modules, containers, work directories, leases, and result directories.
  • Adds durable campaign scheduling, retries, locking, interruption recovery, reconciliation, and cleanup.
  • Preserves invalid and interrupted attempts instead of presenting them as comparison data.
  • Adds reproducible JSON and HTML reports with scores, coverage, cost, tokens, elapsed time, correction rounds, raw evidence, screenshots, videos, traces, and prompts.

CLI, dashboard, and appliance

  • Adds Stack Bench CLI commands for runs, campaigns, preflight, qualification, composition, repair continuations, recovery, release verification, and reporting.
  • Adds a Dockerized local dashboard that reads and controls the same durable campaign state as the CLI.
  • Adds a Linux/amd64 Docker appliance with pinned controller and build images, preflight checks, resource leases, reference qualification, release identity verification, and recovery tooling.
  • Adds model-free reference adapters and campaign trials for testing orchestration without provider spend.
  • Adds retained grader stdout/stderr and structured browser-initialization evidence.
  • Hardens process cleanup, destructive filesystem operations, campaign locks, recovery authority, credential redaction, and failed teardown handling.
  • Prevents local notes, generated reports, media, runtime state, and mutation scratch files from entering controller image builds.

SpacetimeDB TypeScript SDK

  • Changes exported TableRef from an anonymous readonly type alias to a readonly interface with the same members.
  • Produces shorter, named TypeScript diagnostics when a TableRef is used incorrectly.
  • Changes automatic ConnectionManager reconnects to reuse the identity token previously issued by the server.
  • Keeps explicit connection rebuilds bound to the token supplied by the caller.
  • Adds unit tests for reconnect token reuse and TableRef diagnostics.
  • Adds an opt-in live-host reconnect identity test.

SpacetimeDB CLI

  • Changes spacetime dev to retain configuration changes made during direct-login publishing.
  • Reuses that authenticated configuration for log streaming and subsequent rebuilds.

SpacetimeDB skills

  • Expands the TypeScript, Rust, and C# server skills with examples and guidance for client visibility filters, procedures, HTTP endpoints, indexes, and uniqueness constraints.
  • Updates the TypeScript client skill’s authentication and reconnect guidance.

API and ABI breaking changes

This PR changes the public Rust signature of:

spacetimedb_cli::publish::exec_from_entry

The function now accepts &mut Config instead of taking Config by value. External Rust callers must pass a mutable reference. The API-breaking label should be applied unless the previous entry point is preserved through a compatibility wrapper.

The exported TypeScript TableRef declaration changes from a type alias to an interface while retaining the same readonly member contract.

Automatic TypeScript client reconnection also changes behavior by presenting the identity token from the previous successful connection.

Expected complexity level and risk

3 / 5

Most of the implementation is isolated under tools/stack-bench. The principal risks are benchmark correctness, evidence integrity, concurrent resource isolation, interrupted-run recovery, Docker cleanup, and credential handling.

The TypeScript reconnect change and spacetimedb-cli helper signature are the only changes outside the benchmark and skill directories.

Testing

  • Stack Bench host suite: 602 tests, 599 passed, 0 failed, 3 Windows-specific skips.
  • Composition validation: 51 packs, 13 recipes, and 677 selected checks.
  • All calibration manifests compile.
  • All registered reference fixtures pass source and registry validation.
  • Scenario validation completes with 0 errors.
  • All 27 prompt snapshots match.
  • All 4 definition goldens match.
  • TypeScript reconnect and TableRef regression tests: 4/4 passed.
  • cargo check -p spacetimedb-cli.
  • Ecommerce L1 2.4 null control: 0/58.
  • Ecommerce L1 2.4 references: 58/58 on MongoDB, PostgreSQL, and SpacetimeDB.
  • Ecommerce L1 2.4 mutation qualification:
    • MongoDB: 44/44 defects caught;
    • PostgreSQL: 45/45 defects caught;
    • SpacetimeDB: 46/46 defects caught.
  • Controller build-context regression coverage.
  • Review whether to preserve the previous exec_from_entry Rust signature.
  • Run the appliance preflight and smoke test on Linux/amd64.
  • Run live Docker qualification for ecommerce L2 1.5 before promotion.
  • Run the opt-in TypeScript reconnect test against a disposable live host.

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@bradleyshep
bradleyshep force-pushed the bradley/stackbench-test branch from 6a1eb7d to dc1a416 Compare August 31, 2026 17:38
@bradleyshep
bradleyshep force-pushed the bradley/stackbench-test branch from 32d3018 to 837c1f7 Compare September 7, 2026 20:22
…sage

The Convex transport also cannot replay a captured HTTP write, so the
testability message names the replay rather than reducer calls.
A feature that did nothing or refused everything passed 3a, 306a, 630b,
631b, 109b and 2c, because each asserted only an absence, an unchanged
value, or a refusal. Each now first observes the working behavior through
interfaces the feature already discloses. Points and prompts are
unchanged; recipe hashes are repinned.
PostgreSQL wrote before refusing duplicate rows and blamed the stock row
for a missing item or warehouse; MongoDB turned ambiguity into a harness
failure, accepted undeclared camelCase fields, created a missing quantity,
and treated a not-yet-created collection as a missing interface. Each now
matches the other stacks, and dbSetStock reports ambiguity as
interface-invalid like getStock.
Reconcile records a run that finished before the controller saved it and
releases a consumed delegation that has no supervisor state; a cleanup
failure keeps its reason; recover is a no-op after completed cleanup;
artifact writes are fsynced; a continuation that inherited the pause
depth is valid, and a release from an earlier controller no longer blocks
a later cohort. Attempt effort and thinking come only from the plan, not
the controller's shell.
…light

The broker's token-only receipts cannot price server tools, MCP servers,
containers, fast speed or priority tiers, so those requests are refused.
Bench reads a key file itself, so preflight no longer also sees the file
variable and rejects OpenAI and OpenRouter key-file runs.
A resumed execution ignored its own cost completeness, so a session
killed mid-flight still reported an exact, too-low execution cost and the
next execution could receive budget that was already spent.
…stopped build container

A standalone repair grant deleted its supervisor state even when cleanup
failed, leaving recover nothing to act on. The recovery guide now covers
the refusal a stopped build container causes after a Docker restart.
A rejected repair checkpoint forced the dependency curve to raw outcomes
and a rollback record overwrote the accepted grade's completion; the
curve now uses the accepted point and matches the dashboard chart. A
finished execution must carry its completion time, and a report's
manifest is written last, atomically, so it never describes a partial
generation.
…e docs

Dashboard Resume on a job campaign goes through job resume, keeping its
accounts and capacity policy; draft campaigns resume like the CLI; bad
input returns 400 or 404; the job CLI finds results like the dashboard
and rejects options its command ignores; the replay score uses passed
over selected points; a report is linked only while it matches the
campaign state. Controller help, the dashboard route table, and the job
and appliance guides now match the commands.
The browser fixtures declare the page globals they use, and the two
integration tests mark their deliberate throw from a cleanup finally.
The source stage now installs the SDK to build the wire codec, so its
node_modules symlinks reached the embedded dependency copy and every
controller build failed. The source stage removes them after its build;
the SDK build stage installs its own again.
Captured writes carry their URL, actors expose their browser context and
recorder, and pages load from an http origin so credential capture can
read storage. The promotion and role test checks only the reload after a
write, since the scenarios now reload before writes too.
The null control grades with its own local browser server and no attempt
lease, so the appliance's lease requirement made every network
interruption check a harness failure there. Without a lease the proxy
runs on this host, where that browser is.
The first full run under the observation rule found duplicate mutations,
targets whose check only fails in setup, positive controls that now also
catch two mutations, a signout check that a brief reload could satisfy,
and sign-in refusals seen only by the action's own wait. Duplicates are
removed, targets follow the checks that observe the defect, 601a and 1d
observe the result directly, and signIn/signUp can hand the signed-in
check to a following expect. Convex gains the variants mutation that
covers 622b. The four 105a mutations stay until 105a has mutations it
actually observes.
The only 105a mutations duplicated 1e and 4b defects and survived, since
105a signs in fresh after a restart rather than reloading. Each stack now
loses the account's cart across that restart or fresh sign-in instead.
The setup's add-to-cart write was still in flight when the offline cut
closed every connection, so the Keyboard line was sometimes never
committed and the reconnect check failed without an app defect. The
setup now waits for the server-pushed cart line first.
…tions

622b now expects the named product before opening it, so an unpublished
name fails both catalog checks at an observation and the mutation targets
both. 1d first confirms the signed-out view holds before reloading,
because a reference app that reloads itself on signout collided with the
harness reload.
Listing plans compiled all 98 saved plans on the HTTP thread, about 15
minutes per pass on the appliance; plans are now cached by path, size and
modification time and discovered in the reader worker. Live cost read
each transcript whole every five seconds; it now reads only new bytes.
Reference, full mutation and null-control evidence from controller image
3213109: every stack scores 176/176 on its reference, every mutation
is caught at its target assertion (convex 142, mongodb 157, postgres 166,
spacetime 154), and the empty app earns nothing. qualification status
reports the calibration ready with no blockers.
Admission held the 9.25 GiB sum of every container cap for each attempt's
first minute. Across 29 attempts of the four-stack L3 qualification,
whole attempts peaked at 1.9 GiB in their first minute and 3.1 GiB overall,
so admission now holds 2.5 GiB. The caps themselves are unchanged.
A Windows checkout with autocrlf stores the same commit with CRLF, so
every scope hash differed from the appliance's and recorded evidence
looked stale locally. The scope now hashes text as Git stores it (LF),
which leaves every LF-tree hash unchanged.
Only admission's startup memory reservation and the scope hash's line
endings changed since the evidence was recorded; no grading code did.
The reviewed decision pins each scope's old and new executable hash.
The action registry gained repeatFormWrite without a representative step,
so the runtime-contract and fixture-coverage tests failed.
The backend sidecar holds each stack's database and peaked at 922 MiB of
its 1 GiB cap during qualification, so a spike could kill a correct
database and charge the failure to the stack. The appliance guide's cap
totals are corrected, and the reviewed reuse decision covers the change.
…end as unknown

The broker refused server tools, MCP servers, containers, fast speed and
priority tiers, and on OpenAI hosted tools, files, stored prompts and
server-side conversations, only because its token rates could not price
them. That changed what the agent could do. It now forwards them and
counts each as unpriced: receipts stay reconciled, reports show the
spend as at least its priced part, and an attempt cost cap no longer
promises budget to a retry after unpriced spend. The reviewed L3 reuse
decision covers the change; qualification uses the model-free reference
agent, which sends no provider requests.

This branch has not been deployed

No deployments
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