Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@ package.json
node_modules/
*.pyc
*.pyo

pre-commit.txt
pre-commit.log
pre-push.txt
pre-push.log
59 changes: 39 additions & 20 deletions .llm/skills/ci-cd-tooling/wiki-sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ Fix content in `docs/`, then re-sync.

## Link Format Rules

| Context | Format | Example |
|---------|--------|---------|
| `docs/` files | Lowercase with `.md` | `[Guide](user-guide.md)` |
| `wiki/` files | PascalCase, no extension | `[Guide](User-Guide)` |
| `wiki/_Sidebar.md` | PascalCase, no extension | `[User Guide](User-Guide)` |
| External (non-docs) | Full GitHub URL | `[Code](https://github.com/.../blob/main/src/lib.rs)` |
| Context | Format | Example |
| ------------------- | ------------------------ | ----------------------------------------------------- |
| `docs/` files | Lowercase with `.md` | `[Guide](user-guide.md)` |
| `wiki/` files | PascalCase, no extension | `[Guide](User-Guide)` |
| `wiki/_Sidebar.md` | PascalCase, no extension | `[User Guide](User-Guide)` |
| External (non-docs) | Full GitHub URL | `[Code](https://github.com/.../blob/main/src/lib.rs)` |

Use standard markdown `[Text](Page)` syntax in sidebar -- NOT wiki-link `[[Page|Text]]` syntax (has URL generation bugs).

