-
Notifications
You must be signed in to change notification settings - Fork 1
Phase 7: full WorldlineState replay and checkpoint-backed playback #304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
5810cbe
docs: close phase 5 status gap
flyingrobots 219ba2c
feat(tooling): harden post-phase5 dev loop
flyingrobots a6ffe8f
test(tooling): disable signing in verify-local fixtures
flyingrobots e1e8e4b
feat(wasm): remove legacy read adapters for abi v2
flyingrobots dfd31bd
feat(wasm): land abi v3 logical clock boundary
flyingrobots 9d29321
chore(hooks): record hook timings in local csv logs
flyingrobots 7874587
feat(replay): rebuild full worldline state from provenance
flyingrobots 4ab2bd7
feat(replay): cut over playback to full worldline checkpoints
flyingrobots 8f868fb
feat(replay): accelerate provenance replay from full-state checkpoints
flyingrobots 2c2086a
feat(replay): unify playback with provenance replay
flyingrobots 1d94c7d
docs: mark phase 7 complete in implementation plan
flyingrobots 9f62438
fix(tooling): skip deleted markdown paths in docs lint
flyingrobots 3ae7143
fix(replay): harden scheduler and checkpoint invariants
flyingrobots c8df037
fix(ttd-browser): adapt browser cursors to typed ticks
flyingrobots e753280
chore(tooling): clean up PR feedback follow-ups
flyingrobots a78999e
test(playback): prove checkpoint restore path
flyingrobots 7124311
test(warp-core): fix append-only provenance invariants
flyingrobots 754bd88
test(playback): remove redundant checkpoint clone
flyingrobots de346c9
test(playback): document stable isolated-node fixture roots
flyingrobots a7b3355
fix(replay): harden replay checkpoints and review tooling
flyingrobots 90940fb
fix(phase7): resolve self-review findings
flyingrobots 0a5824b
fix(review): resolve hook and replay follow-ups
flyingrobots c5b88c4
docs: update changelog for phase 7 follow-ups
flyingrobots e55385c
docs: clarify phase 7 snapshot migration
flyingrobots b3cabad
fix(review): close remaining ABI and tooling threads
flyingrobots b19ff1e
fix(review): resolve final phase 7 follow-ups
flyingrobots 53f8798
docs: note final phase 7 review fixes
flyingrobots 0e21171
fix(review): harden final phase 7 follow-ups
flyingrobots afbf5b7
docs: clarify final phase 7 review semantics
flyingrobots 7b268b8
fix(review): resolve final phase 7 thread gaps
flyingrobots 7825fc2
docs: align final phase 7 review notes
flyingrobots 7c5cb54
fix(review): trim final replay and adapter follow-ups
flyingrobots 537fe83
fix(review): resolve final phase 7 code and tooling gaps
flyingrobots 61e1e98
fix(playback): validate replay base on no-op seeks
flyingrobots 533c900
docs: note phase 7 completion and ADR wording
flyingrobots df608cd
fix(review): harden final phase 7 code and tooling gaps
flyingrobots 6261953
docs(spec): clarify deterministic U0 observation payloads
flyingrobots e6a0a66
docs: note final phase 7 Rabbit review fixes
flyingrobots 6400642
fix(tests): checkpoint fixtures use replay state
flyingrobots cc5aaaf
fix(tests): checkpoint playback uses replay state
flyingrobots d54cea1
fix(warp-core): harden replay validation follow-ups
flyingrobots 97bb876
fix(tooling): tighten timing and verifier coverage
flyingrobots 128ee62
fix(abi): clarify scheduler wire contract
flyingrobots 20ea5e0
docs: note review-driven phase 7 fixes
flyingrobots 914cb38
test(warp-core): remove expect from review fixtures
flyingrobots File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,174 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # © James Ross Ω FLYING•ROBOTS <https://github.com/flyingrobots> | ||
|
|
||
| hook_timing_detect_method() { | ||
| if command -v python3 >/dev/null 2>&1; then | ||
| printf '%s\n' "python3_monotonic_ns" | ||
| else | ||
| printf '%s\n' "date_epoch_seconds_as_ns" | ||
| fi | ||
| } | ||
|
|
||
| hook_timing_fallback_now_ns() { | ||
| printf '%s000000000\n' "$(date +%s)" | ||
| } | ||
|
|
||
| hook_timing_now_ns() { | ||
| case "${DX_HOOK_TIMING_METHOD:-$(hook_timing_detect_method)}" in | ||
| python3_monotonic_ns) | ||
| if ! command -v python3 >/dev/null 2>&1; then | ||
| if [[ -n "${DX_HOOK_START_NS:-}" ]]; then | ||
| printf '%s\n' "${DX_HOOK_START_NS}" | ||
| else | ||
| hook_timing_fallback_now_ns | ||
| fi | ||
| return 0 | ||
| fi | ||
|
|
||
| local monotonic_ns="" | ||
| if monotonic_ns="$( | ||
| python3 - <<'PY' 2>/dev/null | ||
| import time | ||
|
|
||
| print(time.monotonic_ns()) | ||
| PY | ||
| )"; then | ||
| printf '%s\n' "$monotonic_ns" | ||
| else | ||
| if [[ -n "${DX_HOOK_START_NS:-}" ]]; then | ||
| printf '%s\n' "${DX_HOOK_START_NS}" | ||
| else | ||
| hook_timing_fallback_now_ns | ||
| fi | ||
| fi | ||
| ;; | ||
| *) | ||
| hook_timing_fallback_now_ns | ||
| ;; | ||
| esac | ||
| } | ||
|
|
||
| hook_timing_prepare() { | ||
| DX_HOOK_REPO_ROOT="$1" | ||
| DX_HOOK_NAME="$2" | ||
| DX_HOOK_TIMING_METHOD="$(hook_timing_detect_method)" | ||
| DX_HOOK_START_NS="$(hook_timing_now_ns)" | ||
| DX_HOOK_TIMING_RECORDED=0 | ||
| } | ||
|
|
||
| hook_timing_lock_metadata_file() { | ||
| printf '%s\n' "$1/owner" | ||
| } | ||
|
|
||
| hook_timing_write_lock_metadata() { | ||
| local lock_dir="$1" | ||
| local meta_file | ||
| meta_file="$(hook_timing_lock_metadata_file "$lock_dir")" | ||
| printf 'pid=%s\nstarted_at=%s\n' "$$" "$(date +%s)" >"$meta_file" 2>/dev/null || true | ||
| } | ||
|
|
||
| hook_timing_lock_is_stale() { | ||
| local lock_dir="$1" | ||
| local meta_file pid="" started_at="" key value now stale_after | ||
| meta_file="$(hook_timing_lock_metadata_file "$lock_dir")" | ||
| stale_after="${DX_HOOK_TIMING_STALE_LOCK_SECS:-30}" | ||
|
|
||
| if [[ ! -f "$meta_file" ]]; then | ||
| return 1 | ||
| fi | ||
|
|
||
| while IFS='=' read -r key value; do | ||
| case "$key" in | ||
| pid) pid="$value" ;; | ||
| started_at) started_at="$value" ;; | ||
| esac | ||
| done <"$meta_file" | ||
|
|
||
| if [[ -n "$pid" ]]; then | ||
| if kill -0 "$pid" 2>/dev/null; then | ||
| return 1 | ||
| fi | ||
| return 0 | ||
| fi | ||
|
|
||
| if [[ "$started_at" =~ ^[0-9]+$ ]]; then | ||
| now="$(date +%s)" | ||
| if (( now >= started_at && now - started_at >= stale_after )); then | ||
| return 0 | ||
| fi | ||
| fi | ||
|
|
||
| return 1 | ||
| } | ||
|
|
||
| hook_timing_reap_stale_lock() { | ||
| local lock_dir="$1" | ||
| if ! hook_timing_lock_is_stale "$lock_dir"; then | ||
| return 1 | ||
| fi | ||
| rm -rf "$lock_dir" 2>/dev/null || true | ||
| return 0 | ||
| } | ||
|
|
||
| hook_timing_release_lock() { | ||
| local lock_dir="$1" | ||
| rm -f "$(hook_timing_lock_metadata_file "$lock_dir")" 2>/dev/null || true | ||
| rmdir "$lock_dir" 2>/dev/null || true | ||
| } | ||
|
|
||
| hook_timing_append() { | ||
| local exit_code="${1:-$?}" | ||
| if [[ "${DX_HOOK_TIMING_RECORDED:-0}" == "1" ]]; then | ||
| return 0 | ||
| fi | ||
| DX_HOOK_TIMING_RECORDED=1 | ||
|
|
||
| local repo_root="${DX_HOOK_REPO_ROOT:-}" | ||
| local hook_name="${DX_HOOK_NAME:-}" | ||
| local start_ns="${DX_HOOK_START_NS:-}" | ||
| if [[ -z "$repo_root" || -z "$hook_name" || -z "$start_ns" ]]; then | ||
| return 0 | ||
| fi | ||
|
|
||
| local end_ns elapsed_ns elapsed_ms csv_dir csv_file timestamp_utc | ||
| local lock_dir lock_acquired=0 attempts=0 | ||
| end_ns="$(hook_timing_now_ns)" | ||
| elapsed_ns=$(( end_ns - start_ns )) | ||
| if (( elapsed_ns < 0 )); then | ||
| elapsed_ns=0 | ||
| fi | ||
| elapsed_ms=$(( elapsed_ns / 1000000 )) | ||
| csv_dir="${repo_root}/.dx-debug" | ||
| csv_file="${csv_dir}/${hook_name}-times.csv" | ||
| timestamp_utc="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" | ||
|
|
||
| mkdir -p "$csv_dir" 2>/dev/null || return 0 | ||
| lock_dir="${csv_file}.lock" | ||
| while (( attempts < 100 )); do | ||
| if mkdir "$lock_dir" 2>/dev/null; then | ||
| lock_acquired=1 | ||
| hook_timing_write_lock_metadata "$lock_dir" | ||
| break | ||
| fi | ||
| hook_timing_reap_stale_lock "$lock_dir" || true | ||
| attempts=$(( attempts + 1 )) | ||
| sleep 0.01 | ||
| done | ||
| if [[ "$lock_acquired" != "1" ]]; then | ||
| return 0 | ||
| fi | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if [[ ! -s "$csv_file" ]]; then | ||
| printf 'timestamp_utc,elapsed_ms,exit_code,pid\n' >>"$csv_file" 2>/dev/null || { | ||
| hook_timing_release_lock "$lock_dir" | ||
| return 0 | ||
| } | ||
| fi | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| printf '%s,%s,%s,%s\n' \ | ||
| "$timestamp_utc" \ | ||
| "$elapsed_ms" \ | ||
| "$exit_code" \ | ||
| "$$" >>"$csv_file" 2>/dev/null || true | ||
| hook_timing_release_lock "$lock_dir" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,11 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| set -euo pipefail | ||
| HOOK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| REPO_ROOT="$(cd "$HOOK_DIR/.." && pwd)" | ||
| # shellcheck source=.githooks/_timing.sh | ||
| source "$HOOK_DIR/_timing.sh" | ||
| hook_timing_prepare "$REPO_ROOT" "pre-rebase" | ||
| trap 'hook_timing_append $?' EXIT | ||
| echo "[pre-rebase] Rebase is disallowed for this repository. Use merge instead." >&2 | ||
| exit 1 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.