Pre-release. Parity is not publicly available yet: the CLI, the GitHub Action and the hosted workspace open at launch. The demo runs on example data.

Skip to content

Architecture and decisions

How Parity is put together, the decisions behind it, and the assumptions that were made along the way.

Parity has two halves with a deliberately narrow interface between them.

  your machine / your CI runner                     hosted (optional)
┌───────────────────────────────────┐            ┌──────────────────────────────┐
│ parity CLI                        │            │ Parity workspace (Next.js)   │
│  └─ parity-engine (Rust)          │  redacted  │  ├─ ingestion API            │
│      sources → scenarios          │  report    │  ├─ runs, review, audit      │
│      runner  → two environments ──┼──────────► │  └─ billing, notifications   │
│      diff    → differences        │  (JSON)    │                              │
│      report  → parity.report/v1   │            │ Clerk · Supabase · R2        │
└───────────────────────────────────┘            │ Resend · Stripe · PostHog    │
        │                 │                      └──────────────────────────────┘
   baseline API     candidate API

The engine talks to your APIs. The hosted workspace never does: it receives a finished, already-redacted report and stores it. Everything on the left works without an account.

#Repository layout

PathWhat it is
crates/parity-engineThe comparison engine: configuration, scenario sources, runner, diff, redaction, report, renderers. A library with no terminal or hosted-service assumptions.
crates/parity-cliThe parity binary: argument parsing, terminal output, files.
action/The reusable GitHub Action (composite): install, run, summary, artifact, verdict.
examples/shop-apiTwo-behaviour demonstration API with seeded regressions, plus its Parity configuration and CI workflow.
tests/e2eEnd-to-end tests that drive the real binary against the example.
packages/reportTypeScript mirror of the parity.report/v1 contract.
packages/uix1991 Labs design tokens and primitives, shared across products.
packages/emailShared transactional email: React Email templates, provider adapter, webhook verification.
apps/webThe hosted workspace, the landing page and the documentation site (one Next.js app).
supabase/migrationsSQL migrations for the x1991 (shared platform) and parity (product) schemas.
docs/Documentation source, rendered at /docs.

#The engine

Pipeline. sources::load turns OpenAPI documents, workflow files, request files and Postman collections into one model: a Scenario is a list of steps, a step is one request plus optional extraction, expectations and assertions. runner::run executes each scenario against both environments, diff::compare compares each pair of responses, and the result is a Report.

Determinism. No step of the pipeline consults a model, a clock-dependent heuristic or a network service to decide an outcome. Scenario generation uses an in-tree SplitMix64 generator whose output is pinned by a test, with one independent stream per (seed, operation, purpose), so adding an endpoint never changes the requests generated for another. Results are reported in input order regardless of completion order. Difference identifiers are a hash of scenario, step, location, kind and the (redacted) values.

Two contexts. Each environment owns a variable map. A step is rendered twice, once from each map, and each response is extracted into its own map. There is no code path that reads the other side's variables. When an extracted value differs between environments (a generated identifier), the pair is recorded as a correlation: later, two differing values are treated as equal only if they are exactly such a pair, or strings that become equal once the paired values are substituted.

Three outcomes, never merged.

  • changed — the engine observed a behavioural difference.
  • error — a request could not be completed (connection, timeout, gateway status). This says nothing about behaviour and has its own exit code.
  • inconclusive — the comparison ran but cannot support a verdict: both sides rejected authentication, a rate limit was hit, a needed variable could not be extracted, an expectation was unmet on both sides, or every difference also appears between two runs of the baseline.

A run that compared nothing is never reported as a pass.

Safety. Mutating requests are sent only where that is authorised: loopback and private addresses by default, anything else only with allow_mutations: true on that environment or --allow-mutations. --dry-run plans without sending. Redirects are not followed (a redirect is behaviour). Only failures that happened before the request reached the server are retried, so a retry cannot duplicate a mutation.

Redaction happens inside the engine before a report exists: sensitive header names, sensitive member names and configured JSONPaths, and finally every literal secret known to the run (values from ${ENV} interpolation, auth blocks and URL credentials) scrubbed from every string in the serialised report. Comparison always runs on the real values.

Watch (planned). The runner talks to a Transport trait, not to HTTP. Watch — detecting changes in an external API over time — needs a second implementation that replays a recorded snapshot as the baseline. The scenario model, comparison, redaction and report are unchanged.

