story: DGR-031 Introduce the project-owned ShardEngine interface

This commit is contained in:
Dobromir Popov
2026-07-23 11:00:33 +03:00
parent fd742d35c0
commit c34ab059cc
8 changed files with 2636 additions and 13 deletions

View File

@@ -1347,3 +1347,59 @@ Max iterations: unlimited
[10:51:07] [INFO] [agent] 5. **Quality gates** — 19/19 targeted tests pass, `compileall` clean, `git diff --check` clean on all changed files, `prd.json` schema validates, and the evidence README documents exact commands/results, changed files, limitations (pre-existing unrelated test/log drift called out explicitly), and dependency handoff.
[10:51:07] [INFO] [agent] Progress log and evidence README are written; `prd.json`'s DGR-030 is now `passes: true` with its generated issue Markdown regenerated to match.
[10:51:07] [INFO] [agent] <promise>COMPLETE</promise>
[10:51:08] [INFO] [progress] Iteration 1 finished. Task DGR-030: COMPLETED. Duration: 982s
[10:51:08] [INFO] [tracker] Task DGR-030 completed in iteration 1
[10:51:09] [INFO] [progress] Iteration 2/∞: Working on DGR-031 - Introduce the project-owned `ShardEngine` interface
[10:51:12] [INFO] [agent] I'll start by reading the RALPH context, the source issue, and evidence from the dependency tasks (DGR-021, DGR-025).
[10:51:13] [INFO] [agent] [Bash] $ cat /run/media/popov/d/DEV/repos/d-popov.com/AI/.claude/worktrees/distributed-gguf-runtime/.scratch/...
[10:51:14] [INFO] [agent] [Bash] $ cat /run/media/popov/d/DEV/repos/d-popov.com/AI/.claude/worktrees/distributed-gguf-runtime/.scratch/...
[10:51:17] [INFO] [agent] [Bash] $ echo "--- evidence dirs ---" && ls .scratch/distributed-gguf-runtime/evidence/ && echo "--- DGR-021 ...
[10:51:18] [INFO] [agent] [Bash] $ echo "--- DGR-025 README ---" && cat .scratch/distributed-gguf-runtime/evidence/DGR-025/README.md 2>...
[10:51:19] [INFO] [agent] [Bash] $ find . -path ./.git -prune -o -type d -print | grep -v -E '\.git|node_modules|__pycache__|\.venv' | ...
[10:51:23] [INFO] [agent] [Bash] $ find packages -type f -name "*.py" | grep -v test | sort
[10:51:24] [INFO] [agent] [Bash] $ find . -iname "*shard*engine*" -o -iname "*shardengine*" 2>/dev/null | grep -v .git
[10:51:24] [INFO] [agent] [Bash] $ cat .ralph-tui/progress.md 2>/dev/null | tail -200
[10:51:28] [INFO] [agent] [Read] /run/media/popov/d/DEV/repos/d-popov.com/AI/.claude/worktrees/distributed-gguf-runtime/packages/node/meshnet_node/model_backend.py
[10:51:29] [INFO] [agent] [Read] /run/media/popov/d/DEV/repos/d-popov.com/AI/.claude/worktrees/distributed-gguf-runtime/packages/node/meshnet_node/native_backend.py
[10:51:34] [INFO] [agent] [Read] /run/media/popov/d/DEV/repos/d-popov.com/AI/.claude/worktrees/distributed-gguf-runtime/packages/node/meshnet_node/shard_lifecycle.py
[10:51:35] [INFO] [agent] [Read] /run/media/popov/d/DEV/repos/d-popov.com/AI/.claude/worktrees/distributed-gguf-runtime/packages/node/meshnet_node/shard_runtime_server.py
[10:51:39] [INFO] [agent] [Read] /run/media/popov/d/DEV/repos/d-popov.com/AI/.claude/worktrees/distributed-gguf-runtime/packages/node/meshnet_node/architecture_boundary.py
[10:51:40] [INFO] [agent] [Bash] $ cat .scratch/distributed-gguf-runtime/issues/032-implement-deterministic-fake-shardengine.md
[10:51:40] [INFO] [agent] [Bash] $ find . -iname "0024*" -path "*adr*" 2>/dev/null
[10:51:44] [INFO] [agent] [Bash] $ grep -n -i "shardengine\|shard_engine" -r . --include="*.py" --include="*.md" 2>/dev/null | grep -v ...
[10:51:45] [INFO] [agent] [Bash] $ grep -n -i "shardengine\|MTP\|multi.token" docs/adr/0024-distributed-gguf-runtime.md | head -60
[10:51:46] [INFO] [agent] [Read] /run/media/popov/d/DEV/repos/d-popov.com/AI/.claude/worktrees/distributed-gguf-runtime/packages/node/meshnet_node/native_protocol/__init__.py
[10:51:51] [INFO] [agent] [Bash] $ grep -n -i "engine\|boundary\|mtp\|auxiliary\|aux-state\|aux_state\|recurrent" docs/adr/0024-distrib...
[10:51:51] [INFO] [agent] [Bash] $ ls tests/ | grep -i -E "shard|engine|lifecycle|boundary"
[10:52:32] [INFO] [agent] [Read] /run/media/popov/d/DEV/repos/d-popov.com/AI/.claude/worktrees/distributed-gguf-runtime/tests/test_shard_lifecycle.py
[10:52:33] [INFO] [agent] [Bash] $ print(json.dumps(s,indent=2))" 2>&1 | head -100
[10:52:37] [INFO] [agent] [Bash] $ python3 -c " import json d=json.load(open('.scratch/distributed-gguf-runtime/prd.json')) print(list(...
[10:52:38] [INFO] [agent] [Bash] $ python3 -c " import json d=json.load(open('.scratch/distributed-gguf-runtime/prd.json')) s=[x for x ...
[10:52:45] [INFO] [agent] [Bash] $ ls tests/ | grep -v "^test_"
[10:52:46] [INFO] [agent] [Bash] $ cat pytest.ini setup.cfg pyproject.toml 2>/dev/null | grep -n -A5 "\[tool.pytest"
[10:53:24] [INFO] [agent] [Read] /run/media/popov/d/DEV/repos/d-popov.com/AI/.claude/worktrees/distributed-gguf-runtime/packages/node/meshnet_node/protocol.py
[10:54:21] [INFO] [agent] [Read] /run/media/popov/d/DEV/repos/d-popov.com/AI/.claude/worktrees/distributed-gguf-runtime/packages/node/meshnet_node/__init__.py
[10:55:05] [INFO] [agent] [Write] /run/media/popov/d/DEV/repos/d-popov.com/AI/.claude/worktrees/distributed-gguf-runtime/packages/node/meshnet_node/shard_engine.py """"The project-owned ``ShardEngine`` contract (DGR-031).
[10:55:05] [INFO] [agent] A worker process (the gRPC surface in ``shard_runtime_server.py``, or any
[10:55:05] [INFO] [agent] future transport) never talks to llama.cpp directly. It talks to a
[10:55:05] [INFO] [agent] `... (13132 chars)"
[10:56:18] [INFO] [agent] Now I'll write the reusable contract-test helper that DGR-032/DGR-037 can import against their own engines.
[10:56:41] [INFO] [agent] [Write] /run/media/popov/d/DEV/repos/d-popov.com/AI/.claude/worktrees/distributed-gguf-runtime/tests/shard_engine_contract.py """"Reusable ``ShardEngine`` lifecycle contract (DGR-031).
[10:56:41] [INFO] [agent] Any :class:`~meshnet_node.shard_engine.ShardEngine` implementation — the
[10:56:41] [INFO] [agent] DGR-032 deterministic fixture, the DGR-037 llama.cpp binding, or a t... (8871 chars)"
[10:56:43] [INFO] [agent] Now the reference-engine test file that exercises this contract plus module-level type/isolation tests.
[10:57:10] [INFO] [agent] [Write] /run/media/popov/d/DEV/repos/d-popov.com/AI/.claude/worktrees/distributed-gguf-runtime/tests/test_shard_engine.py """"DGR-031 ``ShardEngine`` contract tests.
[10:57:10] [INFO] [agent] ``_ReferenceEngine`` below is a minimal, in-memory ``ShardEngine`` that exists
[10:57:10] [INFO] [agent] only to prove :func:`assert_shard_engine_contract` is non-vacuous and to pin
[10:57:10] [INFO] [agent] ... (9748 chars)"
[10:57:12] [INFO] [agent] Now let's run the tests.
[10:57:13] [INFO] [agent] [Bash] $ python3 -m pytest -q tests/test_shard_engine.py 2>&1 | tail -80
[10:57:15] [INFO] [agent] [Bash] $ python3 -m pip --version 2>&1 | head -3
[10:57:19] [INFO] [agent] [Bash] $ .venv/bin/python3 -m pytest -q tests/test_shard_engine.py 2>&1 | tail -100
[10:57:30] [INFO] [agent] [Edit] /run/media/popov/d/DEV/repos/d-popov.com/AI/.claude/worktrees/distributed-gguf-runtime/tests/test_shard_engine.py edit: "def test_shard_engine_exposes_no_protobuf_or_ctype..." → "def test_shard_engine_module_imports_no_native_or_..."
[10:57:31] [INFO] [agent] [Bash] $ .venv/bin/python3 -m pytest -q tests/test_shard_engine.py 2>&1 | tail -100
[10:57:35] [INFO] [agent] All 12 tests pass. Now run the full suite plus compileall and git diff --check.
[10:57:35] [INFO] [agent] [Bash] $ .venv/bin/python3 -m pytest -q tests/ 2>&1 | tail -40
[10:57:41] [INFO] [agent] [Bash] $ .venv/bin/python3 -m pytest -q tests/test_shard_engine.py tests/test_shard_lifecycle.py tests/test_a...
[10:57:47] [INFO] [agent] Good — no regressions. Let's confirm those collection errors are pre-existing (not caused by my change) and check compileall + git diff --check.
[10:57:48] [INFO] [agent] [Bash] $ git stash pop