diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 2e2338f..7e3a004 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,6 +3,7 @@ "recommendations": [ "bierner.markdown-mermaid", // renders ```mermaid blocks in the markdown preview "rust-lang.rust-analyzer", - "humao.rest-client" // reference/rest/*.rest files + "humao.rest-client", // .dev/reference/rest/*.rest files + "ms-vscode.cpptools" // C debugging (launch.json cppdbg configs, runtime/) ] } diff --git a/Cargo.toml b/Cargo.toml index 618937d..efb1857 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ # docs/plan/done/01-scafolding-crates.md. They are commented out of the # workspace until their phase activates — uncomment each one as code lands. # -# The v1 writeonce blog crates at `reference/crates/` are a separate nested +# The v1 writeonce blog crates at `.dev/reference/crates/` are a separate nested # workspace, excluded here so the root build stays focused on the new runtime. [workspace] @@ -32,7 +32,7 @@ members = [ # "crates/app", # phase 06 target — ##app manifest ] exclude = [ - "reference/crates", + ".dev/reference/crates", ] [workspace.dependencies] diff --git a/crates/README.md b/crates/README.md index 652a362..b73cf23 100644 --- a/crates/README.md +++ b/crates/README.md @@ -1,27 +1,27 @@ # `crates/` — the `.wo` runtime -Fifteen crates make up the new runtime. Only `rt/` carries real code today (Stage 2); the other fourteen are **empty placeholders** scaffolded to match the 7-phase design so each phase's extraction work becomes a mechanical code move into an existing home. +Fifteen crates make up the new runtime. Only `rt/` carries real code today (Stage 2); the other fourteen are **planned** per the 7-phase design — scaffolds were deleted 2026-08-08; recreate each crate when its phase activates, so extraction from `rt` stays a mechanical move. -> The crate-name prefix `wo-` was dropped when the active project namespaced itself under `wo` (the binary, the file extension, the language). Internal imports read cleanly: `use ql::Parser`, `use db::Tx`, `use http::router`. The v1 codebase keeps its `wo-*` prefix in [`reference/crates/`](../reference/crates/) to distinguish the generations. +> The crate-name prefix `wo-` was dropped when the active project namespaced itself under `wo` (the binary, the file extension, the language). Internal imports read cleanly: `use ql::Parser`, `use db::Tx`, `use http::router`. The v1 codebase keeps its `wo-*` prefix in [`.dev/reference/crates/`](../.dev/reference/crates/) to distinguish the generations. ## Map | Phase | Crate | Purpose | Status | | --- | --- | --- | --- | -| 2 | [`ql`](./ql/) | `.wo` grammar — lexer, parser, AST | placeholder | -| 2 | [`value`](./value/) | tagged `Value` + dotted-path helpers | placeholder | -| 2 | [`engine`](./engine/) | in-memory executor (rel / doc / graph) + schema catalog | placeholder | -| 2 | [`txn`](./txn/) | transaction coordinator — MVCC, `RETURNING` alias table | placeholder | -| 2 | [`db`](./db/) | top-level facade — `open()`, `Tx`, `Query`, `Subscribe` | placeholder | -| 3 | [`wal`](./wal/) | write-ahead log — io_uring + fsync + recovery | placeholder | -| 4 | [`sub`](./sub/) | live subscriptions — delta frames on commit | placeholder | -| 4 | [`http`](./http/) | wire protocol — REST / GraphQL-over-WS / native codec | placeholder | -| 5 | [`gen`](./gen/) | codegen — `.wo type` → Go / TS / Rust / Python clients | placeholder | -| 6 | [`policy`](./policy/) | RBAC + row-level rules compiled into planner rewrites | placeholder | -| 6 | [`logic`](./logic/) | `on ` triggers + `fn ... in txn` interpreter | placeholder | -| 6 | [`service`](./service/) | `service rest/graphql/native` endpoint dispatch | placeholder | -| 6 | [`ui`](./ui/) | `##ui` screens → SSR HTML + client runtime | placeholder | -| 6 | [`app`](./app/) | `##app` route manifest + startup hooks | placeholder | +| 2 | `ql` | `.wo` grammar — lexer, parser, AST | planned | +| 2 | `value` | tagged `Value` + dotted-path helpers | planned | +| 2 | `engine` | in-memory executor (rel / doc / graph) + schema catalog | planned | +| 2 | `txn` | transaction coordinator — MVCC, `RETURNING` alias table | planned | +| 2 | `db` | top-level facade — `open()`, `Tx`, `Query`, `Subscribe` | planned | +| 3 | `wal` | write-ahead log — io_uring + fsync + recovery | planned | +| 4 | `sub` | live subscriptions — delta frames on commit | planned | +| 4 | `http` | wire protocol — REST / GraphQL-over-WS / native codec | planned | +| 5 | `gen` | codegen — `.wo type` → Go / TS / Rust / Python clients | planned | +| 6 | `policy` | RBAC + row-level rules compiled into planner rewrites | planned | +| 6 | `logic` | `on ` triggers + `fn ... in txn` interpreter | planned | +| 6 | `service` | `service rest/graphql/native` endpoint dispatch | planned | +| 6 | `ui` | `##ui` screens → SSR HTML + client runtime | planned | +| 6 | `app` | `##app` route manifest + startup hooks | planned | | — | [`rt`](./rt/) | **active** — Stage-2 monolith + the `wo` binary | **shipped** | ## Why `rt/` is monolithic right now @@ -49,6 +49,6 @@ cargo run --bin wo -- run docs/examples/blog # serve the blog sample ## What's outside this directory -- [`../reference/crates/`](../reference/crates/) — the v1 writeonce blog (13 crates, nested workspace). Preserved for reference per [docs/runtime/database/07-wo-seg-migration.md](../docs/runtime/database/07-wo-seg-migration.md). Keeps its `wo-*` prefix. +- [`../.dev/reference/crates/`](../.dev/reference/crates/) — the v1 writeonce blog (13 crates, nested workspace). Preserved for reference per [docs/runtime/database/07-wo-seg-migration.md](../docs/runtime/database/07-wo-seg-migration.md). Keeps its `wo-*` prefix. - [`../prototypes/wo-db/`](../prototypes/wo-db/) — C++ prototype of the query-layer engine (~2k lines). The reference implementation this Rust port follows at the language level. - [`../docs/plan/`](../docs/plan/) — planning documents for in-flight work (the `.md` files directly under `plan/` are upcoming phases; `plan/done/` holds completed ones). [`plan/done/01-scafolding-crates.md`](../docs/plan/done/01-scafolding-crates.md) is the authoritative scope doc for the 14 new placeholders. diff --git a/docs/cm.md b/docs/cm.md index 775c31f..0992504 100644 --- a/docs/cm.md +++ b/docs/cm.md @@ -7,11 +7,11 @@ scaffold sibling crates, multi-app ecommerce, REST + concurrency docs and apps/storefront, with shared/ types/logic/components, per-app app.wo + wo.toml, and reusable .htmlx components (layout, money, order-row) -- add reference/rest/{blog,ecommerce}.rest — VS Code/JetBrains HTTP +- add .dev/reference/rest/{blog,ecommerce}.rest — VS Code/JetBrains HTTP request files driving the running prototype, including 501/404/405 expectations for stubbed endpoints - add docs/plan/09-concurrency-scaleout.md and docs/plan/ui/00-overview.md; refine docs/plan/assembly/02-writeonce-stance.md - refresh templates (about, article, header/footer, home, layout, styles) and add static favicon/logo -- add infra/sync.sh and tighten .gitignore for reference/ symlinks +- add infra/sync.sh and tighten .gitignore for .dev/reference/ symlinks diff --git a/justfile b/justfile index 2690246..a183914 100644 --- a/justfile +++ b/justfile @@ -4,16 +4,16 @@ hello: cargo run --bin wo -- run docs/examples/hello -# C runtime reference (prototypes/wo-rt-c): build, serve, CRUD round-trip, shut down +# C runtime reference (runtime/): build, serve, CRUD round-trip, shut down # Phase A: thread-per-core — each connection hashes to one shard (SO_REUSEPORT), # so a list may land on a different shard than the create. The counters on / # show the spread. WO_THREADS=4 keeps the demo output readable. rt-c-demo port="8085" threads="4": #!/usr/bin/env bash set -euo pipefail - make -C prototypes/wo-rt-c + make -C runtime data=$(mktemp -d /tmp/wo-demo-XXXXXX) - WO_PORT={{port}} WO_THREADS={{threads}} WO_DATA=$data ./prototypes/wo-rt-c/wo-rt & + WO_PORT={{port}} WO_THREADS={{threads}} WO_DATA=$data ./runtime/wo-rt & server=$! trap 'kill $server 2>/dev/null; sleep 0.3; rm -rf $data' EXIT base=http://127.0.0.1:{{port}} @@ -26,18 +26,36 @@ rt-c-demo port="8085" threads="4": curl -s "$base/api/notes"; echo echo "--- spread:"; curl -s "$base/"; echo +# wovm VM core (runtime/src): build the binary +wovm-build: + make -C runtime wovm + +# wovm full gate: unit suite (ASan+UBSan), ISO dispatch flavor, CLI smoke +wovm-test: + make -C runtime test + make -C runtime test-iso + bash runtime/test/cli_smoke.sh + +# woc compiler front (compiler/): build the executable +woc-build: + dune build --root compiler + +# woc gate: unit tests (test_diag) + golden suite (runner, WOC_BLESS=1 to update) +woc-test: + dune runtest --root compiler + # phase-F benchmark: reads, durable writes, 10k idle conns (scaled geometry) rt-c-bench port="8085" threads="8" conns="64": #!/usr/bin/env bash set -euo pipefail - make -C prototypes/wo-rt-c clean >/dev/null - make -C prototypes/wo-rt-c CFLAGS="-O2 -Wall -Wextra -std=c11 -DSLOTS_PER_SHARD=262144" wo-rt bench >/dev/null + make -C runtime clean >/dev/null + make -C runtime CFLAGS="-O2 -Wall -Wextra -std=c11 -DSLOTS_PER_SHARD=262144" wo-rt bench >/dev/null data=$(mktemp -d /tmp/wo-bench-XXXXXX) - WO_PORT={{port}} WO_THREADS={{threads}} WO_DATA=$data ./prototypes/wo-rt-c/wo-rt >/dev/null 2>&1 & + WO_PORT={{port}} WO_THREADS={{threads}} WO_DATA=$data ./runtime/wo-rt >/dev/null 2>&1 & server=$! - trap 'kill $server 2>/dev/null; sleep 0.3; rm -rf $data; make -C prototypes/wo-rt-c clean >/dev/null; make -C prototypes/wo-rt-c wo-rt bench >/dev/null' EXIT + trap 'kill $server 2>/dev/null; sleep 0.3; rm -rf $data; make -C runtime clean >/dev/null; make -C runtime wo-rt bench >/dev/null' EXIT base=127.0.0.1; for _ in $(seq 1 40); do curl -s "http://$base:{{port}}/healthz" >/dev/null && break; sleep 0.25; done - B=./prototypes/wo-rt-c/bench/bench + B=./runtime/bench/bench echo "wo-rt-c ({{threads}} shards, durable WAL):" $B $base {{port}} {{conns}} 5 /healthz $B $base {{port}} {{conns}} 5 /