|
4 | 4 |
|
5 | 5 | (meta |
6 | 6 | (version "0.1.0") |
7 | | - (last-updated "2026-03-20") |
| 7 | + (last-updated "2026-03-21") |
8 | 8 |
|
9 | 9 | (architecture-decisions |
10 | | - (adr "001-iser-pattern" |
| 10 | + (adr "001-alloy-as-backend" |
11 | 11 | (status "accepted") |
12 | | - (context "Need to make powerful languages accessible without steep learning curves") |
13 | | - (decision "Use manifest-driven code generation: user describes WHAT, tool generates HOW") |
14 | | - (consequences "Users write zero target language code; all complexity in the -iser")) |
| 12 | + (context "Need a formal verification backend that can find design bugs in API specs without requiring user expertise in formal methods") |
| 13 | + (decision "Use Alloy 6 (MIT, Daniel Jackson) — relational logic with SAT solving via Kodkod/SAT4J for bounded model checking") |
| 14 | + (consequences "Alloy is well-established, has a Java API for headless use, and can exhaustively check small scopes. Requires JVM dependency for analyzer.")) |
15 | 15 |
|
16 | | - (adr "002-abi-ffi-standard" |
| 16 | + (adr "002-spec-to-model-pipeline" |
17 | 17 | (status "accepted") |
18 | | - (context "Need verified interop between Rust CLI, target language, and user code") |
19 | | - (decision "Idris2 ABI for formal proofs, Zig FFI for C-ABI bridge") |
20 | | - (consequences "Compile-time correctness guarantees; zero runtime overhead from proofs")) |
| 18 | + (context "Need to transform API specifications into Alloy models without requiring users to learn Alloy syntax") |
| 19 | + (decision "Pipeline: spec file -> parser -> SpecModel IR -> Alloy codegen -> .als files. Users declare invariants in TOML, alloyiser generates all Alloy code") |
| 20 | + (consequences "Users never write Alloy directly. Alloyiser maps OpenAPI concepts (schemas, required, refs) to Alloy concepts (sigs, facts, relations) automatically.")) |
21 | 21 |
|
22 | | - (adr "003-rsr-template" |
| 22 | + (adr "003-iser-pattern" |
23 | 23 | (status "accepted") |
24 | | - (context "Need consistent project structure across 29+ -iser repos") |
25 | | - (decision "All repos cloned from rsr-template-repo with full CI/CD and governance") |
26 | | - (consequences "17 workflows, SECURITY.md, CONTRIBUTING, bot directives from day one"))) |
| 24 | + (context "Need consistent architecture across the -iser family") |
| 25 | + (decision "Use manifest-driven code generation: user describes WHAT in alloyiser.toml, tool generates HOW") |
| 26 | + (consequences "Users write zero Alloy code; all complexity in alloyiser. Same pattern as chapeliser, typedqliser, etc.")) |
| 27 | + |
| 28 | + (adr "004-abi-ffi-standard" |
| 29 | + (status "accepted") |
| 30 | + (context "Need verified interop between Rust CLI, Alloy Analyzer (JVM), and user toolchain") |
| 31 | + (decision "Idris2 ABI for formal proofs of model soundness, Zig FFI for C-ABI bridge") |
| 32 | + (consequences "Compile-time guarantees that model extraction preserves spec semantics. JVM bridge via JNI or subprocess.")) |
| 33 | + |
| 34 | + (adr "005-counterexample-reports" |
| 35 | + (status "accepted") |
| 36 | + (context "Alloy Analyzer counterexamples are XML atoms — not useful to API designers") |
| 37 | + (decision "Map counterexample atoms back to original spec entities and produce human-readable violation reports with suggested fixes") |
| 38 | + (consequences "Counterexample 'Pet$0' gets reported as 'The OpenAPI spec allows creating a Pet without an owner field'. Actionable output."))) |
27 | 39 |
|
28 | 40 | (development-practices |
29 | | - (language "Rust" (purpose "CLI and orchestration")) |
30 | | - (language "Idris2" (purpose "ABI formal proofs")) |
31 | | - (language "Zig" (purpose "FFI C-ABI bridge")) |
| 41 | + (language "Rust" (purpose "CLI orchestration, spec parsing, report generation")) |
| 42 | + (language "Idris2" (purpose "ABI formal proofs: model extraction soundness")) |
| 43 | + (language "Zig" (purpose "FFI C-ABI bridge to Alloy Analyzer (JVM)")) |
| 44 | + (language "Alloy" (purpose "Generated models — .als files for SAT solving")) |
32 | 45 | (build-tool "cargo") |
33 | 46 | (ci "GitHub Actions (17 workflows)")) |
34 | 47 |
|
35 | 48 | (design-rationale |
36 | 49 | (principle "Manifest-driven" |
37 | | - (explanation "User intent captured in TOML; all generation is deterministic and reproducible")) |
38 | | - (principle "Formally verified bridges" |
39 | | - (explanation "Idris2 dependent types prove interface correctness at compile time")) |
40 | | - (principle "Zero target language exposure" |
41 | | - (explanation "Users never write Chapel/Julia/Futhark/etc. — the -iser handles everything")))) |
| 50 | + (explanation "User intent captured in alloyiser.toml; invariants are plain-English names mapped to Alloy expressions")) |
| 51 | + (principle "Find bugs before code" |
| 52 | + (explanation "API design bugs (orphaned resources, impossible states, race conditions) are cheaper to fix at spec time than implementation time")) |
| 53 | + (principle "Formally verified extraction" |
| 54 | + (explanation "Idris2 dependent types prove that the model extraction preserves specification semantics — the generated Alloy model is faithful to the source spec")) |
| 55 | + (principle "Actionable counterexamples" |
| 56 | + (explanation "Reports map Alloy atoms back to spec entities, explain the violation in domain terms, and suggest fixes")))) |
0 commit comments