#The hosted workspace

One Next.js application serves the landing page, the documentation and the workspace. There are no microservices, queues or orchestration layers; background work is a cron-triggered route.

Ports and adapters. Every external dependency is an interface with an implementation chosen from environment variables and a local substitute that needs no credentials:

PortProductionLocal substitute
Identity and organisationsClerksigned development identities
DatabaseSupabase PostgreSQLPGlite (in-process Postgres)
Artifact storageCloudflare R2 (S3-compatible API)a Postgres table
BillingStripeinstant local plan changes
AnalyticsPostHogconsole / none
EmailResendin-memory outbox

Moving a service to another account, or replacing it, is a configuration change. The complete list of variables is in apps/web/.env.example.

Shared platform, isolated products. x1991 Labs products share identity, the organisation model and billing infrastructure, and nothing else:

  • Schema x1991 holds what is shared: an organisation and user mirror keyed by Clerk ids, billing customers, subscriptions keyed by (organisation, product), webhook idempotency, and the email outbox.
  • Schema parity holds everything specific to this product: projects, tokens, runs, scenarios, reviews, audit log, role overrides, notification subscriptions.
  • A Parity role (admin, member, viewer) defaults from the Clerk organisation role and can be overridden per person without affecting Clerk or any other product.
  • Entitlements are computed per product from that product's subscription row.

Tenancy. Every query path goes through an access check that resolves the caller's active organisation and scopes by it; a resource in another organisation is indistinguishable from one that does not exist (404). Row level security is enabled on every table with no policies, and the schemas are not exposed through Supabase's Data API — a backstop, not the mechanism.

Stored data. Scenario payloads are packed into chunks, compressed, encrypted with AES-256-GCM under an application key, and written to the artifact store; the database keeps the light columns needed for lists and filters. Request and response headers are re-redacted on ingestion regardless of what the client already did.

Review. A classification is keyed by scenario, difference, baseline revision, candidate revision and comparison-configuration fingerprint, and applies only when all five match. An earlier decision about the same difference under different revisions is shown as a hint that a reviewer can adopt; it is never applied automatically.

Email. Parity sends run notifications only. Authentication email and organisation invitations are Clerk's. Sends go through an outbox table with a unique idempotency key per (run, recipient), retried with backoff, and delivery status is updated from provider webhooks.

#Decisions

  1. Rust for the engine, distributed as one static binary. Predictable performance, no runtime to install in CI, and a type system that keeps the three outcomes distinct.
  2. Own JSONPath subset and own PRNG instead of dependencies. Both are small, and both are contracts: the paths appear in user configuration and the generator's stream decides which requests a seed produces. Neither may change because a dependency did.
  3. Correlation by exact pair, not by pattern. Ignoring "anything that looks like an id" hides real regressions. Pairing only values that were extracted under the same name cannot.
  4. Status-class changes collapse body differences. When a 422 becomes a 201 the two bodies are different documents; listing every field is noise, so the body is reported once.
  5. Nondeterminism is detected, not assumed. For read-only scenarios with differences, the baseline is replayed. Locations that also differ between baseline runs are flagged, and a scenario whose differences are all flagged is inconclusive. Two baseline responses can agree by chance at an unstable location, so while differences remain unexplained the baseline is replayed again, up to three times in total.
  6. One Next.js app for site, docs and workspace: one deployable, one design system.
  7. Clerk Organizations is the organisation model. Parity has no invitation flow of its own.
  8. PostgreSQL through plain SQL migrations in two schemas, with PGlite locally so the product and its tests run without any account.
  9. Proprietary freemium. All of Parity is proprietary. The CLI and basic CI use are free of charge and complete on their own; the hosted workspace and managed cloud execution are the paid product.

#Assumptions worth revisiting

  • Team pricing ($19.99 per seat per month) is a proposal.
  • Single-label host names (http://api:8080) are treated as local for the mutation guard, because that is how CI service containers and Compose networks are addressed. On a network where a single-label name reaches production, set allow_mutations: false explicitly.
  • Rate limiting is in-memory and therefore per instance; on Cloudflare Workers that means per isolate. A platform rate-limit binding should replace it before real traffic.
  • Prebuilt binaries do not exist yet; the release workflow builds them when a tag is pushed.
    Loading the index…