sparta_worlds 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/LICENSE.txt +15 -0
  2. package/bin/worlds.js +53 -0
  3. package/dist/cli/argv.js +27 -0
  4. package/dist/cli/claims.js +250 -0
  5. package/dist/cli/commands.js +67 -0
  6. package/dist/cli/contract.js +142 -0
  7. package/dist/cli/demo.js +114 -0
  8. package/dist/cli/doctor.js +299 -0
  9. package/dist/cli/expect.js +197 -0
  10. package/dist/cli/home.js +18 -0
  11. package/dist/cli/import.js +530 -0
  12. package/dist/cli/index.js +1014 -0
  13. package/dist/cli/init.js +725 -0
  14. package/dist/cli/judge-command.js +184 -0
  15. package/dist/cli/judge.js +1495 -0
  16. package/dist/cli/load.js +8 -0
  17. package/dist/cli/packs.js +82 -0
  18. package/dist/cli/passk.js +1256 -0
  19. package/dist/cli/policy-starters.js +83 -0
  20. package/dist/cli/preload.js +45 -0
  21. package/dist/cli/report.js +579 -0
  22. package/dist/cli/rubric.js +727 -0
  23. package/dist/cli/run.js +266 -0
  24. package/dist/cli/scoreboard.js +432 -0
  25. package/dist/cli/selftest.js +157 -0
  26. package/dist/cli/stdio.js +25 -0
  27. package/dist/cli/tasks.js +1246 -0
  28. package/dist/cli/try.js +156 -0
  29. package/dist/cli/version.js +17 -0
  30. package/package.json +38 -0
  31. package/packs/cancellations.yaml +201 -0
  32. package/packs/credits.yaml +274 -0
  33. package/packs/invoices.yaml +206 -0
  34. package/packs/plan-changes.yaml +170 -0
  35. package/packs/refunds.yaml +437 -0
  36. package/preload/node-hooks.mjs +28 -0
  37. package/preload/node.mjs +19 -0
  38. package/preload/python/sitecustomize.py +88 -0
  39. package/preload/wrap.mjs +81 -0
  40. package/rubrics/acme-prod-library.json +1427 -0
  41. package/rubrics/acme-prod-shift.json +499 -0
  42. package/server/dist/admin/auth.js +145 -0
  43. package/server/dist/admin/routes.js +469 -0
  44. package/server/dist/admin/schemas.js +243 -0
  45. package/server/dist/app.js +112 -0
  46. package/server/dist/core/canonical.js +22 -0
  47. package/server/dist/core/db.js +294 -0
  48. package/server/dist/core/errors.js +136 -0
  49. package/server/dist/core/manager.js +337 -0
  50. package/server/dist/core/money.js +43 -0
  51. package/server/dist/core/nondeterministic.js +39 -0
  52. package/server/dist/core/paths.js +33 -0
  53. package/server/dist/core/prng.js +19 -0
  54. package/server/dist/core/protocol.js +1 -0
  55. package/server/dist/core/publicUrl.js +49 -0
  56. package/server/dist/core/seed.js +286 -0
  57. package/server/dist/core/seedExport.js +169 -0
  58. package/server/dist/core/seedLoader.js +156 -0
  59. package/server/dist/core/time.js +45 -0
  60. package/server/dist/core/world.js +361 -0
  61. package/server/dist/index.js +17 -0
  62. package/server/dist/main.js +42 -0
  63. package/server/dist/scenario/engine.js +172 -0
  64. package/server/dist/scenario/library.js +49 -0
  65. package/server/dist/twin/build.js +372 -0
  66. package/server/dist/twin/pagination.js +32 -0
  67. package/server/dist/twin/params.js +118 -0
  68. package/server/dist/twin/resources/charges.js +24 -0
  69. package/server/dist/twin/resources/customers.js +151 -0
  70. package/server/dist/twin/resources/events.js +26 -0
  71. package/server/dist/twin/resources/invoices.js +217 -0
  72. package/server/dist/twin/resources/payment_intents.js +146 -0
  73. package/server/dist/twin/resources/products.js +92 -0
  74. package/server/dist/twin/resources/refunds.js +103 -0
  75. package/server/dist/twin/resources/shared.js +113 -0
  76. package/server/dist/twin/resources/subscriptions.js +325 -0
  77. package/server/dist/twin/resources/tickets.js +128 -0
  78. package/server/dist/twin/router.js +279 -0
  79. package/server/dist/twin/unsupported.js +212 -0
  80. package/server/dist/webhooks/dispatcher.js +148 -0
  81. package/server/scenarios/auth-expiry.yaml +7 -0
  82. package/server/scenarios/intermittent-500s.yaml +9 -0
  83. package/server/scenarios/lock-timeouts.yaml +12 -0
  84. package/server/scenarios/rate-limit-storm.yaml +10 -0
  85. package/server/scenarios/slow-stripe.yaml +9 -0
  86. package/server/scenarios/stripe-storm-shift.yaml +15 -0
  87. package/server/scenarios/tickets-storm.yaml +10 -0
  88. package/server/scenarios/webhook-chaos.yaml +7 -0
  89. package/server/seeds/acme-prod-library.json +40470 -0
  90. package/server/seeds/acme-prod-shift.json +36544 -0
  91. package/server/seeds/acme-prod.json +35412 -0
  92. package/server/seeds/saas-billing-small.json +4792 -0
  93. package/server/seeds/saas-billing-smoke.json +160 -0
