docs(standards): mirror doc-forge wiki style; mermaid + copyable build prompt
- move templates into src/templates; renumber wiki pages; add app-components page - embed agentic build prompt as a copyable markdown block; add mermaid diagrams - build.py writes <name>/mcp; config static bundle -> standards/mcp - registry reads libraries.json as bytes (committed file was UTF-16LE); normalize to UTF-8 - Dockerfile: drop stale blog copy; per-repo <name>/mcp copies - drop nested standards/mcp/standards duplicate and empty root mcp/
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<link rel="prev" href="..">
|
||||
|
||||
|
||||
<link rel="next" href="../10_testing/">
|
||||
<link rel="next" href="../02_components/">
|
||||
|
||||
|
||||
<link rel="icon" href="../assets/images/favicon.png">
|
||||
@@ -297,18 +297,18 @@
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#summary" class="md-nav__link">
|
||||
<a href="#architecture" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Summary
|
||||
🏗️ Architecture
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-three-layers" class="md-nav__link">
|
||||
<a href="#the-one-way-dependency-rule" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
The three layers
|
||||
🔄 The one-way dependency rule
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -317,7 +317,7 @@
|
||||
<li class="md-nav__item">
|
||||
<a href="#core-principles" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Core principles
|
||||
🧭 Core principles
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -326,7 +326,16 @@
|
||||
<li class="md-nav__item">
|
||||
<a href="#runtime-processes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Runtime processes
|
||||
⚙️ Runtime processes
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#read-next" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
➡️ Read Next
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -347,12 +356,12 @@
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../10_testing/" class="md-nav__link">
|
||||
<a href="../02_components/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Testing
|
||||
App Components
|
||||
|
||||
</span>
|
||||
|
||||
@@ -369,7 +378,7 @@
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../11_build_recipe/" class="md-nav__link">
|
||||
<a href="../03_build_recipe/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
@@ -384,6 +393,28 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../04_development/01_testing/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Testing & Quality
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
@@ -411,18 +442,18 @@
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#summary" class="md-nav__link">
|
||||
<a href="#architecture" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Summary
|
||||
🏗️ Architecture
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#the-three-layers" class="md-nav__link">
|
||||
<a href="#the-one-way-dependency-rule" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
The three layers
|
||||
🔄 The one-way dependency rule
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -431,7 +462,7 @@
|
||||
<li class="md-nav__item">
|
||||
<a href="#core-principles" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Core principles
|
||||
🧭 Core principles
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -440,7 +471,16 @@
|
||||
<li class="md-nav__item">
|
||||
<a href="#runtime-processes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Runtime processes
|
||||
⚙️ Runtime processes
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#read-next" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
➡️ Read Next
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -463,45 +503,104 @@
|
||||
|
||||
|
||||
<h1 id="overview">Overview</h1>
|
||||
<h2 id="summary">Summary</h2>
|
||||
<p>The blueprint is a <strong>hexagonal (ports and adapters) application</strong> with a
|
||||
<p>The blueprint is a <strong>hexagonal (ports & adapters) application</strong> with a
|
||||
<strong>spec-first</strong> web edge and a <strong>single composition root</strong>. It favors explicit
|
||||
wiring over implicit magic, and it prefers existing internal libraries over
|
||||
hand-written infrastructure.</p>
|
||||
wiring over implicit magic and existing internal libraries over hand-written
|
||||
infrastructure. Start here to build the mental model; the enforceable details
|
||||
live in the reference pages.</p>
|
||||
<hr />
|
||||
<h2 id="the-three-layers">The three layers</h2>
|
||||
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1">1</a></span>
|
||||
<span class="normal"><a href="#__codelineno-0-2">2</a></span>
|
||||
<span class="normal"><a href="#__codelineno-0-3">3</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1"></a>interfaces/ ← HTTP edge: thin handlers bound to an OpenAPI operationId
|
||||
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2"></a>domain/ ← business core: models, ports (interfaces), services, orchestrators
|
||||
</span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3"></a>infra/ ← adapters: databases, caches, external clients, hardware
|
||||
</span></code></pre></div></td></tr></table></div>
|
||||
<p>Plus two optional layers:</p>
|
||||
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-1-1">1</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-2">2</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-1-1"><a id="__codelineno-1-1" name="__codelineno-1-1"></a>pipelines/ ← data-driven transformation graphs (extraction, enrichment)
|
||||
</span><span id="__span-1-2"><a id="__codelineno-1-2" name="__codelineno-1-2"></a>scripts/ ← operator scripts that reuse the composition root
|
||||
</span></code></pre></div></td></tr></table></div>
|
||||
<h2 id="core-principles">Core principles</h2>
|
||||
<h2 id="architecture">🏗️ Architecture</h2>
|
||||
<pre class="mermaid"><code>flowchart LR
|
||||
subgraph EDGE["interfaces/ — HTTP edge"]
|
||||
OAS["openapi.yaml<br/>operationId contract"]
|
||||
RT["<resource>/routes.py<br/>thin handlers"]
|
||||
end
|
||||
|
||||
subgraph CORE["domain/ — pure business core"]
|
||||
MD["models"]
|
||||
PT["ports (abstract)"]
|
||||
SV["services"]
|
||||
end
|
||||
|
||||
subgraph INFRA["infra/ — adapters"]
|
||||
RP["mongo repos (mongo-ops)"]
|
||||
AD["cache · stores · llm · mail"]
|
||||
DB[("MongoDB")]
|
||||
end
|
||||
|
||||
CR["init.py<br/>composition root"]
|
||||
|
||||
OAS --> RT
|
||||
RT --> SV
|
||||
SV --> PT
|
||||
SV --> RP
|
||||
PT -. depends on .- RP
|
||||
CR --- RT
|
||||
CR --- SV
|
||||
CR --- RP
|
||||
RP --> DB
|
||||
AD --- CR</code></pre>
|
||||
<p>The rule holds at every edge: code in an outer ring may depend on a ring closer
|
||||
to the core, never the reverse. <code>domain/</code> never imports a web framework or a
|
||||
database driver.</p>
|
||||
<blockquote>
|
||||
<p><strong>Legend</strong> — solid arrows are compile-time calls; dotted arrows are the
|
||||
port/adapter contract, resolved by the composition root at startup.</p>
|
||||
</blockquote>
|
||||
<hr />
|
||||
<h2 id="the-one-way-dependency-rule">🔄 The one-way dependency rule</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Ring</th>
|
||||
<th>May import</th>
|
||||
<th>Never imports</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>interfaces/</code></td>
|
||||
<td><code>domain</code>, framework glue (glue only)</td>
|
||||
<td>business logic, <code>infra</code> directly</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>domain/</code></td>
|
||||
<td>nothing but its own ports</td>
|
||||
<td>web frameworks, drivers, <code>infra</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>infra/</code></td>
|
||||
<td><code>domain</code> ports, drivers, libraries</td>
|
||||
<td>—</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>init.py</code></td>
|
||||
<td>everything (the wiring point)</td>
|
||||
<td>—</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
<h2 id="core-principles">🧭 Core principles</h2>
|
||||
<ol>
|
||||
<li><strong>One-way dependencies.</strong> <code>interfaces -> domain -> infra</code> is allowed;
|
||||
the reverse is forbidden. The domain never imports a framework it does not
|
||||
own.</li>
|
||||
<li><strong>Ports in the domain, adapters in infra.</strong> A service depends on an
|
||||
abstract port; the composition root injects a concrete adapter.</li>
|
||||
<li><strong>One-way dependencies.</strong> <code>interfaces -> domain -> infra</code> is allowed; the
|
||||
reverse is forbidden.</li>
|
||||
<li><strong>Ports in the domain, adapters in infra.</strong> A service depends on an abstract
|
||||
port; the composition root injects a concrete adapter.</li>
|
||||
<li><strong>One composition root.</strong> Nothing constructs its own dependencies. All
|
||||
wiring lives in one module (<code>init.py</code>) and is exposed as a flat resource
|
||||
registry.</li>
|
||||
<li><strong>Spec-first.</strong> The HTTP contract is declared in an OpenAPI document. Route
|
||||
wiring lives in one module (<code>init.py</code>) exposed as a flat resource registry.</li>
|
||||
<li><strong>Spec-first.</strong> The HTTP contract is declared in <code>openapi.yaml</code>; route
|
||||
handlers are looked up by <code>operationId</code>. There are no decorator routers.</li>
|
||||
<li><strong>Reuse the libraries.</strong> Pipeline orchestration, DI, Mongo repositories,
|
||||
ingestion, auth, and docs are provided by internal libraries. Do not
|
||||
reimplement them — see the library registry.</li>
|
||||
<li><strong>Reuse the libraries.</strong> Orchestration, DI, Mongo repositories, ingestion,
|
||||
auth, and docs come from internal libraries — see the <a href="../lib/13_library_registry/">Library
|
||||
Registry</a>.</li>
|
||||
<li><strong>Explicit state machines.</strong> Long-running work moves through explicit,
|
||||
durable statuses and can pause for human input.</li>
|
||||
</ol>
|
||||
<h2 id="runtime-processes">Runtime processes</h2>
|
||||
<p>A standard app may run as up to three processes that share the same
|
||||
composition root:</p>
|
||||
<hr />
|
||||
<h2 id="runtime-processes">⚙️ Runtime processes</h2>
|
||||
<p>A standard app may run as up to three processes that share the same composition
|
||||
root:</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -528,6 +627,11 @@ composition root:</p>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
<h2 id="read-next">➡️ Read Next</h2>
|
||||
<ul>
|
||||
<li><a href="../02_components/">02 – App Components</a> · <a href="../03_build_recipe/">03 – Build Recipe</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
@@ -589,6 +693,8 @@ composition root:</p>
|
||||
|
||||
<script src="../assets/javascripts/bundle.f55a23d4.min.js"></script>
|
||||
|
||||
<script src="https://unpkg.com/mermaid@10.9.1/dist/mermaid.min.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -11,16 +11,18 @@
|
||||
|
||||
|
||||
|
||||
<link rel="prev" href="../10_testing/">
|
||||
<link rel="prev" href="../01_overview/">
|
||||
|
||||
|
||||
<link rel="next" href="../03_build_recipe/">
|
||||
|
||||
|
||||
<link rel="icon" href="../assets/images/favicon.png">
|
||||
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.6.23">
|
||||
|
||||
|
||||
|
||||
<title>Build Recipe - Aetos Standards — Wiki</title>
|
||||
<title>App Components - Aetos Standards — Wiki</title>
|
||||
|
||||
|
||||
|
||||
@@ -72,7 +74,7 @@
|
||||
<div data-md-component="skip">
|
||||
|
||||
|
||||
<a href="#build-recipe" class="md-skip">
|
||||
<a href="#app-components" class="md-skip">
|
||||
Skip to content
|
||||
</a>
|
||||
|
||||
@@ -108,7 +110,7 @@
|
||||
<div class="md-header__topic" data-md-component="header-topic">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Build Recipe
|
||||
App Components
|
||||
|
||||
</span>
|
||||
</div>
|
||||
@@ -264,28 +266,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../10_testing/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Testing
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -303,7 +283,7 @@
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Build Recipe
|
||||
App Components
|
||||
|
||||
</span>
|
||||
|
||||
@@ -316,7 +296,7 @@
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Build Recipe
|
||||
App Components
|
||||
|
||||
</span>
|
||||
|
||||
@@ -339,126 +319,96 @@
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#summary" class="md-nav__link">
|
||||
<a href="#component-model" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Summary
|
||||
🗂️ Component model
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#0-query-the-registry" class="md-nav__link">
|
||||
<a href="#component-roles" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
0. Query the registry
|
||||
📦 Component roles
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="📦 Component roles">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#1-interfaces-the-edge" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
1. interfaces/ — the edge
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#2-domain-the-core" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
2. domain/ — the core
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#3-infra-the-adapters" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
3. infra/ — the adapters
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#4-pipelines-data-driven-families-optional" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
4. pipelines/ — data-driven families (optional)
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#5-workerpy-the-job-worker-optional" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
5. worker.py — the job worker (optional)
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#6-initpy-the-composition-root" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
6. init.py — the composition root
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#how-the-request-flows" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
🔗 How the request flows
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#1-scaffold-the-repository" class="md-nav__link">
|
||||
<a href="#related" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
1. Scaffold the repository
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#2-author-the-spec-app-specific" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
2. Author the spec (app-specific)
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#3-write-each-crud-slice-app-specific" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
3. Write each CRUD slice (app-specific)
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#4-wire-the-composition-root" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
4. Wire the composition root
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#5-add-routes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
5. Add routes
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#6-bootstrap-the-app-and-worker" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
6. Bootstrap the app and worker
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#7-add-a-pipeline-family-only-if-data-driven" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
7. Add a pipeline family (only if data-driven)
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#8-add-infrastructure-as-needed" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
8. Add infrastructure as needed
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#9-tests" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
9. Tests
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#10-scripts-and-seeds" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
10. Scripts and seeds
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#11-docs" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
11. Docs
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#definition-of-done" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Definition of done
|
||||
Related
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -472,6 +422,50 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../03_build_recipe/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Build Recipe
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../04_development/01_testing/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Testing & Quality
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
@@ -499,126 +493,96 @@
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#summary" class="md-nav__link">
|
||||
<a href="#component-model" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Summary
|
||||
🗂️ Component model
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#0-query-the-registry" class="md-nav__link">
|
||||
<a href="#component-roles" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
0. Query the registry
|
||||
📦 Component roles
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav class="md-nav" aria-label="📦 Component roles">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#1-interfaces-the-edge" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
1. interfaces/ — the edge
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#2-domain-the-core" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
2. domain/ — the core
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#3-infra-the-adapters" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
3. infra/ — the adapters
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#4-pipelines-data-driven-families-optional" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
4. pipelines/ — data-driven families (optional)
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#5-workerpy-the-job-worker-optional" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
5. worker.py — the job worker (optional)
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#6-initpy-the-composition-root" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
6. init.py — the composition root
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#how-the-request-flows" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
🔗 How the request flows
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#1-scaffold-the-repository" class="md-nav__link">
|
||||
<a href="#related" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
1. Scaffold the repository
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#2-author-the-spec-app-specific" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
2. Author the spec (app-specific)
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#3-write-each-crud-slice-app-specific" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
3. Write each CRUD slice (app-specific)
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#4-wire-the-composition-root" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
4. Wire the composition root
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#5-add-routes" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
5. Add routes
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#6-bootstrap-the-app-and-worker" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
6. Bootstrap the app and worker
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#7-add-a-pipeline-family-only-if-data-driven" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
7. Add a pipeline family (only if data-driven)
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#8-add-infrastructure-as-needed" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
8. Add infrastructure as needed
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#9-tests" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
9. Tests
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#10-scripts-and-seeds" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
10. Scripts and seeds
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#11-docs" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
11. Docs
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#definition-of-done" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Definition of done
|
||||
Related
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -640,60 +604,120 @@
|
||||
|
||||
|
||||
|
||||
<h1 id="build-recipe">Build Recipe</h1>
|
||||
<h2 id="summary">Summary</h2>
|
||||
<p>Follow this ordered checklist to generate a new application of the standard
|
||||
shape. Every step is deterministic; only steps 2 and 7 require app-specific
|
||||
authoring.</p>
|
||||
<h1 id="app-components">App Components</h1>
|
||||
<p>What ships in every standard app, and how the pieces relate. This is the
|
||||
blueprint's component model — <code>templates/app/</code> is a runnable instance of it.</p>
|
||||
<hr />
|
||||
<h2 id="0-query-the-registry">0. Query the registry</h2>
|
||||
<p>Before writing anything, read the <strong>library registry</strong> and note which internal
|
||||
libraries provide DB, DI, routing, ingestion, auth, and docs. Do not
|
||||
reimplement them.</p>
|
||||
<h2 id="1-scaffold-the-repository">1. Scaffold the repository</h2>
|
||||
<p>Copy the <code>templates/</code> skeleton. It provides: <code>pyproject.toml</code>, <code>openapi.yaml</code>,
|
||||
<code>main.py</code>, <code>init.py</code>, <code>worker.py</code>, <code>config.py</code>, <code>Dockerfile</code>,
|
||||
<code>docker-compose.yaml</code>, <code>.env.example</code>, and the package tree
|
||||
(<code>domain/ infra/ interfaces/ pipelines/ tests/ scripts/</code>).</p>
|
||||
<h2 id="2-author-the-spec-app-specific">2. Author the spec <em>(app-specific)</em></h2>
|
||||
<p>Write <code>openapi.yaml</code>: resources, schemas, <code>operationId</code>s, security, and any
|
||||
extension metadata. This is the contract.</p>
|
||||
<h2 id="3-write-each-crud-slice-app-specific">3. Write each CRUD slice <em>(app-specific)</em></h2>
|
||||
<p>For each resource, create the four-file slice (see <strong>CRUD Template</strong>):
|
||||
<code>models.py</code>, <code>ports/db.py</code>, <code>ports/service.py</code>, optional <code>converters.py</code>.</p>
|
||||
<h2 id="4-wire-the-composition-root">4. Wire the composition root</h2>
|
||||
<p>In <code>init.py</code>: build leaf repositories, then dependent repositories, then
|
||||
services; add infrastructure adaptors (cache store, progress bus, stores,
|
||||
fetchers). Add <code>get_svc</code> overloads.</p>
|
||||
<h2 id="5-add-routes">5. Add routes</h2>
|
||||
<p>Create <code>interfaces/<resource>/routes.py</code> (thin handlers) and re-export them in
|
||||
<code>interfaces/openapi.py</code>. Add a cache decorator to read endpoints.</p>
|
||||
<h2 id="6-bootstrap-the-app-and-worker">6. Bootstrap the app and worker</h2>
|
||||
<p>Confirm <code>main.py</code> wires the OpenAPI-first app with the lifespan. If the app has
|
||||
long-running jobs, adapt <code>worker.py</code> to poll the relevant job collection.</p>
|
||||
<h2 id="7-add-a-pipeline-family-only-if-data-driven">7. Add a pipeline family <em>(only if data-driven)</em></h2>
|
||||
<p>Create <code>pipelines/<family>/</code> with <code>abc.py</code>, <code>impl.py</code>, <code>pipeline.yaml</code>,
|
||||
<code>resources/</code>, and register the root in <code>registry.py</code>. Add fixtures and a parity
|
||||
test.</p>
|
||||
<h2 id="8-add-infrastructure-as-needed">8. Add infrastructure as needed</h2>
|
||||
<p>Only where the standard adaptors do not cover the need. Prefer library-backed
|
||||
adapters.</p>
|
||||
<h2 id="9-tests">9. Tests</h2>
|
||||
<p>Add integration tests with fakes and unit tests for domain/pipeline logic; add
|
||||
a config-consistency test if using rule-driven pipelines.</p>
|
||||
<h2 id="10-scripts-and-seeds">10. Scripts and seeds</h2>
|
||||
<p>Add operator scripts under <code>scripts/</code> that use <code>init()</code> / <code>get_svc()</code> /
|
||||
<code>shutdown()</code>.</p>
|
||||
<h2 id="11-docs">11. Docs</h2>
|
||||
<p>Author GSDFC docstrings, generate the type stubs (<code>.pyi</code>), mark the package
|
||||
<code>py.typed</code>, and build docs.</p>
|
||||
<h2 id="definition-of-done">Definition of done</h2>
|
||||
<h2 id="component-model">🗂️ Component model</h2>
|
||||
<pre class="mermaid"><code>flowchart LR
|
||||
subgraph EDGE["interfaces/ — HTTP edge"]
|
||||
OAS["openapi.yaml"]
|
||||
RU["resource routes"]
|
||||
JU["job routes"]
|
||||
end
|
||||
|
||||
subgraph CORE["domain/ — business core"]
|
||||
RI["<resource> · models · ports · services"]
|
||||
JI["<job/worker> · models · ports · services"]
|
||||
PI["pipelines/<family>"]
|
||||
end
|
||||
|
||||
subgraph INFRA["infra/ — adapters"]
|
||||
DB[("MongoDB repos")]
|
||||
CA["redis cache"]
|
||||
ST["stores · progress bus"]
|
||||
LL["llm clients"]
|
||||
end
|
||||
|
||||
W["worker.py"]
|
||||
CR["init.py — composition root"]
|
||||
|
||||
OAS --> RU
|
||||
OAS --> JU
|
||||
RU --> RI
|
||||
JU --> JI
|
||||
JI --> PI
|
||||
PI --> DB
|
||||
PI --> LL
|
||||
RI --> CA
|
||||
RI --> DB
|
||||
JI --> ST
|
||||
W --> JI
|
||||
W --> PI
|
||||
|
||||
CR === RU
|
||||
CR === JU
|
||||
CR === RI
|
||||
CR === JI
|
||||
CR === PI
|
||||
CR === W
|
||||
CR === DB
|
||||
CR === CA
|
||||
CR === ST</code></pre>
|
||||
<blockquote>
|
||||
<p><strong>Legend</strong> — solid arrows are direct calls; thick links are wires created by
|
||||
the composition root. Every component is injected, never self-constructed.</p>
|
||||
</blockquote>
|
||||
<hr />
|
||||
<h2 id="component-roles">📦 Component roles</h2>
|
||||
<h3 id="1-interfaces-the-edge">1. <code>interfaces/</code> — the edge</h3>
|
||||
<p>Thin handlers bound to <code>openapi.yaml</code> <code>operationId</code>s. They parse the request,
|
||||
call a service, and shape the response. No business rules, no I/O.</p>
|
||||
<ul>
|
||||
<li><code>python -c "import main"</code> succeeds.</li>
|
||||
<li><code>pytest</code> passes.</li>
|
||||
<li>The app serves the spec's operations; the worker drains its queue.</li>
|
||||
<li>No domain module imports a web framework.</li>
|
||||
<li>No infrastructure was reimplemented that a library already provides.</li>
|
||||
<li><code>interfaces/openapi.py</code> re-exports every route module so the OpenAPI-first
|
||||
app can resolve handlers.</li>
|
||||
<li>Routes may mount the <code>cache</code> decorator on read endpoints.</li>
|
||||
</ul>
|
||||
<h3 id="2-domain-the-core">2. <code>domain/</code> — the core</h3>
|
||||
<p>Pure models, <strong>ports</strong> (abstract contracts), and services (use cases). No
|
||||
framework imports, no drivers.</p>
|
||||
<ul>
|
||||
<li><code><aggregate>/models.py</code> — dataclasses, enums, document shapes.</li>
|
||||
<li><code><aggregate>/ports/db.py</code> — repo contract; <code><aggregate>/ports/service.py</code> —
|
||||
service contract.</li>
|
||||
<li>Services compose ports and enforce the business rules; the composition root
|
||||
injects the implementations.</li>
|
||||
</ul>
|
||||
<h3 id="3-infra-the-adapters">3. <code>infra/</code> — the adapters</h3>
|
||||
<p>Concrete implementations of the domain ports plus cross-cutting infrastructure:</p>
|
||||
<ul>
|
||||
<li><code>db/</code> — mongo-ops repositories and the connection lifecycle.</li>
|
||||
<li><code>adapters/</code> — cache store, progress bus, storages, fetchers (library-backed).</li>
|
||||
<li>Anything else the domain needs, implemented against its ports.</li>
|
||||
</ul>
|
||||
<h3 id="4-pipelines-data-driven-families-optional">4. <code>pipelines/</code> — data-driven families <em>(optional)</em></h3>
|
||||
<p>Extraction and enrichment families, each a deterministic step chain
|
||||
(<code>abc.py</code> / <code>impl.py</code> / <code>pipeline.yaml</code> / <code>resources/</code>). Roots are registered
|
||||
in the pattern registry and driven either by a worker job or a CLI.</p>
|
||||
<h3 id="5-workerpy-the-job-worker-optional">5. <code>worker.py</code> — the job worker <em>(optional)</em></h3>
|
||||
<p>A separate process that polls durable job collections, runs pipeline roots, and
|
||||
publishes progress to the progress bus. It shares the same composition root as
|
||||
the API.</p>
|
||||
<h3 id="6-initpy-the-composition-root">6. <code>init.py</code> — the composition root</h3>
|
||||
<p>The only place anything is constructed: leaf repositories → dependent
|
||||
repositories → services → adapters. Exposes <code>get_svc</code> overloads and starts /
|
||||
stops resources on the app lifespan.</p>
|
||||
<hr />
|
||||
<h2 id="how-the-request-flows">🔗 How the request flows</h2>
|
||||
<pre class="mermaid"><code>sequenceDiagram
|
||||
participant C as Client
|
||||
participant R as route (interfaces)
|
||||
participant S as service (domain)
|
||||
participant P as repo (infra)
|
||||
participant DB as MongoDB
|
||||
|
||||
C->>R: POST /items (operationId)
|
||||
R->>S: svc.create(payload)
|
||||
S->>P: repo.insert(doc)
|
||||
P->>DB: insert
|
||||
DB-->>P: ack
|
||||
P-->>S: doc
|
||||
S-->>R: result
|
||||
R-->>C: 200 JSON</code></pre>
|
||||
<hr />
|
||||
<h2 id="related">Related</h2>
|
||||
<ul>
|
||||
<li><a href="../01_overview/">01 – Overview</a> · <a href="../03_build_recipe/">03 – Build Recipe</a> · <a href="../04_development/01_testing/">04 – Testing & Quality</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -756,6 +780,8 @@ a config-consistency test if using rule-driven pipelines.</p>
|
||||
|
||||
<script src="../assets/javascripts/bundle.f55a23d4.min.js"></script>
|
||||
|
||||
<script src="https://unpkg.com/mermaid@10.9.1/dist/mermaid.min.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
794
standards/wiki/03_build_recipe/index.html
Normal file
794
standards/wiki/03_build_recipe/index.html
Normal file
@@ -0,0 +1,794 @@
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en" class="no-js">
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
|
||||
<meta name="description" content="The philosophy and prompts behind the standardized application blueprint.">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="prev" href="../02_components/">
|
||||
|
||||
|
||||
<link rel="next" href="../04_development/01_testing/">
|
||||
|
||||
|
||||
<link rel="icon" href="../assets/images/favicon.png">
|
||||
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.6.23">
|
||||
|
||||
|
||||
|
||||
<title>Build Recipe - Aetos Standards — Wiki</title>
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../assets/stylesheets/main.84d31ad4.min.css">
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../assets/stylesheets/palette.06af60db.min.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter:300,300i,400,400i,700,700i%7CJetBrains+Mono:400,400i,700,700i&display=fallback">
|
||||
<style>:root{--md-text-font:"Inter";--md-code-font:"JetBrains Mono"}</style>
|
||||
|
||||
|
||||
|
||||
<script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<body dir="ltr" data-md-color-scheme="slate" data-md-color-primary="deep-purple" data-md-color-accent="cyan">
|
||||
|
||||
|
||||
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
|
||||
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
|
||||
<label class="md-overlay" for="__drawer"></label>
|
||||
<div data-md-component="skip">
|
||||
|
||||
|
||||
<a href="#build-recipe" class="md-skip">
|
||||
Skip to content
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div data-md-component="announce">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<header class="md-header md-header--shadow" data-md-component="header">
|
||||
<nav class="md-header__inner md-grid" aria-label="Header">
|
||||
<a href=".." title="Aetos Standards — Wiki" class="md-header__button md-logo" aria-label="Aetos Standards — Wiki" data-md-component="logo">
|
||||
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
|
||||
|
||||
</a>
|
||||
<label class="md-header__button md-icon" for="__drawer">
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg>
|
||||
</label>
|
||||
<div class="md-header__title" data-md-component="header-title">
|
||||
<div class="md-header__ellipsis">
|
||||
<div class="md-header__topic">
|
||||
<span class="md-ellipsis">
|
||||
Aetos Standards — Wiki
|
||||
</span>
|
||||
</div>
|
||||
<div class="md-header__topic" data-md-component="header-topic">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Build Recipe
|
||||
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<form class="md-header__option" data-md-component="palette">
|
||||
|
||||
|
||||
|
||||
|
||||
<input class="md-option" data-md-color-media="" data-md-color-scheme="slate" data-md-color-primary="deep-purple" data-md-color-accent="cyan" aria-hidden="true" type="radio" name="__palette" id="__palette_0">
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
<script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-header__button md-icon" for="__search">
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
|
||||
</label>
|
||||
<div class="md-search" data-md-component="search" role="dialog">
|
||||
<label class="md-search__overlay" for="__search"></label>
|
||||
<div class="md-search__inner" role="search">
|
||||
<form class="md-search__form" name="search">
|
||||
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
|
||||
<label class="md-search__icon md-icon" for="__search">
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
|
||||
</label>
|
||||
<nav class="md-search__options" aria-label="Search">
|
||||
|
||||
<a href="javascript:void(0)" class="md-search__icon md-icon" title="Share" aria-label="Share" data-clipboard data-clipboard-text="" data-md-component="search-share" tabindex="-1">
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.15c-.05.21-.08.43-.08.66 0 1.61 1.31 2.91 2.92 2.91s2.92-1.3 2.92-2.91A2.92 2.92 0 0 0 18 16.08"/></svg>
|
||||
</a>
|
||||
|
||||
<button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
|
||||
</button>
|
||||
</nav>
|
||||
|
||||
<div class="md-search__suggest" data-md-component="search-suggest"></div>
|
||||
|
||||
</form>
|
||||
<div class="md-search__output">
|
||||
<div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
|
||||
<div class="md-search-result" data-md-component="search-result">
|
||||
<div class="md-search-result__meta">
|
||||
Initializing search
|
||||
</div>
|
||||
<ol class="md-search-result__list" role="presentation"></ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
</header>
|
||||
|
||||
<div class="md-container" data-md-component="container">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<main class="md-main" data-md-component="main">
|
||||
<div class="md-main__inner md-grid">
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href=".." title="Aetos Standards — Wiki" class="md-nav__button md-logo" aria-label="Aetos Standards — Wiki" data-md-component="logo">
|
||||
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
|
||||
|
||||
</a>
|
||||
Aetos Standards — Wiki
|
||||
</label>
|
||||
|
||||
<ul class="md-nav__list" data-md-scrollfix>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href=".." class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Home
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../01_overview/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Overview
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../02_components/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
App Components
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item md-nav__item--active">
|
||||
|
||||
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__link md-nav__link--active" for="__toc">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Build Recipe
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
</label>
|
||||
|
||||
<a href="./" class="md-nav__link md-nav__link--active">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Build Recipe
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#quick-start" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
🚀 Quick start
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#agent-prompt-copyable" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
📋 Agent prompt (copyable)
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#where-the-steps-land" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
🧭 Where the steps land
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#definition-of-done" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
⚠️ Definition of done
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#related" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Related
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../04_development/01_testing/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Testing & Quality
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
|
||||
<div class="md-sidebar__scrollwrap">
|
||||
<div class="md-sidebar__inner">
|
||||
|
||||
|
||||
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<label class="md-nav__title" for="__toc">
|
||||
<span class="md-nav__icon md-icon"></span>
|
||||
Table of contents
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#quick-start" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
🚀 Quick start
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#agent-prompt-copyable" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
📋 Agent prompt (copyable)
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#where-the-steps-land" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
🧭 Where the steps land
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#definition-of-done" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
⚠️ Definition of done
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#related" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Related
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="md-content" data-md-component="content">
|
||||
<article class="md-content__inner md-typeset">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h1 id="build-recipe">Build Recipe</h1>
|
||||
<p>The ordered, deterministic checklist for generating a new application of the
|
||||
standard shape. Every step is fixed; only steps 2 and 3 need app-specific
|
||||
authoring. Give an AI agent the copyable prompt below (or read it from the
|
||||
<code>standards</code> MCP bundle as <code>doc://modules/build_recipe</code>) and it can produce a
|
||||
complete app in one pass.</p>
|
||||
<hr />
|
||||
<h2 id="quick-start">🚀 Quick start</h2>
|
||||
<div class="language-bash highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1">1</a></span>
|
||||
<span class="normal"><a href="#__codelineno-0-2">2</a></span>
|
||||
<span class="normal"><a href="#__codelineno-0-3">3</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1"></a><span class="c1"># Copy the runnable skeleton (from the standards docs checkout)</span>
|
||||
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2"></a>cp<span class="w"> </span>-r<span class="w"> </span><docs>/standards/src/templates/app<span class="w"> </span>apps/<your-app>
|
||||
</span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3"></a><span class="nb">cd</span><span class="w"> </span>apps/<your-app>
|
||||
</span></code></pre></div></td></tr></table></div>
|
||||
<p>Then follow the numbered steps in the prompt.</p>
|
||||
<hr />
|
||||
<h2 id="agent-prompt-copyable">📋 Agent prompt (copyable)</h2>
|
||||
<div class="language-markdown highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-1-1"> 1</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-2"> 2</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-3"> 3</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-4"> 4</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-5"> 5</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-6"> 6</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-7"> 7</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-8"> 8</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-9"> 9</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-10">10</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-11">11</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-12">12</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-13">13</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-14">14</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-15">15</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-16">16</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-17">17</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-18">18</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-19">19</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-20">20</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-21">21</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-22">22</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-23">23</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-24">24</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-25">25</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-26">26</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-27">27</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-28">28</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-29">29</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-30">30</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-31">31</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-32">32</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-33">33</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-34">34</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-35">35</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-36">36</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-37">37</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-38">38</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-39">39</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-40">40</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-41">41</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-42">42</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-43">43</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-44">44</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-45">45</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-46">46</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-47">47</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-48">48</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-49">49</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-50">50</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-51">51</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-52">52</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-53">53</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-54">54</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-55">55</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-56">56</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-57">57</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-58">58</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-59">59</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-60">60</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-61">61</a></span>
|
||||
<span class="normal"><a href="#__codelineno-1-62">62</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-1-1"><a id="__codelineno-1-1" name="__codelineno-1-1"></a><span class="gh"># Build a new application from the Aetos Standards blueprint</span>
|
||||
</span><span id="__span-1-2"><a id="__codelineno-1-2" name="__codelineno-1-2"></a>
|
||||
</span><span id="__span-1-3"><a id="__codelineno-1-3" name="__codelineno-1-3"></a>You are coding a complete new backend application conforming to the Aetos
|
||||
</span><span id="__span-1-4"><a id="__codelineno-1-4" name="__codelineno-1-4"></a>standard app blueprint. Execute every step in order. Only steps 2 and 3 use the
|
||||
</span><span id="__span-1-5"><a id="__codelineno-1-5" name="__codelineno-1-5"></a>app-specific details provided by the user; everything else is deterministic.
|
||||
</span><span id="__span-1-6"><a id="__codelineno-1-6" name="__codelineno-1-6"></a>
|
||||
</span><span id="__span-1-7"><a id="__codelineno-1-7" name="__codelineno-1-7"></a>Before writing any code, connect to the <span class="sb">`standards`</span> MCP server and read:
|
||||
</span><span id="__span-1-8"><a id="__codelineno-1-8" name="__codelineno-1-8"></a><span class="k">-</span><span class="w"> </span><span class="sb">`doc://nav`</span> (the module list)
|
||||
</span><span id="__span-1-9"><a id="__codelineno-1-9" name="__codelineno-1-9"></a><span class="k">-</span><span class="w"> </span><span class="sb">`doc://modules/layering_rules`</span> (the dependency rules)
|
||||
</span><span id="__span-1-10"><a id="__codelineno-1-10" name="__codelineno-1-10"></a><span class="k">-</span><span class="w"> </span><span class="sb">`doc://modules/genericity_matrix`</span> (what is generic vs app-specific)
|
||||
</span><span id="__span-1-11"><a id="__codelineno-1-11" name="__codelineno-1-11"></a>Then call <span class="sb">`find_library`</span> with capabilities like <span class="sb">`db`</span>, <span class="sb">`di`</span>, <span class="sb">`routing`</span>,
|
||||
</span><span id="__span-1-12"><a id="__codelineno-1-12" name="__codelineno-1-12"></a><span class="sb">`ingestion`</span>, <span class="sb">`auth`</span>, <span class="sb">`docs`</span>, <span class="sb">`pipeline`</span>, and note the libraries that already
|
||||
</span><span id="__span-1-13"><a id="__codelineno-1-13" name="__codelineno-1-13"></a>exist. Never reimplement one.
|
||||
</span><span id="__span-1-14"><a id="__codelineno-1-14" name="__codelineno-1-14"></a>
|
||||
</span><span id="__span-1-15"><a id="__codelineno-1-15" name="__codelineno-1-15"></a><span class="k">1.</span> <span class="gs">**Scaffold**</span> — copy <span class="sb">`src/templates/app/`</span> into <span class="sb">`apps/<your-app>/`</span>. Keep the
|
||||
</span><span id="__span-1-16"><a id="__codelineno-1-16" name="__codelineno-1-16"></a> package tree: <span class="sb">`domain/`</span>, <span class="sb">`infra/`</span>, <span class="sb">`interfaces/`</span>, <span class="sb">`pipelines/`</span>, <span class="sb">`tests/`</span>,
|
||||
</span><span id="__span-1-17"><a id="__codelineno-1-17" name="__codelineno-1-17"></a> <span class="sb">`scripts/`</span>, plus <span class="sb">`pyproject.toml`</span>, <span class="sb">`openapi.yaml`</span>, <span class="sb">`config.py`</span>, <span class="sb">`init.py`</span>,
|
||||
</span><span id="__span-1-18"><a id="__codelineno-1-18" name="__codelineno-1-18"></a> <span class="sb">`main.py`</span>, <span class="sb">`worker.py`</span>, <span class="sb">`Dockerfile`</span>, <span class="sb">`docker-compose.yaml`</span>, <span class="sb">`.env.example`</span>.
|
||||
</span><span id="__span-1-19"><a id="__codelineno-1-19" name="__codelineno-1-19"></a>
|
||||
</span><span id="__span-1-20"><a id="__codelineno-1-20" name="__codelineno-1-20"></a><span class="k">2.</span> <span class="gs">**Author the spec (app-specific)**</span> — write <span class="sb">`openapi.yaml`</span>: resources,
|
||||
</span><span id="__span-1-21"><a id="__codelineno-1-21" name="__codelineno-1-21"></a> schemas, <span class="sb">`operationId`</span>s, security, and extension metadata. This is the
|
||||
</span><span id="__span-1-22"><a id="__codelineno-1-22" name="__codelineno-1-22"></a> contract and drives all routing.
|
||||
</span><span id="__span-1-23"><a id="__codelineno-1-23" name="__codelineno-1-23"></a>
|
||||
</span><span id="__span-1-24"><a id="__codelineno-1-24" name="__codelineno-1-24"></a><span class="k">3.</span> <span class="gs">**Write each CRUD slice (app-specific)**</span> — per resource create the
|
||||
</span><span id="__span-1-25"><a id="__codelineno-1-25" name="__codelineno-1-25"></a> four-file slice: <span class="sb">`models.py`</span>, <span class="sb">`ports/db.py`</span>, <span class="sb">`ports/service.py`</span>, and
|
||||
</span><span id="__span-1-26"><a id="__codelineno-1-26" name="__codelineno-1-26"></a> optional <span class="sb">`converters.py`</span>. Follow the CRUD template.
|
||||
</span><span id="__span-1-27"><a id="__codelineno-1-27" name="__codelineno-1-27"></a>
|
||||
</span><span id="__span-1-28"><a id="__codelineno-1-28" name="__codelineno-1-28"></a><span class="k">4.</span> <span class="gs">**Wire the composition root**</span> — in <span class="sb">`init.py`</span>, build leaf repositories, then
|
||||
</span><span id="__span-1-29"><a id="__codelineno-1-29" name="__codelineno-1-29"></a> dependent repositories, then services; add infra adapters (db, cache,
|
||||
</span><span id="__span-1-30"><a id="__codelineno-1-30" name="__codelineno-1-30"></a> stores, progress bus, fetchers). Expose <span class="sb">`get_svc`</span> overloads.
|
||||
</span><span id="__span-1-31"><a id="__codelineno-1-31" name="__codelineno-1-31"></a>
|
||||
</span><span id="__span-1-32"><a id="__codelineno-1-32" name="__codelineno-1-32"></a><span class="k">5.</span> <span class="gs">**Add routes**</span> — create <span class="sb">`interfaces/<resource>/routes.py`</span> thin handlers
|
||||
</span><span id="__span-1-33"><a id="__codelineno-1-33" name="__codelineno-1-33"></a> bound to <span class="sb">`operationId`</span>s and re-export them in <span class="sb">`interfaces/openapi.py`</span>. Add
|
||||
</span><span id="__span-1-34"><a id="__codelineno-1-34" name="__codelineno-1-34"></a> the cache decorator to read endpoints.
|
||||
</span><span id="__span-1-35"><a id="__codelineno-1-35" name="__codelineno-1-35"></a>
|
||||
</span><span id="__span-1-36"><a id="__codelineno-1-36" name="__codelineno-1-36"></a><span class="k">6.</span> <span class="gs">**Bootstrap app and worker**</span> — confirm <span class="sb">`main.py`</span> runs the OpenAPI-first app
|
||||
</span><span id="__span-1-37"><a id="__codelineno-1-37" name="__codelineno-1-37"></a> with its lifespan. If the app has long-running jobs, adapt <span class="sb">`worker.py`</span> to
|
||||
</span><span id="__span-1-38"><a id="__codelineno-1-38" name="__codelineno-1-38"></a> poll the job collection, run the pipeline, and publish progress.
|
||||
</span><span id="__span-1-39"><a id="__codelineno-1-39" name="__codelineno-1-39"></a>
|
||||
</span><span id="__span-1-40"><a id="__codelineno-1-40" name="__codelineno-1-40"></a><span class="k">7.</span> <span class="gs">**Add pipeline families (only if data-driven)**</span> — create
|
||||
</span><span id="__span-1-41"><a id="__codelineno-1-41" name="__codelineno-1-41"></a> <span class="sb">`pipelines/<family>/`</span> with <span class="sb">`abc.py`</span>, <span class="sb">`impl.py`</span>, <span class="sb">`pipeline.yaml`</span>,
|
||||
</span><span id="__span-1-42"><a id="__codelineno-1-42" name="__codelineno-1-42"></a> <span class="sb">`resources/`</span>, and register the root. Add fixtures and a parity test.
|
||||
</span><span id="__span-1-43"><a id="__codelineno-1-43" name="__codelineno-1-43"></a>
|
||||
</span><span id="__span-1-44"><a id="__codelineno-1-44" name="__codelineno-1-44"></a><span class="k">8.</span> <span class="gs">**Add infrastructure only where needed**</span> — prefer a library-backed adapter.
|
||||
</span><span id="__span-1-45"><a id="__codelineno-1-45" name="__codelineno-1-45"></a> Never hand-write what an internal library already provides.
|
||||
</span><span id="__span-1-46"><a id="__codelineno-1-46" name="__codelineno-1-46"></a>
|
||||
</span><span id="__span-1-47"><a id="__codelineno-1-47" name="__codelineno-1-47"></a><span class="k">9.</span> <span class="gs">**Tests**</span> — integration tests with fakes at the HTTP edge; unit tests for
|
||||
</span><span id="__span-1-48"><a id="__codelineno-1-48" name="__codelineno-1-48"></a> domain and pipeline logic; a config-consistency test for rule-driven
|
||||
</span><span id="__span-1-49"><a id="__codelineno-1-49" name="__codelineno-1-49"></a> pipelines.
|
||||
</span><span id="__span-1-50"><a id="__codelineno-1-50" name="__codelineno-1-50"></a>
|
||||
</span><span id="__span-1-51"><a id="__codelineno-1-51" name="__codelineno-1-51"></a><span class="k">10.</span> <span class="gs">**Scripts and seeds**</span> — operator scripts under <span class="sb">`scripts/`</span> using
|
||||
</span><span id="__span-1-52"><a id="__codelineno-1-52" name="__codelineno-1-52"></a> <span class="sb">`init()`</span> / <span class="sb">`get_svc()`</span> / <span class="sb">`shutdown()`</span>.
|
||||
</span><span id="__span-1-53"><a id="__codelineno-1-53" name="__codelineno-1-53"></a>
|
||||
</span><span id="__span-1-54"><a id="__codelineno-1-54" name="__codelineno-1-54"></a><span class="k">11.</span> <span class="gs">**Docs**</span> — author GSDFC docstrings, generate <span class="sb">`.pyi`</span> stubs, mark the package
|
||||
</span><span id="__span-1-55"><a id="__codelineno-1-55" name="__codelineno-1-55"></a> <span class="sb">`py.typed`</span>, and build the docs.
|
||||
</span><span id="__span-1-56"><a id="__codelineno-1-56" name="__codelineno-1-56"></a>
|
||||
</span><span id="__span-1-57"><a id="__codelineno-1-57" name="__codelineno-1-57"></a><span class="gs">**Definition of done:**</span>
|
||||
</span><span id="__span-1-58"><a id="__codelineno-1-58" name="__codelineno-1-58"></a><span class="k">-</span><span class="w"> </span><span class="sb">`python -c "import main"`</span> succeeds.
|
||||
</span><span id="__span-1-59"><a id="__codelineno-1-59" name="__codelineno-1-59"></a><span class="k">-</span><span class="w"> </span><span class="sb">`pytest`</span> passes.
|
||||
</span><span id="__span-1-60"><a id="__codelineno-1-60" name="__codelineno-1-60"></a><span class="k">-</span><span class="w"> </span>The app serves every operation in the spec; the worker drains its queue.
|
||||
</span><span id="__span-1-61"><a id="__codelineno-1-61" name="__codelineno-1-61"></a><span class="k">-</span><span class="w"> </span>No domain module imports a web framework.
|
||||
</span><span id="__span-1-62"><a id="__codelineno-1-62" name="__codelineno-1-62"></a><span class="k">-</span><span class="w"> </span>No infrastructure was reimplemented that a library already provides.
|
||||
</span></code></pre></div></td></tr></table></div>
|
||||
<hr />
|
||||
<h2 id="where-the-steps-land">🧭 Where the steps land</h2>
|
||||
<p>The steps map onto the layers as follows:</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Step</th>
|
||||
<th>Package / file</th>
|
||||
<th>Depends on</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1 · Scaffold</td>
|
||||
<td>whole <code>templates/app/</code></td>
|
||||
<td>—</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2 · Spec</td>
|
||||
<td><code>openapi.yaml</code></td>
|
||||
<td>—</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3 · CRUD slices</td>
|
||||
<td><code>domain/<resource>/</code></td>
|
||||
<td>spec, CRUD template</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>4 · Wiring</td>
|
||||
<td><code>init.py</code></td>
|
||||
<td>every slice</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>5 · Routes</td>
|
||||
<td><code>interfaces/<resource>/</code></td>
|
||||
<td>services, openapi route registry</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>6 · Bootstrap</td>
|
||||
<td><code>main.py</code>, <code>worker.py</code></td>
|
||||
<td>composition root</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>7 · Pipelines</td>
|
||||
<td><code>pipelines/<family>/</code></td>
|
||||
<td>library pipeline engine</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8 · Infra</td>
|
||||
<td><code>infra/</code></td>
|
||||
<td>domain ports</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>9 · Tests</td>
|
||||
<td><code>tests/</code></td>
|
||||
<td>app + fixtures</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>10 · Scripts</td>
|
||||
<td><code>scripts/</code></td>
|
||||
<td>composition root</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11 · Docs</td>
|
||||
<td>docstrings + docs build</td>
|
||||
<td>code, Doc Forge</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
<h2 id="definition-of-done">⚠️ Definition of done</h2>
|
||||
<ul>
|
||||
<li><code>python -c "import main"</code> succeeds.</li>
|
||||
<li><code>pytest</code> passes.</li>
|
||||
<li>The app serves the spec's operations; the worker drains its queue.</li>
|
||||
<li>No domain module imports a web framework.</li>
|
||||
<li>No infrastructure was reimplemented that a library already provides.</li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h2 id="related">Related</h2>
|
||||
<ul>
|
||||
<li><a href="../01_overview/">01 – Overview</a> · <a href="../02_components/">02 – App Components</a> · <a href="../04_development/01_testing/">04 – Testing & Quality</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
</div>
|
||||
|
||||
|
||||
<script>var tabs=__md_get("__tabs");if(Array.isArray(tabs))e:for(var set of document.querySelectorAll(".tabbed-set")){var labels=set.querySelector(".tabbed-labels");for(var tab of tabs)for(var label of labels.getElementsByTagName("label"))if(label.innerText.trim()===tab){var input=document.getElementById(label.htmlFor);input.checked=!0;continue e}}</script>
|
||||
|
||||
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
|
||||
</div>
|
||||
|
||||
<button type="button" class="md-top md-icon" data-md-component="top" hidden>
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8z"/></svg>
|
||||
Back to top
|
||||
</button>
|
||||
|
||||
</main>
|
||||
|
||||
<footer class="md-footer">
|
||||
|
||||
<div class="md-footer-meta md-typeset">
|
||||
<div class="md-footer-meta__inner md-grid">
|
||||
<div class="md-copyright">
|
||||
|
||||
|
||||
Made with
|
||||
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
|
||||
Material for MkDocs
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
<div class="md-dialog" data-md-component="dialog">
|
||||
<div class="md-dialog__inner md-typeset"></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"base": "..", "features": ["navigation.sections", "navigation.expand", "navigation.top", "navigation.instant", "navigation.tracking", "navigation.indexes", "content.code.copy", "content.code.annotate", "content.tabs.link", "content.action.edit", "search.highlight", "search.share", "search.suggest"], "search": "../assets/javascripts/workers/search.973d3a69.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
<script src="../assets/javascripts/bundle.f55a23d4.min.js"></script>
|
||||
|
||||
<script src="https://unpkg.com/mermaid@10.9.1/dist/mermaid.min.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -11,25 +11,23 @@
|
||||
|
||||
|
||||
|
||||
<link rel="prev" href="../01_overview/">
|
||||
<link rel="prev" href="../../03_build_recipe/">
|
||||
|
||||
|
||||
<link rel="next" href="../11_build_recipe/">
|
||||
|
||||
|
||||
<link rel="icon" href="../assets/images/favicon.png">
|
||||
<link rel="icon" href="../../assets/images/favicon.png">
|
||||
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.6.23">
|
||||
|
||||
|
||||
|
||||
<title>Testing - Aetos Standards — Wiki</title>
|
||||
<title>Testing & Quality - Aetos Standards — Wiki</title>
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../assets/stylesheets/main.84d31ad4.min.css">
|
||||
<link rel="stylesheet" href="../../assets/stylesheets/main.84d31ad4.min.css">
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../assets/stylesheets/palette.06af60db.min.css">
|
||||
<link rel="stylesheet" href="../../assets/stylesheets/palette.06af60db.min.css">
|
||||
|
||||
|
||||
|
||||
@@ -48,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
|
||||
<script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
|
||||
|
||||
|
||||
|
||||
@@ -74,7 +72,7 @@
|
||||
<div data-md-component="skip">
|
||||
|
||||
|
||||
<a href="#testing" class="md-skip">
|
||||
<a href="#testing-quality-gates" class="md-skip">
|
||||
Skip to content
|
||||
</a>
|
||||
|
||||
@@ -90,7 +88,7 @@
|
||||
|
||||
<header class="md-header md-header--shadow" data-md-component="header">
|
||||
<nav class="md-header__inner md-grid" aria-label="Header">
|
||||
<a href=".." title="Aetos Standards — Wiki" class="md-header__button md-logo" aria-label="Aetos Standards — Wiki" data-md-component="logo">
|
||||
<a href="../.." title="Aetos Standards — Wiki" class="md-header__button md-logo" aria-label="Aetos Standards — Wiki" data-md-component="logo">
|
||||
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
|
||||
@@ -110,7 +108,7 @@
|
||||
<div class="md-header__topic" data-md-component="header-topic">
|
||||
<span class="md-ellipsis">
|
||||
|
||||
Testing
|
||||
Testing & Quality
|
||||
|
||||
</span>
|
||||
</div>
|
||||
@@ -207,7 +205,7 @@
|
||||
|
||||
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
|
||||
<label class="md-nav__title" for="__drawer">
|
||||
<a href=".." title="Aetos Standards — Wiki" class="md-nav__button md-logo" aria-label="Aetos Standards — Wiki" data-md-component="logo">
|
||||
<a href="../.." title="Aetos Standards — Wiki" class="md-nav__button md-logo" aria-label="Aetos Standards — Wiki" data-md-component="logo">
|
||||
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
|
||||
@@ -225,7 +223,7 @@
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href=".." class="md-nav__link">
|
||||
<a href="../.." class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
@@ -247,7 +245,7 @@
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../01_overview/" class="md-nav__link">
|
||||
<a href="../../01_overview/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
@@ -266,6 +264,50 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../02_components/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
App Components
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../03_build_recipe/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Build Recipe
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -283,7 +325,7 @@
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Testing
|
||||
Testing & Quality
|
||||
|
||||
</span>
|
||||
|
||||
@@ -296,7 +338,7 @@
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Testing
|
||||
Testing & Quality
|
||||
|
||||
</span>
|
||||
|
||||
@@ -318,19 +360,10 @@
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#summary" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Summary
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#layout" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Layout
|
||||
🗂️ Layout
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -339,7 +372,7 @@
|
||||
<li class="md-nav__item">
|
||||
<a href="#integration-tests" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Integration tests
|
||||
🚀 Integration tests
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -348,7 +381,7 @@
|
||||
<li class="md-nav__item">
|
||||
<a href="#unit-tests" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Unit tests
|
||||
🧪 Unit tests
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -357,7 +390,16 @@
|
||||
<li class="md-nav__item">
|
||||
<a href="#config-consistency-tests" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Config-consistency tests
|
||||
🔐 Config-consistency tests
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#quality-gates" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
✅ Quality gates
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -366,7 +408,16 @@
|
||||
<li class="md-nav__item">
|
||||
<a href="#conventions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Conventions
|
||||
💡 Conventions
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#related" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Related
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -380,28 +431,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../11_build_recipe/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Build Recipe
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
@@ -428,19 +457,10 @@
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#summary" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Summary
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#layout" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Layout
|
||||
🗂️ Layout
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -449,7 +469,7 @@
|
||||
<li class="md-nav__item">
|
||||
<a href="#integration-tests" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Integration tests
|
||||
🚀 Integration tests
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -458,7 +478,7 @@
|
||||
<li class="md-nav__item">
|
||||
<a href="#unit-tests" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Unit tests
|
||||
🧪 Unit tests
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -467,7 +487,16 @@
|
||||
<li class="md-nav__item">
|
||||
<a href="#config-consistency-tests" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Config-consistency tests
|
||||
🔐 Config-consistency tests
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#quality-gates" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
✅ Quality gates
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -476,7 +505,16 @@
|
||||
<li class="md-nav__item">
|
||||
<a href="#conventions" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Conventions
|
||||
💡 Conventions
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#related" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
Related
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -498,12 +536,12 @@
|
||||
|
||||
|
||||
|
||||
<h1 id="testing">Testing</h1>
|
||||
<h2 id="summary">Summary</h2>
|
||||
<p>Two test suites: <strong>integration</strong> (the HTTP edge with fakes) and <strong>unit</strong> (pure
|
||||
domain and pipeline logic). Both run under pytest with asyncio auto mode.</p>
|
||||
<h1 id="testing-quality-gates">Testing & Quality Gates</h1>
|
||||
<p>Two suites run under pytest with asyncio auto mode: <strong>integration</strong> (the HTTP
|
||||
edge against fakes) and <strong>unit</strong> (pure domain and pipeline logic). Finish a
|
||||
blueprint app only when every gate below passes.</p>
|
||||
<hr />
|
||||
<h2 id="layout">Layout</h2>
|
||||
<h2 id="layout">🗂️ Layout</h2>
|
||||
<div class="language-text highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1">1</a></span>
|
||||
<span class="normal"><a href="#__codelineno-0-2">2</a></span>
|
||||
<span class="normal"><a href="#__codelineno-0-3">3</a></span>
|
||||
@@ -512,7 +550,8 @@ domain and pipeline logic). Both run under pytest with asyncio auto mode.</p>
|
||||
</span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3"></a> unit/ # models, converters, pipeline stages/roots
|
||||
</span><span id="__span-0-4"><a id="__codelineno-0-4" name="__codelineno-0-4"></a> conftest.py # fixtures
|
||||
</span></code></pre></div></td></tr></table></div>
|
||||
<h2 id="integration-tests">Integration tests</h2>
|
||||
<hr />
|
||||
<h2 id="integration-tests">🚀 Integration tests</h2>
|
||||
<ul>
|
||||
<li>Build the app with <code>TestClient</code>.</li>
|
||||
<li>Replace <code>app.state.resources</code> with fake repositories/services so no database
|
||||
@@ -534,24 +573,42 @@ domain and pipeline logic). Both run under pytest with asyncio auto mode.</p>
|
||||
</span><span id="__span-1-5"><a id="__codelineno-1-5" name="__codelineno-1-5"></a> <span class="n">r</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s2">"/items"</span><span class="p">,</span> <span class="n">json</span><span class="o">=</span><span class="p">{</span><span class="s2">"name"</span><span class="p">:</span> <span class="s2">"x"</span><span class="p">})</span>
|
||||
</span><span id="__span-1-6"><a id="__codelineno-1-6" name="__codelineno-1-6"></a> <span class="k">assert</span> <span class="n">r</span><span class="o">.</span><span class="n">status_code</span> <span class="o">==</span> <span class="mi">200</span>
|
||||
</span></code></pre></div></td></tr></table></div>
|
||||
<h2 id="unit-tests">Unit tests</h2>
|
||||
<hr />
|
||||
<h2 id="unit-tests">🧪 Unit tests</h2>
|
||||
<ul>
|
||||
<li>Domain models and converters: pure, no I/O.</li>
|
||||
<li>Pipeline stages: feed a fixture state, assert the transformed state.</li>
|
||||
<li>Assembled pipeline roots: <strong>fixture parity</strong> — replay a stored fixture input
|
||||
and compare against a golden output file.</li>
|
||||
</ul>
|
||||
<h2 id="config-consistency-tests">Config-consistency tests</h2>
|
||||
<hr />
|
||||
<h2 id="config-consistency-tests">🔐 Config-consistency tests</h2>
|
||||
<p>For rule-driven pipelines, add a test that cross-references rules against the
|
||||
declared pattern registry: every flag emitted must be defined; every defined
|
||||
flag must be reachable. This catches drift without running the pipeline.</p>
|
||||
<h2 id="conventions">Conventions</h2>
|
||||
<hr />
|
||||
<h2 id="quality-gates">✅ Quality gates</h2>
|
||||
<p>A <strong>definition of done</strong> for any standard app:</p>
|
||||
<ul>
|
||||
<li><code>python -c "import main"</code> succeeds.</li>
|
||||
<li><code>pytest</code> passes.</li>
|
||||
<li>The app serves the spec's operations; the worker drains its queue.</li>
|
||||
<li>No domain module imports a web framework.</li>
|
||||
<li>No infrastructure was reimplemented that a library already provides.</li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h2 id="conventions">💡 Conventions</h2>
|
||||
<ul>
|
||||
<li><code>asyncio_mode = "auto"</code>; no manual event loops.</li>
|
||||
<li>Fixtures are checked into the repo (inputs + golden outputs).</li>
|
||||
<li>Tests skip (not fail) when a required fixture is absent.</li>
|
||||
<li>Do not mock the domain; mock only the infrastructure edge.</li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h2 id="related">Related</h2>
|
||||
<ul>
|
||||
<li><a href="02_components.md">02 – App Components</a> · <a href="03_build_recipe.md">03 – Build Recipe</a> · <a href="../../01_overview/">Overview</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
@@ -608,10 +665,12 @@ flag must be reachable. This catches drift without running the pipeline.</p>
|
||||
|
||||
|
||||
|
||||
<script id="__config" type="application/json">{"base": "..", "features": ["navigation.sections", "navigation.expand", "navigation.top", "navigation.instant", "navigation.tracking", "navigation.indexes", "content.code.copy", "content.code.annotate", "content.tabs.link", "content.action.edit", "search.highlight", "search.share", "search.suggest"], "search": "../assets/javascripts/workers/search.973d3a69.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
<script id="__config" type="application/json">{"base": "../..", "features": ["navigation.sections", "navigation.expand", "navigation.top", "navigation.instant", "navigation.tracking", "navigation.indexes", "content.code.copy", "content.code.annotate", "content.tabs.link", "content.action.edit", "search.highlight", "search.share", "search.suggest"], "search": "../../assets/javascripts/workers/search.973d3a69.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
|
||||
|
||||
|
||||
<script src="../assets/javascripts/bundle.f55a23d4.min.js"></script>
|
||||
<script src="../../assets/javascripts/bundle.f55a23d4.min.js"></script>
|
||||
|
||||
<script src="https://unpkg.com/mermaid@10.9.1/dist/mermaid.min.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
@@ -260,12 +260,12 @@
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="/10_testing/" class="md-nav__link">
|
||||
<a href="/02_components/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Testing
|
||||
App Components
|
||||
|
||||
</span>
|
||||
|
||||
@@ -282,7 +282,7 @@
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="/11_build_recipe/" class="md-nav__link">
|
||||
<a href="/03_build_recipe/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
@@ -297,6 +297,28 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="/04_development/01_testing/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Testing & Quality
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
@@ -375,6 +397,8 @@
|
||||
|
||||
<script src="/assets/javascripts/bundle.f55a23d4.min.js"></script>
|
||||
|
||||
<script src="https://unpkg.com/mermaid@10.9.1/dist/mermaid.min.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -72,7 +72,7 @@
|
||||
<div data-md-component="skip">
|
||||
|
||||
|
||||
<a href="#the-aetos-standard-app-blueprint" class="md-skip">
|
||||
<a href="#standards-the-aetos-app-blueprint" class="md-skip">
|
||||
Skip to content
|
||||
</a>
|
||||
|
||||
@@ -273,18 +273,27 @@
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#how-to-read-this" class="md-nav__link">
|
||||
<a href="#key-features" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
How to read this
|
||||
🚀 Key Features
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#for-ai-agents" class="md-nav__link">
|
||||
<a href="#documentation-structure" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
For AI agents
|
||||
📁 Documentation Structure
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#related-resources" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
🔗 Related Resources
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -327,12 +336,12 @@
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="10_testing/" class="md-nav__link">
|
||||
<a href="02_components/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Testing
|
||||
App Components
|
||||
|
||||
</span>
|
||||
|
||||
@@ -349,7 +358,7 @@
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="11_build_recipe/" class="md-nav__link">
|
||||
<a href="03_build_recipe/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
@@ -364,6 +373,28 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="04_development/01_testing/" class="md-nav__link">
|
||||
|
||||
|
||||
|
||||
<span class="md-ellipsis">
|
||||
Testing & Quality
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
@@ -391,18 +422,27 @@
|
||||
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#how-to-read-this" class="md-nav__link">
|
||||
<a href="#key-features" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
How to read this
|
||||
🚀 Key Features
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#for-ai-agents" class="md-nav__link">
|
||||
<a href="#documentation-structure" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
For AI agents
|
||||
📁 Documentation Structure
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#related-resources" class="md-nav__link">
|
||||
<span class="md-ellipsis">
|
||||
🔗 Related Resources
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -424,92 +464,85 @@
|
||||
|
||||
|
||||
|
||||
<h1 id="the-aetos-standard-app-blueprint">The Aetos Standard App Blueprint</h1>
|
||||
<p>A single, reusable architecture for backend applications in the Aetos ecosystem.</p>
|
||||
<p>Every application built with this blueprint has the same shape:</p>
|
||||
<ul>
|
||||
<li>a <strong>spec-first HTTP layer</strong> driven by an OpenAPI document;</li>
|
||||
<li>a <strong>domain layer</strong> of pure models, ports, and services;</li>
|
||||
<li>an <strong>infrastructure layer</strong> of adapters (MongoDB, cache, workers, LLM, mail);</li>
|
||||
<li>a <strong>composition root</strong> that wires everything in exactly one place;</li>
|
||||
<li>an optional <strong>pipeline layer</strong> for data-driven extraction/enrichment;</li>
|
||||
<li>an optional <strong>background worker</strong> that runs long-running jobs and reports progress.</li>
|
||||
</ul>
|
||||
<h1 id="standards-the-aetos-app-blueprint">🧩 Standards — the Aetos App Blueprint</h1>
|
||||
<p>One reusable architecture for every backend application in the Aetos ecosystem:
|
||||
a spec-first HTTP edge, a pure domain core, a pluggable infrastructure layer,
|
||||
and a single composition root.</p>
|
||||
<p>Fill in <strong>two axes only</strong> and a new app is done: your <strong>resource model</strong>, and
|
||||
(if needed) your <strong>pipeline family</strong>. The blueprint itself never names a
|
||||
business domain — expenses, health metrics, inventory, and analytics are all
|
||||
the same shape underneath.</p>
|
||||
<blockquote>
|
||||
<p>This blueprints is deliberately <strong>app-agnostic</strong>. It never names a concrete
|
||||
business domain. Any application — expenses, health metrics, inventory,
|
||||
analytics — is produced by filling in <strong>two axes only</strong>: the resource model
|
||||
and (if needed) the pipeline family.</p>
|
||||
<p><strong>Doc model:</strong> this wiki is written for humans — how-to guides, the build
|
||||
recipe, and quality gates. The enforceable rules (layering, composition root,
|
||||
CRUD template, pipeline scaffold) and the library registry live in the
|
||||
<strong>reference</strong> pages, mirrored by the machine-readable <code>standards</code> MCP bundle.
|
||||
Query <code>find_library</code> before writing any infrastructure.</p>
|
||||
</blockquote>
|
||||
<h2 id="how-to-read-this">How to read this</h2>
|
||||
<hr />
|
||||
<h2 id="key-features">🚀 Key Features</h2>
|
||||
<ul>
|
||||
<li>🧭 <strong>Spec-first routing</strong> — the OpenAPI document, not decorator routers, is
|
||||
the source of truth (operationId lookup)</li>
|
||||
<li>🏗️ <strong>One-way layering</strong> — <code>interfaces → domain → infra</code>, enforced</li>
|
||||
<li>🔌 <strong>Single composition root</strong> — every dependency is wired in exactly one place</li>
|
||||
<li>🧩 <strong>Generic, not app-specific</strong> — reusable rules versus two authoring axes</li>
|
||||
<li>📚 <strong>Library-backed</strong> — DB, DI, pipelines, ingestion, auth, and docs come from
|
||||
internal libraries, never hand-written</li>
|
||||
<li>🚦 <strong>Explicit state machines</strong> — durable job statuses, progress, and
|
||||
human-in-the-loop pauses</li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h2 id="documentation-structure">📁 Documentation Structure</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Page</th>
|
||||
<th>What it covers</th>
|
||||
<th>Section</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Overview</td>
|
||||
<td>The philosophy and the one-way dependency rule</td>
|
||||
<td><a href="01_overview/">Overview</a></td>
|
||||
<td>Philosophy, the one-way dependency rule, architecture</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Layering Rules</td>
|
||||
<td>Which package may import which</td>
|
||||
<td><a href="02_components/">App Components</a></td>
|
||||
<td>The component model and how the pieces wire together</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Composition Root</td>
|
||||
<td>The single wiring point</td>
|
||||
<td><a href="03_build_recipe/">Build Recipe</a></td>
|
||||
<td>The ordered, agentic checklist for a new app</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Spec-First Routing</td>
|
||||
<td>OpenAPI as the source of truth</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>CRUD Template</td>
|
||||
<td>The canonical resource slice</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Pipeline Scaffold</td>
|
||||
<td>Data-driven processing families</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Worker & Progress</td>
|
||||
<td>Async jobs, status machine, streaming progress</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Human-in-the-Loop</td>
|
||||
<td>Pausing a job to ask a question</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Infra Adapters</td>
|
||||
<td>MongoDB, cache, stores, LLM, mail</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Testing</td>
|
||||
<td>Integration + unit conventions</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Build Recipe</td>
|
||||
<td>The ordered checklist to generate a new app</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Genericity Matrix</td>
|
||||
<td>What is reusable vs what you must write</td>
|
||||
<td><a href="04_development/01_testing/">Testing & Quality</a></td>
|
||||
<td>Test layout and acceptance gates</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2 id="for-ai-agents">For AI agents</h2>
|
||||
<p>This content is served as MCP resources under <code>docs://index</code>, <code>docs://nav</code>,
|
||||
and <code>docs://modules/{module}</code>. To build a new app:</p>
|
||||
<ol>
|
||||
<li>Read <code>build_recipe</code> first.</li>
|
||||
<li>Read <code>genericity_matrix</code> to know what you must author.</li>
|
||||
<li>Query the <strong>library registry</strong> (<code>find_library</code>) before writing any
|
||||
infrastructure yourself.</li>
|
||||
<li>Copy the <code>templates/</code> skeleton and fill the two app-specific axes.</li>
|
||||
</ol>
|
||||
<p><strong>Reference</strong> (separate site, mirrors the MCP bundle): the enforceable
|
||||
rules — <a href="../lib/02_layering_rules/">Layering</a>, <a href="../lib/03_composition_root/">Composition
|
||||
Root</a>, <a href="../lib/04_spec_first_routing/">Spec-First
|
||||
Routing</a>, <a href="../lib/05_crud_template/">CRUD
|
||||
Template</a>, <a href="../lib/06_pipeline_scaffold/">Pipeline
|
||||
Scaffold</a>, <a href="../lib/07_worker_and_progress/">Worker &
|
||||
Progress</a>, <a href="../lib/08_human_in_loop/">Human-in-the-Loop</a>,
|
||||
<a href="../lib/09_infra_adaptors/">Infra Adapters</a>, <a href="../lib/12_genericity_matrix/">Genericity
|
||||
Matrix</a>, <a href="../lib/13_library_registry/">Library
|
||||
Registry</a>.</p>
|
||||
<hr />
|
||||
<h2 id="related-resources">🔗 Related Resources</h2>
|
||||
<ul>
|
||||
<li><strong>MCP bundle</strong> — <code>standards</code> server on <code>:8009</code>: read <code>doc://index</code>,
|
||||
<code>doc://nav</code>, <code>doc://modules/{module}</code>; call <code>find_library(capability)</code></li>
|
||||
<li><strong>Library registry</strong> — the catalog of internal libraries behind every app
|
||||
(<code>libraries.json</code>, served as <code>registry://libraries</code>)</li>
|
||||
<li><strong>Template</strong> — the runnable skeleton at <code>standards/src/templates/app/</code></li>
|
||||
<li><strong>Copy the repo's <code>AGENTS.md</code>-style build prompt</strong> from
|
||||
<a href="03_build_recipe/">Build Recipe</a></li>
|
||||
</ul>
|
||||
<hr />
|
||||
<p>© Aetoskia Internal — <code>standards</code></p>
|
||||
|
||||
|
||||
|
||||
@@ -571,6 +604,8 @@ and <code>docs://modules/{module}</code>. To build a new app:</p>
|
||||
|
||||
<script src="assets/javascripts/bundle.f55a23d4.min.js"></script>
|
||||
|
||||
<script src="https://unpkg.com/mermaid@10.9.1/dist/mermaid.min.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user