Expand Down Expand Up @@ -57,6 +57,14 @@ docs/*.md --> sync-wiki.py
+-- Add SYNC comment header
+-- Generate _Sidebar.md
--> wiki/*.md

Pre-commit enforcement now runs this sequence for docs/wiki changes:

1. `sync-wiki` regenerates `wiki/*.md` from `docs/`
2. `wiki-consistency` validates links/sidebar/mapping integrity
3. `check-sync-headers` validates reciprocal `<!-- SYNC: ... -->` headers

This prevents committing stale or manually-edited wiki mirrors.
```

## MkDocs Conversion Patterns
Expand Down Expand Up @@ -124,26 +132,37 @@ python3 scripts/docs/validate-wiki-output.py # Check rendering issues
3. All wiki pages have sidebar entries
4. No special characters in wiki-link display text

`sync-wiki.py` also validates that every `WIKI_STRUCTURE` page appears in
the generated sidebar and fails fast if any mapped page is missing.

`sync-wiki.py` now enforces deterministic writer normalization for generated
markdown: non-empty outputs end with exactly one LF newline (trailing
whitespace/newlines are normalized). This prevents churn with
`end-of-file-fixer` and keeps repeated sync runs idempotent.

Sidebar coverage validation runs before any wiki writes, so an invalid sidebar
template fails early without leaving partial regenerated output.

### Common Errors

| Error | Fix |
|-------|-----|
| Error | Fix |
| -------------------------------- | ---------------------------- |
| Link points to non-existent page | Add file or fix sidebar link |
| `docs/file.md` not mapped | Add to `WIKI_STRUCTURE` |
| Wiki page has no sidebar entry | Add to `generate_sidebar()` |
| Stale WIKI_STRUCTURE mapping | Remove entry |
| `docs/file.md` not mapped | Add to `WIKI_STRUCTURE` |
| Wiki page has no sidebar entry | Add to `generate_sidebar()` |
| Stale WIKI_STRUCTURE mapping | Remove entry |

## Markdown Link Validation

### Relative Path Resolution

Links resolve from the directory containing the markdown file:

| From | To Root | Example |
|------|---------|---------|
| `docs/` | `../` | `[README](../README.md)` |
| `.github/` | `../` | `[Context](../.llm/context.md)` |
| `.llm/skills/<category>/` | `../../../` | `[README](../../../README.md)` |
| From | To Root | Example |
| ------------------------- | ----------- | ------------------------------- |
| `docs/` | `../` | `[README](../README.md)` |
| `.github/` | `../` | `[Context](../.llm/context.md)` |
| `.llm/skills/<category>/` | `../../../` | `[README](../../../README.md)` |

### Heading Anchor Generation Rules

Expand All @@ -153,11 +172,11 @@ Links resolve from the directory containing the markdown file:
4. ` / ` becomes `--`
5. `~` removed

| Heading | Anchor |
|---------|--------|
| `## Quick Start` | `#quick-start` |
| Heading | Anchor |
| ------------------------------------ | ------------------------------ |
| `## Quick Start` | `#quick-start` |
| `## LAN / Local Network (~20ms RTT)` | `#lan--local-network-20ms-rtt` |
| `## Web / WASM Integration` | `#web--wasm-integration` |
| `## Web / WASM Integration` | `#web--wasm-integration` |

### Pipe Escaping in Tables

Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ repos:
pass_filenames: false
files: '\.md$'

- id: sync-wiki
name: sync wiki mirrors
entry: python scripts/docs/sync-wiki.py
language: python
pass_filenames: false
files: '^(docs/.*\.md|wiki/.*\.md|scripts/docs/sync-wiki\.py)$'

- id: wiki-consistency
name: wiki consistency check
entry: python scripts/docs/check-wiki-consistency.py
Expand Down
3 changes: 2 additions & 1 deletion .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ resimulates = "resimulates"
resimulating = "resimulating"

# Mathematical/algorithmic variable names
ba = "ba" # b minus a
ba = "ba" # b minus a
ser = "ser" # Mermaid state diagram alias in docs/replay.md and wiki/Replay.md

# Technical terms
clonable = "clonable"
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Breaking

- **Breaking:** `FortressEvent::ReplayDesync` — new variant added. Since `FortressEvent` is not `#[non_exhaustive]`, exhaustive matches must now handle this variant.

### Added

- `ReplaySession::new_with_validation()` constructor that enables checksum validation mode, emitting `SaveGameState` requests and comparing checksums against the replay recording
- `ReplaySession::is_validating()` accessor to check if checksum validation mode is enabled
- `SessionBuilder::start_replay_session_with_validation()` builder method for creating a validation-enabled replay session
- `SessionTelemetry` trait for observing session performance events (rollbacks, prediction misses, frame advances, network stats)
- `CollectingTelemetry` test helper that accumulates `TelemetryEvent` values for assertions
- `TelemetryEvent` enum with `Rollback`, `PredictionMiss`, `NetworkStatsUpdate`, and `FrameAdvance` variants
- `SessionBuilder::with_telemetry()` to attach a telemetry observer to P2P sessions
- `Replay<I>` type for recorded match data with `to_bytes()` / `from_bytes()` serialization using deterministic bincode codec
- `ReplayMetadata` type containing library version, player count, and total frame count
- `ReplaySession<T>` session type implementing `Session<T>` for deterministic replay playback
- `SessionBuilder::with_recording(bool)` to enable input recording during P2P sessions
- `SessionBuilder::start_replay_session(replay)` to create a replay playback session
- `P2PSession::is_recording()` to check if replay recording is active
- `P2PSession::into_replay()` to extract the recorded `Replay` after a session ends (consumes the session)
- `P2PSession::take_replay()` to extract the recorded `Replay` without consuming the session (recording stops after extraction)
- `Replay::validate()` to verify internal consistency of replay data
- Re-exports `Replay`, `ReplayMetadata`, and `ReplaySession` in prelude

### Changed

- `P2PSession` now captures actual game state checksums during replay recording (previously always recorded `None`)

Comment thread
wallstop marked this conversation as resolved.
Outdated
## [0.7.0]

### Added
Expand Down
21 changes: 0 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ renamed_function_params = "warn" # Consistent parameter names across
try_err = "warn" # Use ? instead of Err(e)?
undocumented_unsafe_blocks = "warn" # Require SAFETY comments on unsafe

# cargo-shear: macroquad and z3 are optional deps behind feature flags
# (graphical-examples and z3-verification). They cannot be dev-dependencies
# because dev-deps cannot be feature-gated in Cargo.
[package.metadata.cargo-shear]
ignored = ["macroquad", "z3"]

[features]
sync-send = []
# Enable runtime invariant checking in release builds (for debugging production issues)
Expand Down Expand Up @@ -379,8 +385,6 @@ proptest = "1.11"
serde_json = "1.0"
# Benchmarking
criterion = { version = "0.8", features = ["html_reports"] }
# Additional testing utilities
arbitrary = { version = "1.3", features = ["derive"] }
# Macro utilities for data-driven tests
pastey = "0.2"

Expand Down
Loading
Loading