Skip to content

Refine AC-0001 spec for implementation readiness#9

Merged
danieldilly merged 1 commit intomainfrom
feat/ac-0001-implementation-ready-spec
Dec 22, 2025
Merged

Refine AC-0001 spec for implementation readiness#9
danieldilly merged 1 commit intomainfrom
feat/ac-0001-implementation-ready-spec

Conversation

@danieldilly
Copy link
Contributor

Summary

  • Refactored FS-0007 v0 multiplayer spec from 749→287 lines (62% reduction)
  • Added ADR-0006 (Input Tick Targeting) and ADR-0007 (StateDigest Algorithm)
  • Revised ADR-0003 to remove dt_seconds footgun, added tick-driven API
  • Tightened Constitution: DM-0026 (InputSeq ties), INV-0003 (player identity), INV-0007 (ordering)
  • Added PlayerId type alias and mechanical verification (entity ordering, tick postconditions, replay integrity)

Trace Block

Issue: #7
Spec: docs/specs/FS-0007-v0-multiplayer-slice.md
Constitution: INV-0001, INV-0002, INV-0003, INV-0004, INV-0005, INV-0006, INV-0007, DM-0001, DM-0006, DM-0008, DM-0011, DM-0014, DM-0016, DM-0017, DM-0018, DM-0019, DM-0020, DM-0023, DM-0024, DM-0025, DM-0026, DM-0027, AC-0001, KC-0001, KC-0002
ADRs: ADR-0001, ADR-0002, ADR-0003, ADR-0004, ADR-0005, ADR-0006, ADR-0007

Files Changed

Modified (12):

  • docs/adr/0003-fixed-timestep-simulation.md — Complete revision: removed dt_seconds, added tick-driven API
  • docs/adr/0005-v0-networking-architecture.md — Status: Proposed→Accepted
  • docs/constitution/acceptance-kill.md — Fixed AC-0001.5 clarification wording
  • docs/constitution/domain-model.md — Added DM-0025/26/27, tightened DM-0026 (InputSeq u64, tie-breaking)
  • docs/constitution/invariants.md — Updated INV-0003 (player identity), INV-0007 (ordering)
  • docs/constitution/id-catalog.json — Regenerated for new IDs
  • docs/constitution/id-index-by-tag.md — Regenerated
  • docs/constitution/id-index.md — Regenerated
  • docs/networking/v0-parameters.md — Added max_future_ticks=120, input_lead_ticks=1
  • docs/specs/_TEMPLATE.md — Removed redundant Issue section
  • scripts/spec_lint.py — Removed "Issue" from REQUIRED_SECTIONS

New (3):

  • docs/adr/0006-input-tick-targeting.md — TargetTickFloor semantics, InputSeq, input pipeline
  • docs/adr/0007-state-digest-algorithm-canonical-serialization.md — FNV-1a 64-bit, canonicalization rules
  • docs/specs/FS-0007-v0-multiplayer-slice.md — Implementation-ready v0 multiplayer spec (287 lines)

Deleted (1):

  • docs/specs/FS-TBD-v0-multiplayer-slice.md — Replaced by FS-0007

Determinism / Simulation Impact

  • This PR changes simulation-plane logic

Changes:

  • Added StepInput (DM-0027) type for simulation input consumption (PlayerId + payload only)
  • Revised tick-driven API in ADR-0003: advance(tick, step_inputs) with precondition tick == world.tick()
  • Added mechanical verification: entity ordering by EntityId (INV-0007), tick postconditions
  • Defined StateDigest algorithm (ADR-0007): FNV-1a 64-bit with canonicalization (-0.0→+0.0, NaN→quiet NaN)

Verification:

  • Determinism preserved: All changes maintain INV-0001 (deterministic simulation), INV-0002 (fixed timestep)
  • Replay scope unchanged: v0 = same binary + same platform (ADR-0005)
  • No simulation code implemented yet; this PR is governance + spec only
  • Tier-0 gate plan in spec provides mechanical test checklist for implementation

Verification

  • just ci — All checks pass (fmt, lint, test, ids, spec-lint)
  • just ids — Constitution IDs validated
  • just spec-lint — FS-0007 spec structure validated
  • Constitution docs changed: just ids-gen run, outputs committed (id-catalog.json, id-index.md, id-index-by-tag.md)

Risk / Notes

Key architectural decisions formalized:

  • TargetTickFloor (DM-0025): Server-emitted tick floor for client input targeting; eliminates past-tick ambiguity
  • InputSeq (DM-0026): Per-session monotonic u64 for deterministic input selection; greatest wins, ties handled
  • StepInput (DM-0027): Clean simulation-plane input type; no protocol metadata leakage

Constitution tightening:

  • INV-0003 now explicitly states PlayerId binding is Server Edge responsibility (trust boundary)
  • INV-0007 now mandates entity iteration ordering (deterministic, not just stable)
  • DM-0026 (InputSeq) now u64 with explicit tie-breaking (was ambiguous)

Spec refactoring rationale:

  • Removed ~460 lines of redundant prose (Component Responsibilities, Boundary Contracts, verbose rationale)
  • Moved StateDigest algorithm to ADR-0007 (single source of truth)
  • Lean spec focuses on interfaces, protocol, gate plan — sufficient for implementation

Follow-ups (not blocking):

  • Implementation PR will add Tier-0 tests per gate plan
  • Spec status will change Draft→Approved→Implemented after review and implementation

Checklist

  • Trace block is complete and accurate
  • This PR stays within Constitution invariants (no silent weakening; INV-0003/0007 tightened)
  • No new dependencies added
  • Spec exists for non-trivial changes (FS-0007)
  • Gates added per spec's Gate Plan (15 Tier-0 items; implementation PR will add tests)

- Refactor FS-0007 v0 multiplayer spec (749287 lines, 62% reduction)
- Add ADR-0006: Input tick targeting & TargetTickFloor semantics
- Add ADR-0007: StateDigest algorithm (FNV-1a 64-bit, canonicalization)
- Revise ADR-0003: Remove dt_seconds footgun, add tick-driven API
- Update ADR-0005: Status ProposedAccepted
- Tighten Constitution: DM-0026 (InputSeq u64, ties), INV-0003 (player identity)
- Add PlayerId type alias to prevent u8/u64 drift
- Add mechanical verification: entity ordering, tick postconditions, replay integrity checks
- Fix contradictions: Remove player_id from InputCmdProto, clarify StepInput semantics
- Add high-leverage features: build_fingerprint, AppliedInput canonical ordering
- Update tooling: Remove redundant Issue section from spec template and linter

Closes requirements for implementation-ready v0 multiplayer slice per AC-0001.
@danieldilly danieldilly linked an issue Dec 22, 2025 that may be closed by this pull request
9 tasks
@danieldilly danieldilly merged commit 2c2998e into main Dec 22, 2025
1 check passed
@danieldilly danieldilly deleted the feat/ac-0001-implementation-ready-spec branch December 22, 2025 21:49
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.

AC-0001: v0 Two-Client Multiplayer Slice

1 participant