From eae7e83886d4d36b9d480b3a4c748738422dcf2b Mon Sep 17 00:00:00 2001 From: grantmaye <80912251+grantmaye@users.noreply.github.com> Date: Wed, 7 Oct 2026 01:02:18 -0400 Subject: [PATCH] Tighten demo boundaries and document routing internals --- README.md | 5 + docs/api.md | 2 +- docs/product-story.md | 58 ++++++ docs/technical-manual.md | 189 +++++++++++++++++ package-lock.json | 382 ++++++++++++++++++++--------------- package.json | 2 +- playwright.config.ts | 10 +- src/app/api/graphql/route.ts | 5 +- src/lib/routing.ts | 8 + tests/e2e/dashboard.spec.ts | 15 ++ tests/routing.test.ts | 62 ++++++ 11 files changed, 570 insertions(+), 168 deletions(-) create mode 100644 docs/product-story.md create mode 100644 docs/technical-manual.md diff --git a/README.md b/README.md index dcb68ab..2c24801 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,11 @@ Built with **Next.js, TypeScript, Node.js, Apollo Server, GraphQL, and PostgreSQ **Scope:** fictional orders and simulated rates; no carrier integration or real authentication. See [deliberate boundaries](#deliberate-boundaries). +## Learn the project + +- [Technical manual](docs/technical-manual.md): setup, architecture, contracts, failure labs, extension exercises, and interview answers. +- [Product story](docs/product-story.md): the hypothetical workflow, intended value, limitations, and a 60–90 second demo script. + ## Why this exists A second warehouse turns a simple fulfillment process into a recurring decision: which location has the complete order, and what will it cost to ship from each one? This independent portfolio project explores that decision with a runnable operations interface and transactional stock reservations. diff --git a/docs/api.md b/docs/api.md index 1f0991a..70b31eb 100644 --- a/docs/api.md +++ b/docs/api.md @@ -158,4 +158,4 @@ Use the same cookie file for subsequent operations. Cookie files grant access to Expected business errors use `BAD_USER_INPUT`, `NOT_FOUND`, or `CONFLICT` in `errors[].extensions.code`. Check the GraphQL response's `errors` even when HTTP status is 200. Stock shortages and incomplete quote comparisons are valid review outcomes, not transport errors. -The API accepts one top-level mutation per request. Fragments, batched HTTP operations, and streaming responses are not supported. The schema is intentionally small, with a 200-field operation limit and up to 100 regular orders per workspace. Use introspection to explore its types. +The API accepts one top-level mutation per request. Fragments, batched HTTP operations, and streaming responses are not supported. The schema is intentionally small, with a 200-field operation limit and up to 100 total orders per workspace (including the two concurrency-demo orders). Use introspection to explore its types. diff --git a/docs/product-story.md b/docs/product-story.md new file mode 100644 index 0000000..8910ef5 --- /dev/null +++ b/docs/product-story.md @@ -0,0 +1,58 @@ +# Why Dispatch is useful + +## The problem behind the demo + +A second warehouse creates a decision that an inventory spreadsheet cannot safely resolve by itself: which location can supply the entire order, and which available shipping option costs less? Two operators can see the same last unit. A partial update can promise one product while failing another. A manual warehouse change can accidentally leave both reservations active. A cheap quote is not a complete comparison when another eligible provider is unavailable. + +Fulfillment Routing Engine explores these problems as an independent portfolio project. Its interface is named Dispatch. The source establishes a fictional two-warehouse setting; it does not establish a real customer, employer origin, revenue result, or production deployment. All locations, catalog quantities, order customer labels, and shipping scenarios are illustrative. See [fixtures](../src/lib/seed.ts), [model](../src/lib/model.ts), and [shipping simulator](../src/lib/shipping.ts). + +## A hypothetical day in the warehouse + +Imagine a fictional office-equipment seller operating from Buffalo and Reno. Its operations coordinator receives an order for six desk phones going to San Francisco. Before a routing tool, the coordinator might compare spreadsheets, calculate shipping estimates separately, ask another employee whether stock is already promised, and leave a note explaining the choice. A colleague could allocate the same stock before those sheets are updated. + +With this demo, the coordinator opens FR-1042. Both warehouses' stock checks and quotes appear beside the decision. Reno wins the simulated comparison. Routing saves its reservation and explanation together. If the customer asks for Buffalo, the coordinator supplies a reason and the service transfers ownership atomically. If the order is cancelled, stock returns exactly once. Activity preserves a readable account of the actions. + +The scenario is hypothetical. The benefit demonstrated is a clearer, verifiable workflow; no measured labor savings or fulfillment performance improvement is claimed. + +## Who would benefit, and in what way? + +- **Operations staff evaluating a concept:** compare eligible choices and inspect the reason behind an allocation instead of trusting an unexplained recommendation. +- **Backend engineers learning transactional design:** study a small complete example of stock contention, rollback, idempotent state changes, and adapter boundaries. +- **Engineering reviewers and interviewers:** run recognizable failure cases and trace UI → GraphQL → service → SQL, including independent PostgreSQL connections. +- **Product teams discussing requirements:** use shortages, quote outages, overrides, and cancellation to discover policy questions before choosing a carrier or order-management integration. + +The intended value is decision clarity and a concrete technical teaching artifact. A real seller would still need authentication, carrier/address integration, operational ownership, inventory ingestion, reservation expiry, shipment confirmation, monitoring, and security controls. + +## Before and after workflow + +| Step | Hypothetical manual workflow | Demonstrated workflow | +| ------------------ | ----------------------------------------------- | ---------------------------------------------------------- | +| Check availability | Read counts without knowing concurrent promises | Evaluate on-hand minus reservations for every line | +| Compare options | Assume closest is cheapest | Compare available simulated prices and expose alternatives | +| Commit | Update separate records | Commit inventory, order, and audit together | +| Handle uncertainty | Guess despite a missing quote | Hold for review or explicitly override with a reason | +| Change warehouse | Undo/recreate by hand | Validate and transfer in one transaction | +| Cancel | Risk releasing twice on retries | Terminal idempotent cancellation | +| Explain | Reconstruct the decision later | Retain the decision snapshot and recent audit events | + +The [routing policy](../src/lib/routing.ts) is deliberately conservative: one warehouse must fulfill the whole order, and all eligible quotes must be available before an automatic cheapest claim. These choices prioritize explainability and safe stock promises over global shipping optimization. + +## A 60–90 second demo narration + +“Dispatch is a fictional two-warehouse fulfillment workspace. The important question is not just which shipment is cheaper; it is whether we can reserve the whole order safely and explain our choice. + +Here is FR-1042 going to San Francisco. Both warehouses have phones, and Reno has the lower simulated quote. I route it, then open Inventory to show the six reserved phones. + +Now suppose the customer requests Buffalo. I choose Manual override, give a reason, and save. The old reservation is released and the new one is made in one transaction. Activity records why we changed the decision. Cancelling releases that stock exactly once. + +Here is the quote-outage case. The system holds it for review because it cannot honestly claim the cheapest option with missing evidence. + +Finally, the last-unit demo sends two competing orders against one adapter. Exactly one allocates and the other is held. Tests also run that race through two separate PostgreSQL connections. + +The UI, rates, and data are a teaching demo. The real engineering story is the atomic boundary joining inventory, order state, and an explanation.” + +## Honest boundaries and next steps + +Displayed transit times and price advantage are synthetic, not delivery promises or audited savings. Browser cookies isolate demo datasets; they do not authenticate employees. An allocation does not mean an order shipped. The coarse workspace lock is designed for understandable correctness, not a benchmark claim. PGlite makes local exploration convenient, while PostgreSQL tests provide a separate contention check. + +Start with the [technical manual](technical-manual.md), follow its failure labs, then inspect [architecture.md](architecture.md) to discuss which simplifications a real workflow would need to replace. Keep the existing operational visual identity: the product's purpose is legible warehouse decisions, not decoration. diff --git a/docs/technical-manual.md b/docs/technical-manual.md new file mode 100644 index 0000000..6c08f05 --- /dev/null +++ b/docs/technical-manual.md @@ -0,0 +1,189 @@ +# Fulfillment Routing Engine: technical manual + +This manual teaches the **Dispatch** demo from first run to maintenance. Read the [product story](product-story.md) for the problem it illustrates and the [interview walkthrough](INTERVIEW-WALKTHROUGH.md) for a shorter presentation. Source links below are the implementation, not claims about a production deployment. + +## 1. Vocabulary and first principles + +An **order** is a customer label, a sample destination, and one or more SKU/quantity lines. A **SKU** identifies a product. **On-hand** means physically counted stock in this model; **reserved** means promised to an allocated order. **Available** is `on_hand - reserved`. Allocation reserves stock; it does not purchase a label or ship goods. + +A **candidate** describes one warehouse's stock eligibility and quote. A **decision** stores both candidates, selection, reason, timestamp, policy version, and simulated cost advantage. A **transaction** groups writes so all commit or all roll back. **Idempotent** means repeating an operation produces the same durable effect: routing an already allocated order and cancelling an already cancelled order do not change stock again. + +The central problem is not calculating the smaller number. It is ensuring two callers cannot both promise the last unit and ensuring a saved explanation describes the allocation actually committed. See [routing.ts](../src/lib/routing.ts) and [database.ts](../src/lib/database.ts). + +## 2. Run it, then learn the controls + +Use Node 22.13+ (CI uses Node 22), npm, and a writable local directory: + +```bash +npm ci +npm run dev -- --hostname 127.0.0.1 --port 3000 +``` + +Open `http://127.0.0.1:3000`. No account or environment file is required. For an interview use `npm run build`, then `npm start -- --hostname 127.0.0.1 --port 3000` to avoid development compilation delays. + +The first GraphQL request creates a browser workspace and six orders. Select FR-1042, compare Buffalo and Reno, and route it. Reno receives a six-phone reservation. Open Inventory, return to routing, override to Buffalo with an explanation of at least eight characters, then open Activity. Cancel the order: the active warehouse clears and six phones become available again. The historical decision remains visible in the stored order. Create a new order to see validation and fresh IDs. Reset returns only this cookie's workspace to the starting fixtures. + +[seed.ts](../src/lib/seed.ts) deliberately provides six teaching cases: + +| Order | Lesson | Result on a fresh workspace | +| ------- | --------------------------- | --------------------------------------------- | +| FR-1041 | East-coast price comparison | Buffalo | +| FR-1042 | West-coast price comparison | Reno | +| FR-1043 | Stock outranks closeness | Buffalo; Reno has zero switches | +| FR-1044 | Whole-order shortage | REVIEW; no reservation | +| FR-1045 | Incomplete quote evidence | REVIEW; Reno quote fails | +| FR-1046 | Multiple lines | Two gateways and two phones reserved together | + +The UI creates a single line; GraphQL accepts up to ten input lines and combines duplicate SKUs. Queue routing evaluates orders individually, not as a global cost optimization or one transaction for the whole queue. + +## 3. Follow one request through the code + +| File | What to understand | +| ------------------------------------------------ | ----------------------------------------------------------------------------- | +| [dashboard.tsx](../src/components/dashboard.tsx) | Client state, selection, views, forms, mutation notifications | +| [client.ts](../src/lib/client.ts) | Fetch wrapper and shared GraphQL selections; checks `errors` even on HTTP 200 | +| [GraphQL route](../src/app/api/graphql/route.ts) | JSON POST, origin and size checks, cookie, Apollo context | +| [graphql.ts](../src/lib/graphql.ts) | Schema, resolver mapping, operation budget, public error codes | +| [routing.ts](../src/lib/routing.ts) | Input validation, decisions, transaction orchestration | +| [shipping.ts](../src/lib/shipping.ts) | Quote interface and deterministic distance/weight simulator | +| [model.ts](../src/lib/model.ts) | Domain types, five products, six destinations, two warehouses | +| [database.ts](../src/lib/database.ts) | PGlite/pg adapters, schema, global connection promise | +| [seed.ts](../src/lib/seed.ts) | Fictional inventory and orders | +| [health route](../src/app/api/health/route.ts) | Database readiness with SELECT 1 | + +`routeOrder` reaches `RoutingService.route`. It reads the order, captures both warehouse quotes concurrently outside the lock, and enters a database transaction. `locked` locks the corresponding `demo_sessions` row with `FOR UPDATE`. The service reloads the order, reads current stock, evaluates with captured quotes, conditionally reserves every line, saves the order, and appends an audit event. Commit makes these writes visible together. The dashboard then reloads the workspace. + +The second read matters: an operator may have cancelled the order while a carrier quote was pending. The cancellation wins; stale quote work must not resurrect the order. The cancellation regression test holds quotes behind a promise to reproduce exactly that ordering without sleeps. + +## 4. Policy and invariants + +Automatic allocation requires one warehouse capable of fulfilling **every** line. It requests valid quotes from every stock-eligible warehouse before claiming the cheapest choice. It ranks by integer cents, then warehouse code for ties. Missing stock produces REVIEW; a quote failure at an eligible warehouse also produces REVIEW. `complete` describes quote coverage of eligible warehouses, so no eligible warehouse can yield `complete: true` while still having no selection. Inspect both selection and reason. + +Quotes use great-circle miles and product weight: `round(650 + miles * 0.72 + pounds * 85)` cents. Transit days are bounded synthetic estimates, not an optimization input or delivery promise. `savingsCents` compares eligible quotes at decision time and is zero for overrides; it is not verified business savings. + +Maintain these invariants: + +1. `0 <= reserved <= on_hand`, also enforced by SQL CHECK constraints. +2. An allocated order owns its complete quantity in one warehouse. +3. Stock, order state, and audit event commit together. +4. Routing/cancellation retries do not reserve/release twice. +5. Failed overrides retain the previous allocation. +6. Every query and mutation uses its workspace ID. +7. The 100-order cap includes cancelled, review, regular, and race orders. A race requires two free slots. + +An override counts the order's existing reservation as available to itself. It validates the target and quote before releasing the old reservation, then transfers and records the explanation atomically. A cancelled order is terminal. No reservation expiry or shipped state exists. See the [state diagram and tradeoffs](architecture.md). + +## 5. Database and API contracts + +[database.ts](../src/lib/database.ts) creates four tables: + +| Table | Key and payload | Integrity | +| ------------- | ---------------------------------------------------------- | -------------------------------------------------------- | +| demo_sessions | text ID, creation timestamp | Parent workspace and lock target | +| inventory | `(session_id, warehouse_id, sku)`; on_hand, reserved | Warehouse enum/checks and nonnegative stock | +| orders | `(session_id, id)`; JSONB data | Workspace foreign key; domain shape validated in service | +| audit_events | bigserial ID; session, order ID, action, detail, timestamp | Workspace foreign key; session/ID index | + +Deleting a session cascades to its data. `order_id` in audit events is descriptive, not an order foreign key. JSONB stores the full snapshot conveniently but SQL does not enforce all order fields or reservation ownership. `migrate` uses `CREATE ... IF NOT EXISTS`: it initializes this schema and does not upgrade arbitrary future schema changes. + +The pg adapter uses an eight-connection pool and pins each transaction to one checked-out connection. It rolls back on error and releases the connection in `finally`. PGlite provides embedded PostgreSQL for a single Node process. Sharing a PGlite directory across processes is unsupported. Dashboard reads take the workspace lock for a coherent multi-table snapshot; previews are advisory and may become stale immediately. + +GraphQL exposes dashboard, evaluateOrder, products, warehouses, createOrder, routeOrder, overrideOrder, cancelOrder, resetDemo, and runConcurrencyDemo. See [API examples](api.md) for complete operations. Mutation inputs require a 2–80 character trimmed customer, a known destination and SKU, positive integer quantities up to 1,000 per SKU after aggregation, and 1–10 input lines. Overrides require 8–300 characters. Only one top-level mutation field is allowed per request; fragments and batches are unsupported, with a 200-field budget and 16,000-character request limit. + +Expected errors have `BAD_USER_INPUT`, `NOT_FOUND`, or `CONFLICT`. GraphQL can return HTTP 200 with an `errors` array; do not infer success from status alone. A shortage is a successful business result with REVIEW. Unexpected resolver failures are logged server-side and masked in the response. + +A cookie-preserving request: + +```bash +curl -s http://127.0.0.1:3000/api/graphql \ + -H 'Content-Type: application/json' \ + -c /tmp/dispatch-demo.cookies -b /tmp/dispatch-demo.cookies \ + --data '{"query":"mutation { routeOrder(id: \"FR-1042\") { id status warehouseId } }"}' +``` + +Use a separate cookie file per lab; a new file starts a new fictional workspace. Send reset as a separate operation when a lab needs initial stock. + +## 6. Configuration and trust boundary + +| Variable | Example/meaning | +| --------------- | --------------------------------------------------------------------- | +| DATABASE_URL | `postgres://USER:PASSWORD@HOST:5432/DATABASE`; omit for embedded mode | +| PGLITE_DATA_DIR | `./.data/routing`; use a distinct writable directory per process | +| E2E_PORT | Browser-test HTTP port, default 3000 | +| CONFIRM_RESET | `yes` only for the explicit all-session reset script | + +Next.js reads `.env.local`; Node CLI tests and reset scripts require variables passed in the shell. [.env.example](../.env.example) and [compose.yaml](../compose.yaml) contain local disposable credentials only. Do not replace them with live secrets. The browser's UUID cookie is HTTP-only, strict same-site, and secure on HTTPS. It is a workspace capability, **not verified identity or authorization roles**. A cookie holder can control that demo workspace. The origin check and parameterized SQL do not turn this into a production access-control system. + +There is no deployment workflow in this repository; CI validates on pushes/PRs. Serverless hosting needs external PostgreSQL; an ephemeral filesystem is not a durable PGlite volume. Before any real-data use, design identity, authorization, retention, rate limits, session cleanup, carrier contracts, and operational monitoring. See [SECURITY.md](../SECURITY.md). + +## 7. Verification and failure laboratories + +```bash +npm run format:check +npm run typecheck +npm test +npm run build +npx playwright install chromium +E2E_PORT=43127 PGLITE_DATA_DIR=./.data/browser-lab npm run test:e2e +``` + +Choose an unused port. Playwright starts its own production server and refuses to reuse an unrelated one. Its desktop and mobile cases cover navigation, routing, override, cancellation, creation, reset, review, and contention, plus browser errors and overflow. No separate lint command exists; formatting and TypeScript are the configured static checks. + +For server-database verification, use a disposable PostgreSQL 17 database. `docker compose up -d` starts the supplied local service on 5432; if that port is occupied, use a separately configured instance. Then run: + +```bash +DATABASE_URL=postgres://routing:routing@127.0.0.1:5432/routing npm run test:postgres +``` + +[test:postgres](../tests/postgres.integration.ts) opens two independent pools and verifies one allocation/one review/one reserved unit. It deletes only its generated session afterward. Docker is optional for the local app, but this test requires a running PostgreSQL server; embedded tests are not a substitute. CI provisions PostgreSQL and runs it in [.github/workflows/ci.yml](../.github/workflows/ci.yml). + +### Lab A: all-or-nothing shortage and outage + +Reset. Route FR-1044; expect REVIEW and zero reservations. Route FR-1045; expect REVIEW with `complete: false`. Override FR-1045 to BUF with a valid reason; expect ALLOCATED but still `complete: false` and zero claimed advantage. This distinguishes missing evidence from insufficient inventory. Inspect its saved candidates and Activity. + +### Lab B: failed override preserves ownership + +Reset. Route FR-1043 to BUF; two switches become reserved. Override to RNO; expect the sufficient-stock/available-quote error. The order remains at BUF and its two switches remain reserved. This is covered by `failed override preserves the old allocation` in [routing.test.ts](../tests/routing.test.ts). + +### Lab C: contention and repeatability + +Reset, open Demo walkthrough, run the concurrency demo. Expect exactly `1 allocated · 1 held for review · stock never below zero.` BUF's LAB-001 has reserved 1, available 0. Running again fails with an instruction to reset. The browser/embedded demo demonstrates the result; the separate-pool test demonstrates server locking. + +### Lab D: failure after writes have begun + +Run `npm test -- --test-name-pattern` only if you adapt Node's argument ordering; the simplest exact targeted invocation is: + +```bash +node --import tsx --test --test-name-pattern='audit failure|cancellation during|workspace limit' tests/routing.test.ts +``` + +The audit failure test wraps the transaction adapter and throws at INSERT INTO audit_events, after a multi-item reservation and order save. Expected: the entire dashboard equals its pre-attempt snapshot. The cancellation test pauses quotes, cancels, releases quotes, and expects rejection plus no reservations. The workspace-cap test fills 99 orders and expects a race rejection without either race order inserted. These tests exercise failure ordering, not just successful return values. + +### Diagnose symptoms + +A 503 health response means database readiness failed; inspect the server log and connection/directory configuration first. A cross-origin 403 often means the browser/proxy origin does not match the effective server origin. Preserve the host consistently and check proxy configuration. A stale preview is expected under concurrent changes; route rechecks stock. A duplicate embedded server can lock or corrupt its files: stop duplicate processes and use a fresh data directory. Never delete a live shared database to fix a demo. + +## 8. Design choices and extension exercises + +**Why coarse locking?** A single workspace row makes interleaving easy to reason about. It also serializes dashboard reads and independent orders in that workspace. Narrower locks improve throughput only with consistent ordering, deadlock handling, and measured contention tests. + +**Why direct SQL?** The interesting behavior is visible in conditional UPDATEs and transaction boundaries. An ORM would not remove the need to understand them. **Why no Apollo Client/DataLoader?** The UI reloads a small bounded workspace and nested catalog lookups use in-memory fixtures, so no per-row SQL query problem exists. + +1. **Exercise: a new destination.** Add a fictional destination and prove the UI/API can route to it. **Solution outline:** update DESTINATIONS in model.ts, the GraphQL DestinationId enum, and any UI choices; add a service/API test and inspect the rendered selection. The Zod enum derives from the model, while GraphQL is separately maintained. Do not assume TypeScript generates the schema. +2. **Exercise: a real quote adapter.** Preserve stock safety during timeouts. **Solution outline:** implement ShippingProvider with server-side credentials, runtime response validation, bounded timeout/retry, quote currency/expiry, and parcel dimensions. Keep requests outside `locked`; revalidate quote applicability when order inputs become editable. Add failure and late-cancellation tests before connecting an account. +3. **Exercise: reservation expiry.** **Solution outline:** introduce explicit reservation records/statuses and expiry timestamps with versioned migrations. A worker and cancellation must lock the same ownership boundary, release once, and append an event in one transaction. Add worker-versus-cancel and worker-versus-shipment races. A timer in React is not durable fulfillment logic. +4. **Exercise: idempotent ingestion.** **Solution outline:** add a scoped unique request key and payload hash; same key/same normalized input returns the stored result, changed input conflicts. Insert key and order in the same transaction. Existing route idempotency does not make createOrder retry-safe. + +## 9. Interview questions with grounded answers + +**What prevents overselling?** Workspace row locking serializes writers, conditional stock UPDATEs recheck availability, SQL constraints reject invalid counts, and one transaction commits all lines plus order plus audit. + +**Why quote before locking?** Network latency should not monopolize the inventory lock. Fresh order/state and stock reads under lock prevent stale decisions from blindly committing afterward. + +**Why not simply choose the nearest warehouse?** Inventory eligibility and simulated price are distinct. FR-1043 is the counterexample; actual carrier rates would add further factors. + +**Is this exactly-once processing?** No. Existing order routing/cancellation are idempotent, but new order creation lacks an idempotency key and real external side effects are absent. + +**What does the test suite prove?** Reproducible domain behavior, rollback, separate-connection contention in PostgreSQL, and browser flows. It does not prove arbitrary production load, real carrier correctness, or authenticated multitenancy. + +**What would you change first for production?** Establish real identity/data boundaries and external contracts, then normalized durable reservation ownership and migrations. Preserve the tested atomicity while adding operational limits; do not begin with cosmetic rewrites. diff --git a/package-lock.json b/package-lock.json index 85657ff..ef54ac1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@electric-sql/pglite": "^0.5.8", "graphql": "^16.14.2", "lucide-react": "^1.43.0", - "next": "^16.3.4", + "next": "~16.3.6", "pg": "^8.23.0", "react": "^19.2.8", "react-dom": "^19.2.8", @@ -798,9 +798,9 @@ } }, "node_modules/@img/sharp-darwin-arm64": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.4.tgz", - "integrity": "sha512-Uhfl4V4lhP2nbUVF9+hyH1+luj86f1gUFeo8ALYxFoULoU+G87D43BfeMP8XHsk9boxAnCY/bf2EHwhA7MuGsA==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.5.tgz", + "integrity": "sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==", "cpu": [ "arm64" ], @@ -816,13 +816,13 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-darwin-arm64": "1.3.3" + "@img/sharp-libvips-darwin-arm64": "1.3.4" } }, "node_modules/@img/sharp-darwin-x64": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.4.tgz", - "integrity": "sha512-hWniXY3bG5qKpkKrAwPe4y+VTPmf086YQAnkxWh7uA1YrlRouWGa0M0Mxj3ZjnXFkv7/TD1bTy9lGUK26vRvWw==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.5.tgz", + "integrity": "sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==", "cpu": [ "x64" ], @@ -838,20 +838,20 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-darwin-x64": "1.3.3" + "@img/sharp-libvips-darwin-x64": "1.3.4" } }, "node_modules/@img/sharp-freebsd-wasm32": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.4.tgz", - "integrity": "sha512-lIsKw/BU+kjB4eZjxrYrZmwOJYi3Ajrv66iAlBmUPyKc3HpnloevB1g3wxGD9P/5BbQ1brBGl65VRRrCvQDEqA==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.5.tgz", + "integrity": "sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==", "license": "Apache-2.0", "optional": true, "os": [ "freebsd" ], "dependencies": { - "@img/sharp-wasm32": "0.35.4" + "@img/sharp-wasm32": "0.35.5" }, "engines": { "node": ">=20.9.0" @@ -861,9 +861,9 @@ } }, "node_modules/@img/sharp-libvips-darwin-arm64": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.3.tgz", - "integrity": "sha512-suTBPTDGrI9WodccaDdwZItTSaBYASlBk1NSfElSHrUfzu3szG6lvIF58+WiFvnfzuK8ZBFS5zE00PxqxnRiPg==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.4.tgz", + "integrity": "sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==", "cpu": [ "arm64" ], @@ -877,9 +877,9 @@ } }, "node_modules/@img/sharp-libvips-darwin-x64": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.3.tgz", - "integrity": "sha512-FVJZ5mITMobmXIz/hPDTw0EintTW5H3WfrxwLqEqjiIihlu+hVRyGrFQ60xl0Lxn7Bt3zdpevPaQi0HEzqz9fw==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.4.tgz", + "integrity": "sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==", "cpu": [ "x64" ], @@ -893,12 +893,15 @@ } }, "node_modules/@img/sharp-libvips-linux-arm": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.3.tgz", - "integrity": "sha512-3rbU4vqXXc3hY/OiXdl52xZvT0F1yEngWfvqudtPJg/KkyiaQw2DRsFrNzpmLvfavbwOq3qXn36GP8obHRULQA==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.4.tgz", + "integrity": "sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==", "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -909,12 +912,15 @@ } }, "node_modules/@img/sharp-libvips-linux-arm64": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.3.tgz", - "integrity": "sha512-0DaL0A6Xu6sQSQFwe4iVCrKWU2cCTItnRsYsCdxAMm9NF6twAA9BKnoqy4hqz4+azQ0JHuA26qiUKsf1XJ/v5A==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.4.tgz", + "integrity": "sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==", "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -925,12 +931,15 @@ } }, "node_modules/@img/sharp-libvips-linux-ppc64": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.3.tgz", - "integrity": "sha512-cdn1OvUBwsXhbC0zSzJnNzf5MZ/mTrobawDvNXBTxe8VtqKAm0sRuEY2Evzovb/w9JMk4TvRxqt1mekSuJz64w==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.4.tgz", + "integrity": "sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==", "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -941,12 +950,15 @@ } }, "node_modules/@img/sharp-libvips-linux-riscv64": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.3.tgz", - "integrity": "sha512-HjPVx7yKz+0lqdhDlTw1tt90wamBoxhiXpvl1XZpJLiHH4RCJ5yDTqH+VlYPv2fwFs89JFw4c1IexYOcQUi4IQ==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.4.tgz", + "integrity": "sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==", "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -957,12 +969,15 @@ } }, "node_modules/@img/sharp-libvips-linux-s390x": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.3.tgz", - "integrity": "sha512-neWLh+3yCNThxnfy3c4BbVBeGgt9aftno+XbT56iK28RgeDs3UOFWviLWlUu0bArYVYJaFDK+RRohbicUNCm8Q==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.4.tgz", + "integrity": "sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==", "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -973,12 +988,15 @@ } }, "node_modules/@img/sharp-libvips-linux-x64": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.3.tgz", - "integrity": "sha512-4vKmvAst9nrowcqquKFAyZJUDolUaIp8uRiN0mWFguJ1IplC9/pitXtlnnlU4aa/eJw3J7i67V+pwUL+wZGdsA==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.4.tgz", + "integrity": "sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==", "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -989,12 +1007,15 @@ } }, "node_modules/@img/sharp-libvips-linuxmusl-arm64": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.3.tgz", - "integrity": "sha512-Y9kQaLMuNoB0bPYOOdcZMaseNrFpPodIWWMrx+CZyydf2xn68j9WYc6sWWRrDwNkzCQjKYfc68L7jKjGlHMibw==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.4.tgz", + "integrity": "sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==", "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1005,12 +1026,15 @@ } }, "node_modules/@img/sharp-libvips-linuxmusl-x64": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.3.tgz", - "integrity": "sha512-fj8Mv0HHfD1Rr+4I68+3agJynxDWtBFgicTbSOb9Bke6pIwzGcJ+RX/yHjmiEGFMCavY/dxvem7MyNaJF+wDiw==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.4.tgz", + "integrity": "sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==", "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1021,12 +1045,15 @@ } }, "node_modules/@img/sharp-linux-arm": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.4.tgz", - "integrity": "sha512-7OAS8gI0EReKGVN2HssHlM6umJgxF5VI3xN0p9FA91p/YO+ou5hiNghLdZ5BEHztwaaK5+bLKRf8x/o2L2nk9A==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.5.tgz", + "integrity": "sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==", "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1039,16 +1066,19 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-linux-arm": "1.3.3" + "@img/sharp-libvips-linux-arm": "1.3.4" } }, "node_modules/@img/sharp-linux-arm64": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.4.tgz", - "integrity": "sha512-De4jpEnAU8Hd5oT0j1G3uL4ZvTuipVMn7YC6vPaJhy6/7EwEae0SVAoBrUMYQbkLGDm85taVWwuPc1a44LTzCQ==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.5.tgz", + "integrity": "sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==", "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1061,16 +1091,19 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-linux-arm64": "1.3.3" + "@img/sharp-libvips-linux-arm64": "1.3.4" } }, "node_modules/@img/sharp-linux-ppc64": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.4.tgz", - "integrity": "sha512-2oYZJeIl4kCcMGk4ouZVjnkCtFrpQFlNEtJ6GbxzhHQchwH0NH/qEb9ykmOl29dqwMq+JhFdZn+1ak2FKhI9fQ==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.5.tgz", + "integrity": "sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==", "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1083,16 +1116,19 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-linux-ppc64": "1.3.3" + "@img/sharp-libvips-linux-ppc64": "1.3.4" } }, "node_modules/@img/sharp-linux-riscv64": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.4.tgz", - "integrity": "sha512-cPbNChoRURAWdebDIHSenxRpgEdy7JkPydSnUxRm9VvKD7m0/xVaR/8Fzlu81pk5nHEvHH87UZUA7cTtwnbJSA==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.5.tgz", + "integrity": "sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==", "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1105,16 +1141,19 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-linux-riscv64": "1.3.3" + "@img/sharp-libvips-linux-riscv64": "1.3.4" } }, "node_modules/@img/sharp-linux-s390x": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.4.tgz", - "integrity": "sha512-RY0JFY8Fd6RonCBtHz+DvadaPkXDSI1AUn6yWL9TipqkZ1vY8w8evqdgyDFnkm4/K1ve1TvZiaePP5oSd4+WVQ==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.5.tgz", + "integrity": "sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==", "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1127,16 +1166,19 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-linux-s390x": "1.3.3" + "@img/sharp-libvips-linux-s390x": "1.3.4" } }, "node_modules/@img/sharp-linux-x64": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.4.tgz", - "integrity": "sha512-9qvvEAuk8k89TfWUoX2htWjbAMX8p+NxCppjpcg5k6xMsjhBQPTsoIh36h9Qde4WRuGpJeYnOjdosDn/cnv+OA==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.5.tgz", + "integrity": "sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==", "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1149,16 +1191,19 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-linux-x64": "1.3.3" + "@img/sharp-libvips-linux-x64": "1.3.4" } }, "node_modules/@img/sharp-linuxmusl-arm64": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.4.tgz", - "integrity": "sha512-KB5jxpfWQTr0nc3xdHtWChdbifHrBGsd2SM62Eyxrl8afikm+f5qGBU75SJIZBT/S1MC8XyacdlXBMSWq6OURA==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.5.tgz", + "integrity": "sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==", "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1171,16 +1216,19 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-linuxmusl-arm64": "1.3.3" + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4" } }, "node_modules/@img/sharp-linuxmusl-x64": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.4.tgz", - "integrity": "sha512-f+eZJZIQNEEd26RPSW+76chwOf1XtA2Y/O+5ocVyLliHkeih3e+jhLVBdNTd2rS3IbNXK8+ug93Vf5ZXtF5Lxg==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.5.tgz", + "integrity": "sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==", "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1193,13 +1241,13 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-linuxmusl-x64": "1.3.3" + "@img/sharp-libvips-linuxmusl-x64": "1.3.4" } }, "node_modules/@img/sharp-wasm32": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.4.tgz", - "integrity": "sha512-zQnl4Kwp7Q6NHsENtU2T/00Zi+w3AQNwz3+UaTyVBy2FpXrzXzGjndpK61onhZjRtRpQXxCTeqw19bVyXOh7jA==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.5.tgz", + "integrity": "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==", "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", "optional": true, "dependencies": { @@ -1213,16 +1261,16 @@ } }, "node_modules/@img/sharp-webcontainers-wasm32": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.4.tgz", - "integrity": "sha512-ESfNkywmCfPNyaZjxooddJQiQ+l/nTpGEOGthxiLnIHXC/CmcBixnfwUleX9mCz9ovrUUvKMap/pm8RYbzfwaA==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.5.tgz", + "integrity": "sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==", "cpu": [ "wasm32" ], "license": "Apache-2.0", "optional": true, "dependencies": { - "@img/sharp-wasm32": "0.35.4" + "@img/sharp-wasm32": "0.35.5" }, "engines": { "node": ">=20.9.0" @@ -1232,9 +1280,9 @@ } }, "node_modules/@img/sharp-win32-arm64": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.4.tgz", - "integrity": "sha512-iNdlBX9gLVvqe2I3uIJSIKTq6wckP/DYxZtcqxm09x5Gi24DnFBmPAWZmr60ZyYMG0xlzo6goG3670ar+RXvRw==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.5.tgz", + "integrity": "sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==", "cpu": [ "arm64" ], @@ -1251,9 +1299,9 @@ } }, "node_modules/@img/sharp-win32-ia32": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.4.tgz", - "integrity": "sha512-kqRsbaa5CS6KHlpxnN7WhE6vAAugXyZButpRdvDWetlv6Qv4N9WTcrWzF7tXfB9T7MsoadqdI8hmwLq6UlLvtw==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.5.tgz", + "integrity": "sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==", "cpu": [ "ia32" ], @@ -1270,9 +1318,9 @@ } }, "node_modules/@img/sharp-win32-x64": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.4.tgz", - "integrity": "sha512-XtmnYhBcrORsJ4XJngyzr/EWP0hRZLAZRFaApdKuviyqF78+ylxh2y06ZmtULAMOnObJ3ucpN0AcwSWnMowTRg==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.5.tgz", + "integrity": "sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==", "cpu": [ "x64" ], @@ -1289,15 +1337,15 @@ } }, "node_modules/@next/env": { - "version": "16.3.4", - "resolved": "https://registry.npmjs.org/@next/env/-/env-16.3.4.tgz", - "integrity": "sha512-cjWZnUUa6jZq2kFaNe/ZyJdZonOZ/QoN0Zka2nz/FLOrfx14pQuM9c5RaSVkWMqgdt4ksgPAMWPyHSs/CyV48Q==", + "version": "16.3.8", + "resolved": "https://registry.npmjs.org/@next/env/-/env-16.3.8.tgz", + "integrity": "sha512-Al9zqHVV7TJv0eFuOU4U7Lvv74PTih4Ch63sk2xCIpSTkE3udFnaOcnzP2lQVymiL7yS9Cj2iClUXlR3EQ5sEw==", "license": "MIT" }, "node_modules/@next/swc-darwin-arm64": { - "version": "16.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.3.4.tgz", - "integrity": "sha512-iBr3I5LZNk5/bgl5//iTgD2tcym14MX0Xo7fD//u9dYAEgGzza1y9oywluPtf74YnOswVdH1908aK9xVz7zQTw==", + "version": "16.3.8", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.3.8.tgz", + "integrity": "sha512-2JPRMh2nmQG5CiL7cXGL9AGwnPWJQ//cTtAUCT+w511QHk79SYz3LGv/pc5X643B/WEO0rvu3Yww0hqwt3kgeA==", "cpu": [ "arm64" ], @@ -1311,9 +1359,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "16.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.3.4.tgz", - "integrity": "sha512-2dpiSyl2Jw/NrBPaU2MAKGSa+2MR82pJIn4Sm5Rjr+gxAeuh0z158Su3Z2O8zn7UNNq+ej4bToed6RcRN/Lydg==", + "version": "16.3.8", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.3.8.tgz", + "integrity": "sha512-GZtCCOBKJ4leVIT/Th0llWKhD1ca92lzbQiS5R5ON9QkoiFnilFsebDae1JU2a3HWoKMEmEZWGs1AGLavVM72Q==", "cpu": [ "x64" ], @@ -1327,12 +1375,15 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "16.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.3.4.tgz", - "integrity": "sha512-+t+U8HZT+fApePCS5h89CSH3datz29MkzyfCn+6fpsZBG/oiEOhINcb9rtkv6sdpToLGFn2e6146NzaKCXkqrA==", + "version": "16.3.8", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.3.8.tgz", + "integrity": "sha512-O659ygeQYqneJ1fBKMpFxIFqYkYswu8IAS1OCKK/4f3ZgJJm1dRz4fVJZRi/kLLWjnBKnebOePA4WNv+sV1pVA==", "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1343,12 +1394,15 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "16.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.3.4.tgz", - "integrity": "sha512-mx03GNs1ocQA5JQ4FxDMmIsNkdrZh8cuezKCrId28e5/gIPU/l7Kcy2+vmCCzdjnnmXJy+iOAu+7K0QppO6Urg==", + "version": "16.3.8", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.3.8.tgz", + "integrity": "sha512-dSjKSyWpzxoO1d3DIZZcP4XJcNaKeLmxQMFOiYl5vuBRMmweIqnAhty8tAmRsvTss779cK1FtYnDMj40e4TQlg==", "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1359,12 +1413,15 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "16.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.3.4.tgz", - "integrity": "sha512-YIhGY6fSMfha52bnVxnzc9zaVBzJg+cqQTOD8tXIBSx4fuv0pVMxQTE0PaS59YhnMOiYiG09IMwxJAf/CFm/Dw==", + "version": "16.3.8", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.3.8.tgz", + "integrity": "sha512-lbqOuz3RPRcv+o9msNsJw5x4+Y1ZwPTs6vmL6DCf7i0fZfvng/F59wyeDwqHIvV0mK//RBy/jJkZ+nCKsSMXjQ==", "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1375,12 +1432,15 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "16.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.3.4.tgz", - "integrity": "sha512-+eaaX6axpDb0yF1GCpiERe6njplvdC+nks/fKfcHu3XPGRrald8P3/X7yv7QLdjA51knnxwl9pxdIJsg+w1L+Q==", + "version": "16.3.8", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.3.8.tgz", + "integrity": "sha512-+316WswI8ScVgZeUd+1KGaXkHhaYQzCjvH/05TZSpJ8zBizb1a4G7DtO7F12jcBIqMOtsz9ji1t48fmKtzqsGA==", "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1391,9 +1451,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "16.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.3.4.tgz", - "integrity": "sha512-0jcXW7Xs/uzICrmgV3MhDYDeRy++1CqnpDIerlPIqYO4bhzB4WNbX/aRnQclustsAyTkFKB0z6rbcjmNg5tR8A==", + "version": "16.3.8", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.3.8.tgz", + "integrity": "sha512-ji0gd4kMYUxO+1fJBIbiBVRCjzG/lloiyCccnlebvb1ZJ5qXCPZqYg4Jl1DrrixnWNMKylzgpmMWx0yNDYXlzw==", "cpu": [ "arm64" ], @@ -1407,9 +1467,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "16.3.4", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.3.4.tgz", - "integrity": "sha512-vvBzwu1pYQCp92maZCFCIw/XgOTMR5tur9GjakwIo2cmwRTMKajRZZDS9+e4KsUZWKu1E007WUeAFXRRjZeuzw==", + "version": "16.3.8", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.3.8.tgz", + "integrity": "sha512-WcTlaKt/TWkh5kUjdJcUmB1XgZ+1c6fz4Y9fDHL73YNSdGaUWjceeWrrlwF0nv19iABYWC4iAq1oX1w4Bn0vfg==", "cpu": [ "x64" ], @@ -2658,12 +2718,12 @@ } }, "node_modules/next": { - "version": "16.3.4", - "resolved": "https://registry.npmjs.org/next/-/next-16.3.4.tgz", - "integrity": "sha512-/Ztf6CeRH+ejEXUrYtqI4gkS66eFIHuSwqi60RgcpWKodxFZx2/dqVCMKBwILfAHXQ+F1b1vAudgj3mnxqtoIA==", + "version": "16.3.8", + "resolved": "https://registry.npmjs.org/next/-/next-16.3.8.tgz", + "integrity": "sha512-U7QEZaTini6wKrb8A8hqLLqYQyCetegKjCpJOyxk642vWoMoU1x5PyZCJFvgYgiptA8xc5j/9xYlZFO7w9Sjmw==", "license": "MIT", "dependencies": { - "@next/env": "16.3.4", + "@next/env": "16.3.8", "@swc/helpers": "0.5.23", "baseline-browser-mapping": "^2.9.19", "caniuse-lite": "^1.0.30001579", @@ -2677,14 +2737,14 @@ "node": ">=20.9.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "16.3.4", - "@next/swc-darwin-x64": "16.3.4", - "@next/swc-linux-arm64-gnu": "16.3.4", - "@next/swc-linux-arm64-musl": "16.3.4", - "@next/swc-linux-x64-gnu": "16.3.4", - "@next/swc-linux-x64-musl": "16.3.4", - "@next/swc-win32-arm64-msvc": "16.3.4", - "@next/swc-win32-x64-msvc": "16.3.4", + "@next/swc-darwin-arm64": "16.3.8", + "@next/swc-darwin-x64": "16.3.8", + "@next/swc-linux-arm64-gnu": "16.3.8", + "@next/swc-linux-arm64-musl": "16.3.8", + "@next/swc-linux-x64-gnu": "16.3.8", + "@next/swc-linux-x64-musl": "16.3.8", + "@next/swc-win32-arm64-msvc": "16.3.8", + "@next/swc-win32-x64-msvc": "16.3.8", "sharp": "^0.35.4" }, "peerDependencies": { @@ -3118,9 +3178,9 @@ } }, "node_modules/sharp": { - "version": "0.35.4", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.4.tgz", - "integrity": "sha512-n++8XWcj+jCOr2IOl7h8LbKnGBDY4aPbmprMONBNFdn0ImXqpGVv5zliDs0V9HbmbCQLpbuo2ej9rAoOQTvMDA==", + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.5.tgz", + "integrity": "sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==", "license": "Apache-2.0", "optional": true, "dependencies": { @@ -3135,31 +3195,31 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-darwin-arm64": "0.35.4", - "@img/sharp-darwin-x64": "0.35.4", - "@img/sharp-freebsd-wasm32": "0.35.4", - "@img/sharp-libvips-darwin-arm64": "1.3.3", - "@img/sharp-libvips-darwin-x64": "1.3.3", - "@img/sharp-libvips-linux-arm": "1.3.3", - "@img/sharp-libvips-linux-arm64": "1.3.3", - "@img/sharp-libvips-linux-ppc64": "1.3.3", - "@img/sharp-libvips-linux-riscv64": "1.3.3", - "@img/sharp-libvips-linux-s390x": "1.3.3", - "@img/sharp-libvips-linux-x64": "1.3.3", - "@img/sharp-libvips-linuxmusl-arm64": "1.3.3", - "@img/sharp-libvips-linuxmusl-x64": "1.3.3", - "@img/sharp-linux-arm": "0.35.4", - "@img/sharp-linux-arm64": "0.35.4", - "@img/sharp-linux-ppc64": "0.35.4", - "@img/sharp-linux-riscv64": "0.35.4", - "@img/sharp-linux-s390x": "0.35.4", - "@img/sharp-linux-x64": "0.35.4", - "@img/sharp-linuxmusl-arm64": "0.35.4", - "@img/sharp-linuxmusl-x64": "0.35.4", - "@img/sharp-webcontainers-wasm32": "0.35.4", - "@img/sharp-win32-arm64": "0.35.4", - "@img/sharp-win32-ia32": "0.35.4", - "@img/sharp-win32-x64": "0.35.4" + "@img/sharp-darwin-arm64": "0.35.5", + "@img/sharp-darwin-x64": "0.35.5", + "@img/sharp-freebsd-wasm32": "0.35.5", + "@img/sharp-libvips-darwin-arm64": "1.3.4", + "@img/sharp-libvips-darwin-x64": "1.3.4", + "@img/sharp-libvips-linux-arm": "1.3.4", + "@img/sharp-libvips-linux-arm64": "1.3.4", + "@img/sharp-libvips-linux-ppc64": "1.3.4", + "@img/sharp-libvips-linux-riscv64": "1.3.4", + "@img/sharp-libvips-linux-s390x": "1.3.4", + "@img/sharp-libvips-linux-x64": "1.3.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4", + "@img/sharp-libvips-linuxmusl-x64": "1.3.4", + "@img/sharp-linux-arm": "0.35.5", + "@img/sharp-linux-arm64": "0.35.5", + "@img/sharp-linux-ppc64": "0.35.5", + "@img/sharp-linux-riscv64": "0.35.5", + "@img/sharp-linux-s390x": "0.35.5", + "@img/sharp-linux-x64": "0.35.5", + "@img/sharp-linuxmusl-arm64": "0.35.5", + "@img/sharp-linuxmusl-x64": "0.35.5", + "@img/sharp-webcontainers-wasm32": "0.35.5", + "@img/sharp-win32-arm64": "0.35.5", + "@img/sharp-win32-ia32": "0.35.5", + "@img/sharp-win32-x64": "0.35.5" }, "peerDependenciesMeta": { "@types/node": { @@ -3240,9 +3300,9 @@ } }, "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" diff --git a/package.json b/package.json index b2bf8b8..b42b688 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@electric-sql/pglite": "^0.5.8", "graphql": "^16.14.2", "lucide-react": "^1.43.0", - "next": "^16.3.4", + "next": "~16.3.6", "pg": "^8.23.0", "react": "^19.2.8", "react-dom": "^19.2.8", diff --git a/playwright.config.ts b/playwright.config.ts index 64df6d8..ebca276 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,11 +1,13 @@ import { defineConfig, devices } from '@playwright/test'; +const port = Number(process.env.E2E_PORT || 3000); +const baseURL = `http://127.0.0.1:${port}`; export default defineConfig({ testDir: './tests/e2e', fullyParallel: false, workers: 1, retries: process.env.CI ? 1 : 0, use: { - baseURL: 'http://localhost:3000', + baseURL, trace: 'retain-on-failure', screenshot: 'only-on-failure', }, @@ -17,9 +19,9 @@ export default defineConfig({ { name: 'mobile', use: { ...devices['iPhone 13'], defaultBrowserType: 'chromium' } }, ], webServer: { - command: 'npm start', - url: 'http://localhost:3000/api/health', - reuseExistingServer: !process.env.CI, + command: `npm start -- --hostname 127.0.0.1 --port ${port}`, + url: `${baseURL}/api/health`, + reuseExistingServer: false, timeout: 120000, }, }); diff --git a/src/app/api/graphql/route.ts b/src/app/api/graphql/route.ts index 0631b73..870049f 100644 --- a/src/app/api/graphql/route.ts +++ b/src/app/api/graphql/route.ts @@ -13,7 +13,10 @@ export async function POST(request: NextRequest) { if (!request.headers.get('content-type')?.startsWith('application/json')) return NextResponse.json({ error: 'Use application/json.' }, { status: 415 }); const origin = request.headers.get('origin'); - if (origin && origin !== request.nextUrl.origin) + // NextURL normalizes loopback IPs to localhost. Preserve the browser's Host + // when comparing origins so legitimate 127.0.0.1 requests remain same-origin. + const expectedOrigin = `${request.nextUrl.protocol}//${request.headers.get('host')}`; + if (origin && origin !== expectedOrigin) return NextResponse.json({ error: 'Cross-origin requests are not allowed.' }, { status: 403 }); const body = await request.text(); if (body.length > 16000) diff --git a/src/lib/routing.ts b/src/lib/routing.ts index ff1d0cf..5d5c0ee 100644 --- a/src/lib/routing.ts +++ b/src/lib/routing.ts @@ -357,6 +357,14 @@ export class RoutingService { } async race(sessionId: string) { const orders = await this.locked(sessionId, async (tx) => { + const [{ count }] = await tx.query<{ count: number }>( + 'SELECT count(*)::int AS count FROM orders WHERE session_id=$1', + [sessionId], + ); + if (count > 98) + throw new RoutingError( + 'The last-unit demo needs room for two orders. Reset the workspace.', + ); const [{ available }] = await tx.query<{ available: number }>( "SELECT on_hand-reserved AS available FROM inventory WHERE session_id=$1 AND warehouse_id='BUF' AND sku='LAB-001'", [sessionId], diff --git a/tests/e2e/dashboard.spec.ts b/tests/e2e/dashboard.spec.ts index b4314ae..5a05978 100644 --- a/tests/e2e/dashboard.spec.ts +++ b/tests/e2e/dashboard.spec.ts @@ -52,3 +52,18 @@ test('stock shortage, quote failure, audit trail and last-unit race', async ({ p await page.getByRole('button', { name: 'Activity log', exact: true }).click(); await expect(page.getByRole('heading', { name: 'Decision trail' })).toBeVisible(); }); + +test('HTTP origin checks allow the current host and reject a foreign origin', async ({ + request, + baseURL, +}) => { + const data = { query: '{ products { sku } }' }; + const allowed = await request.post('/api/graphql', { headers: { origin: baseURL! }, data }); + expect(allowed.status()).toBe(200); + expect((await allowed.json()).data.products).toHaveLength(5); + const rejected = await request.post('/api/graphql', { + headers: { origin: 'https://unrelated.example' }, + data, + }); + expect(rejected.status()).toBe(403); +}); diff --git a/tests/routing.test.ts b/tests/routing.test.ts index 73e1fe9..25b40bf 100644 --- a/tests/routing.test.ts +++ b/tests/routing.test.ts @@ -230,3 +230,65 @@ test('GraphQL dashboard, nested relationships, mutation errors and budget', asyn await api.stop(); } }); + +test('audit failure rolls back all item reservations and the saved order', async () => { + const before = await service.dashboard(session); + const failingDb: Database = { + ...db, + transaction: (work) => + db.transaction((tx) => + work({ + query: async (sql: string, params?: unknown[]): Promise => { + if (sql.startsWith('INSERT INTO audit_events')) + throw new Error('Injected audit failure'); + return tx.query(sql, params); + }, + }), + ), + }; + await assert.rejects( + () => new RoutingService(failingDb).route(session, 'FR-1046'), + /Injected audit failure/, + ); + assert.deepEqual(await service.dashboard(session), before); +}); + +test('cancellation during a slow quote cannot be overwritten by allocation', async () => { + let release!: () => void; + let started!: () => void; + const gate = new Promise((resolve) => { + release = resolve; + }); + const quoting = new Promise((resolve) => { + started = resolve; + }); + const slow = new RoutingService(db, () => ({ + quote: async () => { + started(); + await gate; + return { costCents: 1000, transitDays: 2, distanceMiles: 50 }; + }, + })); + const pending = slow.route(session, 'FR-1046'); + await quoting; + await service.cancel(session, 'FR-1046'); + release(); + await assert.rejects(pending, /Cancelled/); + const result = await service.dashboard(session); + assert.equal(result.orders.find((order) => order.id === 'FR-1046')!.status, 'CANCELLED'); + assert.ok(result.inventory.every((row) => row.reserved === 0)); +}); + +test('last-unit demo respects the shared 100-order workspace limit atomically', async () => { + for (let index = 0; index < 93; index++) { + await service.createOrder(session, { + customer: 'Capacity fixture', + destinationId: 'NYC', + items: [{ sku: 'PH-100', quantity: 1 }], + }); + } + const before = await service.dashboard(session); + assert.equal(before.orders.length, 99); + await assert.rejects(() => service.race(session), /room for two orders/); + assert.deepEqual(await service.dashboard(session), before); +});