Builds the browser game around the existing Rust runtime: a window into the universe, not a second simulation. Pure std, no external crates. New crates: - protocol: versioned, hashable client/server messages + hand-rolled JSON value and total parser (malformed packet -> Err, never panic). - game_runtime: authoritative match state. Resolves turns through the INDEPENDENT interpreter (runtime_under_test::native_resolve), not the reference engine; filters visibility/knowledge; records and regenerates replays. A match is a pure function of (seed, roster, ordered inputs). - web_assets/web_client: embedded browser client (arena, rune editor, knowledge panels, replay viewer) + static HTTP delivery. - server: std::net HTTP + WebSocket (hand-rolled SHA-1/base64/RFC-6455 framing), turn timer, disconnect handling, panic-proof dispatch, poison-tolerant lock. - web_tests: dependency-free WebSocket test client + Phase H gates. Trust hardening per review: - game_runtime no longer delegates to reference_runtime::execute; it runs the independent interpreter that the runtime-equivalence gate proves correct. - Protocol/socket/replay/visibility/resilience gates are merge-blocking (added to the merge_group-required job in merge-gates.yml): 1k matches/0 drift, 10k fuzz/0 panics, 100 headless socket E2E, 0 hidden-state leaks. - Rendered-browser E2E is marked EXTERNAL-BLOCKED: Playwright runs advisory-only (continue-on-error, artifacts) until CI infrastructure with a browser exists; it is treated as unsatisfied, not green. The headless 100-match gate is labeled protocol-level coverage, not rendered-browser coverage. - README documents the hand-rolled crypto/parser audit risk explicitly. Fixes an integer-overflow panic in observed-volatility inference (i64 sum / abs near i64::MIN) that could poison the server mutex. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
83 lines
3.3 KiB
YAML
83 lines
3.3 KiB
YAML
name: magicka-merge-gates
|
|
|
|
# The merge-blocking enforcement point for the Phase 0/1 acceptance gates.
|
|
# Per the spec's compliance model, acceptance may NOT be satisfied by a locally
|
|
# runnable binary, a default (fast) profile, or a documentation claim. This
|
|
# workflow is the enforcement: the `merge-gates` job below runs the full merge
|
|
# profile (1,000,000 executions, 10 perturbations each, 100% reference/runtime
|
|
# comparison, 10,000 persisted replay cases, >=500 mutants) and must be a
|
|
# REQUIRED status check on the protected branch / merge queue. If it fails or is
|
|
# absent, merge is blocked.
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
merge_group: # GitHub merge queue — the merge-blocking entry point
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
# Advisory PR feedback only. The spec permits a 10% fast slice for PR signal,
|
|
# but this job is explicitly NOT acceptance and never substitutes for the
|
|
# merge profile.
|
|
advisory-fast:
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Unit tests (incl. negative controls)
|
|
run: cargo test --release --workspace
|
|
- name: Fast advisory gate run
|
|
env:
|
|
MAGICKA_PROFILE: fast
|
|
run: cargo run --release -p ci_reports --bin ci
|
|
|
|
# The acceptance gate. Required on merge_group / protected main.
|
|
merge-gates:
|
|
if: github.event_name == 'merge_group' || github.event_name == 'push'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 1440
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Verify committed replay corpus has >= 10,000 cases
|
|
run: |
|
|
lines=$(grep -vcE '^(#|master)' crates/replay_corpus/corpus/replay_corpus.tsv)
|
|
echo "replay corpus cases: $lines"
|
|
test "$lines" -ge 10000
|
|
|
|
- name: Unit tests (incl. negative controls)
|
|
run: cargo test --release --workspace
|
|
|
|
# plan2.md Phase H: the protocol + socket + replay/visibility gates are
|
|
# merge-blocking. These run the full HTTP/WebSocket/protocol/runtime path
|
|
# headlessly over real sockets (1k matches, 10k fuzz, 100 e2e, leak +
|
|
# resilience). The rendered-browser layer is NOT gated here — see
|
|
# web-gates.yml (advisory, blocked on CI infrastructure).
|
|
- name: Web protocol + socket gates (merge-blocking)
|
|
run: cargo test --release -p protocol -p game_runtime -p server -p web_assets -p web_client -p web_tests
|
|
|
|
- name: Full merge-blocking acceptance gates
|
|
env:
|
|
MAGICKA_PROFILE: merge
|
|
MAGICKA_OUT: ci_out
|
|
run: cargo run --release -p ci_reports --bin ci
|
|
|
|
- name: Enforce required artifacts exist
|
|
run: |
|
|
for r in domain_participation_report causal_rank_report \
|
|
compression_resistance_report metamorphic_response_report \
|
|
mutation_survivor_report runtime_equivalence_report \
|
|
replay_report coverage_report provenance_report \
|
|
compliance_report; do
|
|
test -s "ci_out/${r}.json" || { echo "MISSING ARTIFACT: ${r}.json"; exit 1; }
|
|
done
|
|
|
|
- name: Upload acceptance evidence
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: magicka-acceptance-evidence
|
|
path: ci_out/
|