@@ -0,0 +1,10 @@
1
+ # Everything is fine — until Stripe starts 429ing. The first 3 twin requests
2
+ # succeed; the next 3 are rate-limited; then service recovers. Great for
3
+ # catching agents whose retry logic re-issues side-effectful requests.
4
+ name: rate-limit-storm
5
+ description: "3 requests succeed, then 3 get 429 rate_limit, then normal service resumes."
6
+ rules:
7
+ - match: { path: "/v1/**" }
8
+ after_requests: 3
9
+ duration_requests: 3
10
+ respond: { status: 429, stripe_error: rate_limit }
@@ -0,0 +1,9 @@
1
+ # Stripe is up, but everything takes 800ms. Reads on customer endpoints take
2
+ # 1.5s. Exposes agents (and harnesses) with tight timeouts that then retry.
3
+ name: slow-stripe
4
+ description: "800ms latency on all twin requests; 1500ms on /v1/customers/*."
5
+ rules:
6
+ - match: { path: "/v1/**" }
7
+ latency_ms: 800
8
+ - match: { path: "/v1/customers/*" }
9
+ latency_ms: 1500
@@ -0,0 +1,15 @@
1
+ # Shift-scale Stripe weather. rate-limit-storm's three-request window lands
2
+ # inside the first ticket of a 200-call shift and is invisible; this one opens a
3
+ # six-request 429 window after the first 25 calls, then rate-limits every 7th
4
+ # write for the rest of the shift. Each rule keeps its own counter.
5
+ name: stripe-storm-shift
6
+ description: "A six-request 429 window after the first 25 Stripe calls, then every 7th Stripe write is rate-limited; the help desk is untouched."
7
+ rules:
8
+ - match: { path: "/v1/**" }
9
+ after_requests: 25
10
+ duration_requests: 6
11
+ respond: { status: 429, stripe_error: rate_limit }
12
+ - match: { method: POST, path: "/v1/**" }
13
+ after_requests: 10
14
+ every_nth: 7
15
+ respond: { status: 429, stripe_error: rate_limit }
@@ -0,0 +1,10 @@
1
+ # The help desk is flaky, Stripe is healthy. Every 4th ticket update fails with
2
+ # a Zendesk-shaped 500 — after the money has (or hasn't) moved on the other
3
+ # surface. The shift demo's Act III: grade whether what the agent told the
4
+ # customer still matches what the world recorded when one surface drops calls.
5
+ name: tickets-storm
6
+ description: "Every 4th ticket update (PUT /api/v2/tickets/*) fails with a Zendesk-shaped 500; Stripe is untouched."
7
+ rules:
8
+ - match: { method: PUT, path: "/api/v2/tickets/*" }
9
+ every_nth: 4
10
+ respond: { status: 500, stripe_error: api_error }
@@ -0,0 +1,7 @@
1
+ # Webhooks misbehave: every 3rd delivery is silently dropped, and deliveries
2
+ # within a flush batch arrive pairwise swapped. Your event handler should
3
+ # survive gaps and out-of-order arrival — does your agent's?
4
+ name: webhook-chaos
5
+ description: "Drop every 3rd webhook delivery and swap adjacent deliveries."
6
+ rules:
7
+ - webhooks: { drop_every_nth: 3, reorder: swap_adjacent }