# DGR-002 reproduction commands (run from repo root, project .venv = Python 3.14).

# 1. Generate Python stubs (reproducible; writes to gitignored build/ dir).
.venv/bin/python packages/node/native/scripts/generate_python.py

# 2. Python round-trip + compatibility tests (default env; C++ test skips if
#    cmake/protoc absent).
.venv/bin/python -m pytest tests/test_native_shard_protocol.py -q
#   => 11 passed, 1 skipped

# 3. Quality gates.
.venv/bin/python -m compileall -q packages tests    # exit 0
git diff --check                                     # clean

# 4. Full deterministic suite (records pre-existing unrelated failures).
.venv/bin/python -m pytest -q
#   => 704 passed, 14 skipped, 11 failed (all pre-existing, unrelated; see below)

# 5. Clean-tree reproduction of the 11 pre-existing failures (DGR-002 files moved
#    aside): same 11 fail => not caused by this story.

# --- C++ / cross-language (requires protoc + protobuf C++ dev + cmake) --------
# On this host a from-source protobuf 33.1 toolchain lives under /tmp/pbsrc/install
# and cmake ships in the .venv. To execute the C++ test instead of skipping it:
export PATH="/tmp/pbsrc/install/bin:$PWD/.venv/bin:$PATH"
export CMAKE_PREFIX_PATH="/tmp/pbsrc/install:$CMAKE_PREFIX_PATH"

# 6. Generate C++ stubs (message stubs always; gRPC service stubs if
#    grpc_cpp_plugin present).
packages/node/native/scripts/generate_cpp.sh

# 7. Standalone C++ build + selftest + ctest.
cmake -S packages/node/native -B packages/node/native/build/cpp
cmake --build packages/node/native/build/cpp --target shard_protocol_roundtrip_test
packages/node/native/build/cpp/shard_protocol_roundtrip_test --selftest   # "selftest ok (128 bytes)"
(cd packages/node/native/build/cpp && ctest --output-on-failure)          # 1/1 passed

# 8. Cross-language Python<->C++ round-trip via the pytest driver (now runs, not skips).
.venv/bin/python -m pytest tests/test_native_shard_protocol.py::test_cross_language_roundtrip_python_and_cpp -q
#   => 1 passed
