Skip to content

foundation: create the modular-monolith API and worker skeleton (#6) - #33

Merged
stone16 merged 2 commits into
mainfrom
agent/hao/d0a44a50
Jul 20, 2026
Merged

foundation: create the modular-monolith API and worker skeleton (#6)#33
stone16 merged 2 commits into
mainfrom
agent/hao/d0a44a50

Conversation

@stone16

@stone16 stone16 commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Originating Multica issue: STO-388
Original author: @hao

Summary

Adds the first runnable ContextEngine vertical skeleton: a Python 3.13 project with one FastAPI API process, one long-lived independent Supply worker process, one shared build identity, fail-closed Runtime construction, locked dependencies, repository-owned verification commands, and CI. The API health and worker lifecycle explicitly report Runtime delivery and job behavior as NOT_ACTIVE.

Why

The greenfield repository needs one load-bearing layout and toolchain before downstream M0 work can safely fan out. This implements and closes #6 while preserving the settled API/worker/shared-domain dependency direction and refusing to imply any database, authorization, or ContextPackage behavior that does not exist yet. It is the first implementation step under STO-388.

Closes #6

Approach

The API adapter remains at adapters/http/app.py; process composition roots live outward in applications/api.py and applications/worker.py. Both import the shared engine package and build identifier, while engine/ has no transport/application imports. The installed scripts accept process arguments and are the exact seams exercised by smoke tests.

engine/runtime/construction.py models policy, audit, budget, and provenance as four explicit mandatory inputs. Runtime itself rejects subclasses/duck types and inspects every exact enum identity, so caller-controlled validation cannot disable the guard. It deliberately exposes no resolve() behavior.

Accepted choice: Use the ADR-selected Python 3.13/FastAPI modular monolith with outer process roots, uv.lock, and a small Makefile façade shared by local development and CI.

Rejected alternatives:

  • Caller-delegated dependencies.validate() — rejected because subclass/duck-type overrides bypassed the security guard.
  • Process roots inside engine — rejected because the accepted dependency direction keeps transport/composition outside the shared domain.
  • Smoke direct Uvicorn/modules — rejected because broken installed entry points could remain green.
  • Poetry/pip-tools — rejected because they add a second or split workflow when uv supplies interpreter selection, frozen sync, locking, running and build.
  • Placeholder Runtime delivery methods or no-op policy services — rejected because green smoke must not imply authorization or Package behavior.

Constraint: ADR-0005 fixes Python 3.13/FastAPI, ADR-0008 fixes API plus independent worker sharing one domain package, and issue #6 requires reproducible locked setup plus non-disableable policy/audit/budget/provenance startup guards.

How I Tested

End-to-end test cases

Case Test file:line What it asserts
API installed-script boot/readiness tests/process/test_processes.py:20 Runs context-engine-api with an injected port, waits for HTTP readiness, and checks shared version plus runtime_delivery: NOT_ACTIVE.
Worker deterministic test lifecycle tests/process/test_processes.py:64 Runs installed context-engine-worker --test-mode, requires exit 0, and checks shared version plus job_behavior: NOT_ACTIVE.
Worker normal lifecycle tests/process/test_processes.py:81 Runs the installed worker, proves it remains alive, terminates it, and checks its ready/inactive output.
Four mandatory inputs tests/unit/test_runtime_construction.py:13 Omitting policy, audit, budget, or provenance independently raises the deterministic configuration error.
Wrong kernel identity tests/unit/test_runtime_construction.py:25 A dependency in the wrong slot is rejected.
Subclass override bypass tests/unit/test_runtime_construction.py:38 A KernelDependencies subclass with no-op validate() and all-None fields is rejected.
Duck-typed bypass tests/unit/test_runtime_construction.py:54 An arbitrary object with no-op validate() is rejected.

Verbatim test output

Red-before regression run against the pre-fix implementation:

$ uv run pytest -vv tests/unit/test_runtime_construction.py tests/process/test_processes.py
collected 10 items
...
tests/unit/test_runtime_construction.py::test_runtime_rejects_a_subclass_that_overrides_validation FAILED
tests/unit/test_runtime_construction.py::test_runtime_rejects_a_duck_typed_validation_bypass FAILED
tests/process/test_processes.py::test_api_boots_and_reports_readiness FAILED
tests/process/test_processes.py::test_worker_completes_test_lifecycle PASSED
tests/process/test_processes.py::test_worker_stays_alive_until_terminated_in_normal_mode FAILED
========================= 4 failed, 6 passed in 10.49s =========================

The API failure showed the shipped script ignored the injected port and bound 127.0.0.1:8000; the worker failure showed exit code 0 instead of remaining alive. Both bypass tests reported DID NOT RAISE RuntimeConfigurationError.

Green-after complete matrix:

$ make check
uv build
Building source distribution...
Building wheel from source distribution...
Successfully built dist/context_engine-0.1.0.tar.gz
Successfully built dist/context_engine-0.1.0-py3-none-any.whl
uv run ruff check .
All checks passed!
uv run mypy
Success: no issues found in 12 source files
uv run pytest -q tests/unit
.......                                                                  [100%]
7 passed in 0.01s
uv run pytest -q tests/process
...                                                                      [100%]
3 passed in 0.74s

Installed console-script smoke:

$ uv run context-engine-api --host 127.0.0.1 --port 8765 --log-level info
api_health={"status":"ready","service":"context-engine-api","version":"0.1.0","runtime_delivery":"NOT_ACTIVE"}
INFO:     Uvicorn running on http://127.0.0.1:8765
INFO:     127.0.0.1:60893 - "GET /health HTTP/1.1" 200 OK

$ uv run context-engine-worker
worker_alive=true
{"job_behavior": "NOT_ACTIVE", "service": "context-engine-worker", "status": "ready", "version": "0.1.0"}

$ uv run context-engine-worker --test-mode
{"job_behavior": "NOT_ACTIVE", "service": "context-engine-worker", "status": "test-complete", "version": "0.1.0"}

Domain import-boundary scan:

$ rg -n 'uvicorn|adapters|applications' engine
no transport/application imports under engine/

Existing tests

$ uv run pytest -q tests/unit
.......                                                                  [100%]
7 passed in 0.01s

New tests added

  • tests/unit/test_runtime_construction.py:38 — rejects subclass override plus all-None inputs.
  • tests/unit/test_runtime_construction.py:54 — rejects duck-typed no-op validation.
  • tests/process/test_processes.py:20 — runs the installed API script with injected host/port.
  • tests/process/test_processes.py:64 — runs the installed worker test lifecycle.
  • tests/process/test_processes.py:81 — proves normal worker remains alive until terminated.

Lint / typecheck

$ uv run ruff check .
All checks passed!
$ uv run mypy
Success: no issues found in 12 source files

Rollback Plan

Revert this PR. Maximum blast radius is the repository development/build skeleton and the two not-yet-deployed process entry points; there is no database, migration, persistent data, Runtime delivery, external effect, or tenant state to unwind. Time-to-rollback is under five minutes once the revert is merged.

Out of Scope

  • PostgreSQL, SQLAlchemy/Alembic migrations, roles, RLS, and schema security manifests.
  • ContextRuntime.resolve, transport authentication, ContextPackage schemas, or any successful authorization behavior.
  • Durable queues, jobs, leases, background work, and production worker job processing.
  • Deployment manifests and non-local listener defaults.
  • Planned modules whose owning downstream issues have not started.

Summary by CodeRabbit

  • New Features

    • Added a runnable API with health-status reporting.
    • Added an independent worker process with test and normal lifecycle modes.
    • Added runtime validation to ensure required system components are configured.
    • Added standardized build/version identification across processes.
  • Documentation

    • Updated setup, development, verification, and current capability guidance.
  • Chores

    • Added standardized install, build, lint, type-check, test, smoke-test, and verification commands.
    • Added automated CI checks for pull requests and the main branch.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Failed to post review comments.

GitHub was unavailable or timed out while CodeRabbit was posting the review. Please request a new review later if the pull request still needs one. This happened while posting 1 inline comment. Use @coderabbitai full review to retry the review.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5fc1bd5f-d74e-48a4-a248-6de715faf531

📥 Commits

Reviewing files that changed from the base of the PR and between 76c6c94 and e740392.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (17)
  • .github/workflows/ci.yml
  • AGENTS.md
  • Makefile
  • README.md
  • adapters/__init__.py
  • adapters/http/__init__.py
  • adapters/http/app.py
  • applications/__init__.py
  • applications/api.py
  • applications/worker.py
  • engine/__init__.py
  • engine/build.py
  • engine/runtime/__init__.py
  • engine/runtime/construction.py
  • pyproject.toml
  • tests/process/test_processes.py
  • tests/unit/test_runtime_construction.py
🧰 Additional context used
📓 Path-based instructions (4)
**/*

📄 CodeRabbit inference engine (AGENTS.md)

**/*: Address the user as "stometa" at the start of every response.
Public reference claims must trace to the four-repository evidence report, first-party ContextEngine requirements, or the threat model; external research must not be cited, linked, or presented as public provenance, and code must not be copied from the named repositories.
Before claiming implementation completion, run the recorded verification commands and never fabricate output; process smoke results alone do not establish Runtime delivery, database, or worker-job capability.
Record every non-obvious architectural decision as an ADR under docs/decisions/.
Do not hardcode volatile values such as URLs, ports, or versions in prose; reference their source of truth.
Do not blindly delete repository-specific content.

Files:

  • applications/__init__.py
  • adapters/http/__init__.py
  • adapters/__init__.py
  • engine/runtime/__init__.py
  • Makefile
  • engine/__init__.py
  • engine/build.py
  • applications/api.py
  • adapters/http/app.py
  • pyproject.toml
  • README.md
  • applications/worker.py
  • engine/runtime/construction.py
  • tests/process/test_processes.py
  • tests/unit/test_runtime_construction.py
  • AGENTS.md
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Use the defined ContextRuntime authorization path: production ContextRuntime.resolve(...) must pass through one non-pluggable AuthorizationKernel with PackageBudget, provenance, and audit gates; no bypasses or alternate compositions are allowed.
Treat security as a veto: unauthorized evidence, wrong-organization effects, and missing-context fallbacks must all fail closed.
Missing tenant context must always fail closed; index and cache filters must never make authorization decisions.
Worker database access must use a registered least-privilege ServiceActor and server-minted signed WorkerLease bound to the exact durable job; never impersonate the triggering user or treat ingestion authority as delivery authority.
Runtime content-bearing rerank, hydration, relevance-model, and assembly operations must accept only AuthorizedProjection; BotDelivery generation must accept only AuthorizedModelInput derived from the current audience-bound ContextPackage and matching EgressGrant.
CandidateRef must undergo exact authorization and field projection before use; every parent or neighbor expansion must be re-authorized.
SourceAclEvidence must distinguish Live, Mirrored, and Weak states; Weak is allowed only when the source lacks stronger ACL semantics and cannot fall back from a failed Live or Mirrored check.
Callers cannot manufacture TrustedDeliveryContext or AudienceSnapshot; the Kernel computes group authorization. Public-group and asker-private packages require separate resolves.
Remote BotDelivery may transmit only an opaque per-resolve DeliveryEvidenceRef in authenticated transport metadata; raw trusted identity and audience claims must not be placed in the wire body, and ingress must redeem and validate the reference before content work.
External effects must go through ActionPlane.prepare followed by ActionPlane.perform; each effect requires its own organization-, audience-, and payload-bound one-shot ActionTicket, and tickets mu...

Files:

  • applications/__init__.py
  • adapters/http/__init__.py
  • adapters/__init__.py
  • engine/runtime/__init__.py
  • engine/__init__.py
  • engine/build.py
  • applications/api.py
  • adapters/http/app.py
  • applications/worker.py
  • engine/runtime/construction.py
  • tests/process/test_processes.py
  • tests/unit/test_runtime_construction.py
**/*.{py,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never commit secrets, .env values, or credentials; use a single live source of truth instead.

Files:

  • applications/__init__.py
  • adapters/http/__init__.py
  • adapters/__init__.py
  • engine/runtime/__init__.py
  • engine/__init__.py
  • engine/build.py
  • applications/api.py
  • adapters/http/app.py
  • applications/worker.py
  • engine/runtime/construction.py
  • tests/process/test_processes.py
  • tests/unit/test_runtime_construction.py
**/tests/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Runtime tests must use the highest public seam available, preferably HTTP or the generated SDK, and prove CandidateRef → AuthorizationKernel → AuthorizedProjection; no raw candidate may reach content-bearing consumers.

Files:

  • tests/process/test_processes.py
  • tests/unit/test_runtime_construction.py
🪛 ast-grep (0.44.1)
applications/worker.py

[info] 16-24: use jsonify instead of json.dumps for JSON output
Context: json.dumps(
{
"status": lifecycle,
"service": "context-engine-worker",
"version": BUILD_IDENTIFIER,
"job_behavior": "NOT_ACTIVE",
},
sort_keys=True,
)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)

tests/process/test_processes.py

[error] 21-35: Command coming from incoming request
Context: subprocess.Popen(
[
"context-engine-api",
"--host",
"127.0.0.1",
"--port",
str(port),
"--log-level",
"warning",
],
cwd=ROOT,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(subprocess-from-request)


[error] 64-70: Command coming from incoming request
Context: subprocess.run(
["context-engine-worker", "--test-mode"],
cwd=ROOT,
check=True,
capture_output=True,
text=True,
)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(subprocess-from-request)


[error] 81-87: Command coming from incoming request
Context: subprocess.Popen(
["context-engine-worker"],
cwd=ROOT,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(subprocess-from-request)


[warning] 40-40: Request-controlled URL passed to urlopen; validate against an allowlist to prevent SSRF.
Context: urlopen(f"http://127.0.0.1:{port}/health", timeout=1)
Note: [CWE-918] Server-Side Request Forgery (SSRF).

(urlopen-unsanitized-data)

🪛 checkmake (0.3.2)
Makefile

[warning] 2-2: Required target "all" is missing from the Makefile.

(minphony)


[warning] 2-2: Required target "clean" is missing from the Makefile.

(minphony)

🪛 Ruff (0.15.21)
tests/process/test_processes.py

[error] 22-22: subprocess call: check for execution of untrusted input

(S603)


[error] 23-31: Starting a process with a partial executable path

(S607)


[error] 66-66: Starting a process with a partial executable path

(S607)


[error] 83-83: Starting a process with a partial executable path

(S607)

🪛 zizmor (1.26.1)
.github/workflows/ci.yml

[warning] 12-12: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

📝 Walkthrough

Walkthrough

The PR establishes an M0 Python package with build metadata, common verification commands, fail-closed runtime construction, FastAPI and worker entrypoints, shared build identification, CI, and unit/process tests.

Changes

M0 runtime skeleton

Layer / File(s) Summary
Packaging and verification workflow
pyproject.toml, Makefile, .github/workflows/ci.yml, AGENTS.md, README.md
Defines package metadata, console scripts, development targets, CI checks, and updated local verification and startup instructions.
Fail-closed runtime contract
engine/build.py, engine/__init__.py, engine/runtime/*, tests/unit/test_runtime_construction.py
Adds shared build identification, public runtime exports, sealed kernel dependency identities, strict construction validation, and tests for invalid or bypassed dependency wiring.
API and worker processes
adapters/*, applications/*, tests/process/test_processes.py
Adds the FastAPI health endpoint, API CLI, worker lifecycle modes, runtime initialization, and subprocess coverage for API readiness and worker output.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant APIProcess
  participant FastAPI
  participant Runtime
  Client->>APIProcess: start API and request /health
  APIProcess->>FastAPI: create application
  FastAPI->>Runtime: validate required kernel dependencies
  FastAPI-->>Client: readiness payload with BUILD_IDENTIFIER
Loading

Possibly related issues

  • Issue 6 — Directly covers the API/worker skeleton, runtime dependency guards, shared versioning, development commands, and smoke tests added here.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: introducing the initial API and worker skeleton for the modular-monolith.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/hao/d0a44a50

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b1503f0ea0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread applications/worker.py
sort_keys=True,
)
)
return 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the worker alive in normal mode

When the worker is launched normally as context-engine-worker without --test-mode, this unconditional return lets the process print ready and exit immediately. That contradicts the separate --test-mode lifecycle and leaves deployments or smoke scripts with no running Supply worker process; normal mode should block/run its service loop even while job behavior is NOT_ACTIVE.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will-fix — fixed in e740392. Normal mode now prints readiness with flush and blocks at applications/worker.py:28-29; --test-mode alone exits deterministically. Regression coverage at tests/process/test_processes.py:81-101 proves the installed worker remains alive until terminated.

Comment thread tests/process/test_processes.py Outdated
Comment on lines +49 to +50
if process.poll() is not None or time.monotonic() >= deadline:
output = process.stdout.read() if process.stdout else ""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid blocking while collecting startup output

If the API subprocess is still alive but never serves /health before the deadline, this read() waits for EOF on a live stdout pipe, so the smoke test can hang indefinitely instead of failing after 10 seconds. This can happen for a startup deadlock or a server that stays running but binds incorrectly; terminate or non-blockingly drain the process before reading its output.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will-fix — fixed in e740392. The timeout/dead-process path now terminates first and uses communicate(timeout=5) at tests/process/test_processes.py:45-50, so it cannot perform a blocking read against a live child. The installed API-script smoke remains bounded by the existing readiness deadline.

@stone16

stone16 commented Jul 19, 2026

Copy link
Copy Markdown
Owner Author

Verdict: request-changes

Per-criterion review of issue #6 at b1503f0ea0a60eb66d523b6aa02eac9296ad21ee:

  • PASS — clean locked setup: Python 3.13 is constrained at pyproject.toml:10, frozen sync is Makefile:3-4, contributor commands are README.md:15-28, and CI provisions 3.13 then runs the repository checks at .github/workflows/ci.yml:13-19.
  • PASS — API health behavior: construction and /health are adapters/http/app.py:19-29; the response explicitly says runtime_delivery: NOT_ACTIVE at adapters/http/app.py:11-16.
  • PASS — deterministic worker test lifecycle: the no-op/test result is engine/supply_worker_main.py:12-26, asserted by the subprocess test at tests/process/test_processes.py:67-81.
  • PASS — shared build identity: API and worker import the same engine.BUILD_IDENTIFIER at adapters/http/app.py:7 and engine/supply_worker_main.py:7; its source is engine/build.py:1-8.
  • FAIL — mandatory construction is bypassable. Runtime.__init__ delegates the security check to the caller-supplied object's overridable validate() and then stores it (engine/runtime/construction.py:48-53). A duck-typed object whose validate() returns, or a KernelDependencies subclass overriding validate(), constructs successfully with no policy/audit/budget/provenance. Existing tests cover only None substitutions on the base dataclass and one wrong enum slot (tests/unit/test_runtime_construction.py:13-35), so they miss this disable path. Smallest acceptable fix: make Runtime-owned, non-overridable validation inspect all four fields/identities directly and add regression tests for both bypass shapes.
  • PASS — repository check commands exist at Makefile:1-21; local make check built, linted, type-checked, and passed 7 full-suite plus 2 process tests.
  • PASS — smoke does not imply delivery/database/job behavior: the contributor contract says so at AGENTS.md:67-72, and API/worker outputs say NOT_ACTIVE at adapters/http/app.py:15 and engine/supply_worker_main.py:21.

Convention blockers/risks:

  • The accepted dependency direction says the API process and worker point into the shared domain and the shared domain does not import transport implementations (docs/decisions/README.md:37-52). But the package labels engine as the shared domain (engine/__init__.py:1) while its installed API entry point targets engine.api_main (pyproject.toml:24-26), which imports Uvicorn and owns listener configuration (engine/api_main.py:3-11); the worker process root is likewise inside engine (engine/supply_worker_main.py:1-12). Move process/composition roots to an outer application/adapter package so downstream work inherits the documented inward dependency direction.
  • The process harness does not exercise either shipped console entry point: API smoke invokes Uvicorn directly (tests/process/test_processes.py:23-35) and worker smoke invokes a module (tests/process/test_processes.py:67-74), bypassing both scripts declared at pyproject.toml:24-26. A broken package entry point can therefore remain green. Make host/port injectable and smoke the installed commands. This also removes the duplicated hard-coded listener value in README.md:34 and engine/api_main.py:9-10, which conflicts with the single-source rule at AGENTS.md:78.
  • Non-blocking cleanup: make check runs process tests twice because make test covers all tests (Makefile:15-16, pyproject.toml:36-37) and make smoke reruns tests/process (Makefile:18-21). Split unit/process selectors so the canonical matrix stays cheap as the suite grows.

Local verification:

$ uv sync --frozen && make check
...
All checks passed!
Success: no issues found in 11 source files
....... [100%]
7 passed in 0.98s
.. [100%]
2 passed in 0.54s

Bypass reproduction:

$ .venv/bin/python <duck-typed validate() bypass>
Bypass
$ .venv/bin/python <KernelDependencies subclass validate() bypass>
Bypass(policy=None, audit=None, budget=None, provenance=None)

Accepted choice: Request changes before #6 establishes these construction and module-boundary conventions for downstream issues.

Rejected alternatives:

Constraint: #6 is the convention-setting foundation, and its explicit acceptance criteria require a non-disableable construction guard plus runnable process entry points, not merely green tests around alternate seams.

Re-run verification after these are fixed.

@stone16

stone16 commented Jul 20, 2026

Copy link
Copy Markdown
Owner Author

Verdict: approve

What I checked:

  • Resolved — Runtime now owns validation, rejects every non-exact KernelDependencies object before inspecting fields, and directly checks the four exact enum identities at engine/runtime/construction.py:36-52. Regression coverage rejects the subclass override at tests/unit/test_runtime_construction.py:38-51 and duck-typed no-op validation at tests/unit/test_runtime_construction.py:54-60. My independent probes also confirmed subclass/all-None, duck type, base all-None, and wrong-slot inputs each raise RuntimeConfigurationError.
  • Resolved — process composition roots are outside the shared domain at applications/api.py:1-24 and applications/worker.py:1-45; installed scripts target them at pyproject.toml:24-29. A scan for uvicorn|fastapi|adapters|applications under engine/ returned no matches, and the built wheel contains applications, adapters, and engine.
  • Resolved — process smoke invokes the installed context-engine-api and context-engine-worker commands at tests/process/test_processes.py:20-36,64-71,81-94; API host/port are injectable at applications/api.py:9-20. Both wheel entry points execute and expose their expected CLI options.
  • No foundation: create the modular-monolith API and worker skeleton #6 regression found: API smoke still asserts runtime_delivery: NOT_ACTIVE at tests/process/test_processes.py:53-58; worker test and normal lifecycles assert job_behavior: NOT_ACTIVE at tests/process/test_processes.py:73-78,96-101.

Verification re-run locally:

$ uv sync --frozen && make check
uv build
Successfully built dist/context_engine-0.1.0.tar.gz
Successfully built dist/context_engine-0.1.0-py3-none-any.whl
uv run ruff check .
All checks passed!
uv run mypy
Success: no issues found in 12 source files
uv run pytest -q tests/unit
....... [100%]
7 passed in 0.01s
uv run pytest -q tests/process
... [100%]
3 passed in 1.60s
override_all_none=PASS:RuntimeConfigurationError:runtime dependencies must be KernelDependencies
duck_noop_validate=PASS:RuntimeConfigurationError:runtime dependencies must be KernelDependencies
base_all_none=PASS:RuntimeConfigurationError:mandatory kernel dependency is missing or invalid: policy
wrong_slot=PASS:RuntimeConfigurationError:mandatory kernel dependency is missing or invalid: policy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

foundation: create the modular-monolith API and worker skeleton

1 participant