movingparticle@caja-negra RODRIGO POLO EC, GYE ~/reto-2/DESIGN_DOC --:--:-- ES

movingparticle@caja-negra:~$ cat ./ARCHITECTURE.txt

FRONTIER Bogotá 2026 · Challenge 2 · 12:00 milestone.
A service has been running in production for 10 years and nobody knows how it works. We'll discover its behavior by observing it and build a replica that responds exactly the same — errors included — without ever calling it at runtime.

01 // what

Replace a system with no code and no documentation with a deterministic, byte-for-byte replica, against cases we don't know.

02 // how

Hypothesis-driven probing to infer the real rule, and a native in-memory HTTP server that emulates commands, states and errors.

03 // proof

Differential comparison oracle vs. replica, an adversarial battery, and exact parity of status and body.

status+body fidelity active learning node esm · 0 deps atomic reset no overfitting
system design · architecture

Architecture

Production on Cloudflare Workers with a Durable Object (single global state). The same engine (src/engine.mjs) runs on a local Node server. Integrity with ISO 7064 Mod 97-10.

Public entrypoint: https://caja-negra-reemplazo.parsec-ai-labs.workers.dev

EVALUATOR                         person · 100 hidden tests
    |
    |  HTTPS + Bearer · JSON · 5s
    v
+------------- WORKER (Cloudflare) -------------+
|  GET /health      -> 200 {"ok":true}          |
|  POST /__reset    -> 200 {"ok":true}          |
|  POST /msg        -> auth -> engine -> X-Req  |
|  /*               -> 404 E404                 |
+----------------------+------------------------+
                       |  known route + auth
                       v
DURABLE OBJECT  global-caja-negra · single state
    |
    v
ENGINE  ISO 7064 checksum · accounts · operations

C4 · level 1 — context

flowchart TD Judge["Evaluator / Judge"]:::person subgraph SYS["Autonomous replacement"] EP["Worker HTTP /health /__reset /msg"]:::system end Oracle["Original service"]:::external Judge -->|"HTTPS + Bearer, JSON in 5s"| SYS SYS -.->|"offline comparison"| Oracle classDef person fill:#102016,stroke:#39ff14,color:#d7f5c8; classDef system fill:#0c1610,stroke:#7ee7ff,color:#d7f5c8; classDef external fill:#141008,stroke:#ffb000,color:#ffe7b8;
synchronousdevelopment only

C4 · level 2 — containers

flowchart TB subgraph PROD["WORKER + DURABLE OBJECT"] Router["Worker fetch
CORS routing timing-safe auth"] Health["GET /health"] Reset["POST /__reset"] DO[("Durable Object
global-caja-negra")] Engine["BankingEngine
engine.mjs"] Check["checksum.mjs
ISO 7064 Mod 97-10"] Sec["security.mjs
8 KiB sanitize token"] Router --> Health Router --> Reset Router -->|"POST /msg"| DO Sec -.-> Router DO --> Engine Engine --> Check end subgraph LOCAL["Local Node server (tests)"] SNode["server.mjs node:http"] SNode --> Engine end subgraph DISC["Offline harness"] Fuzzer["Prober"] Oracle2["Oracle"] Comparator["Comparator"] SpecLog["experimentos.jsonl + SPEC.md"] Fuzzer --> Oracle2 Oracle2 --> Comparator Engine -.-> Comparator Comparator --> SpecLog end Judge2["Evaluator"]:::person Judge2 -->|"Bearer"| Router classDef person fill:#102016,stroke:#39ff14,color:#d7f5c8;

Worker

Production entrypoint: CORS, routing, timing-safe auth and an 8 KiB body limit (E101). Unknown routes → 404 E404.

Durable Object

Single instance global-caja-negra: guarantees one state across requests, isolated by POST /__reset.

Engine + checksum

Deterministic state machine. Control with ISO 7064 Mod 97-10; error precedence and ANULA reversal.

Runtime of one test

POST /__reset → state 0 → POST /msg (1 to 12 requests) → validation → transition → exact body. More than 5 s is a failure.

Deployment

Worker + Durable Object on Cloudflare's edge. A single logical state; verified live (20/20 examples).

keys 1234 5678 jump to section