From 1da4af498bfedd5c783169111adad529adbc5ecf Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Mon, 21 Sep 2026 16:14:04 +0700 Subject: [PATCH] chore: add push/PR CI, drop unused windows dep, refresh docs Add a CI workflow running fmt, clippy with warnings denied, and the test suite on every push and pull request. Remove the unused workspace windows dependency now that only windows-sys is used. Update the README architecture name and Java harness reference, clarify the plans gitignore comment, and carry the code-reviewer agent memory. --- .claude/agent-memory/code-reviewer/MEMORY.md | 1 + .../feedback_history-rewrite-verification.md | 18 +++++++++++++ .github/workflows/ci.yml | 27 +++++++++++++++++++ .gitignore | 2 +- Cargo.toml | 3 ++- README.md | 4 +-- 6 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 .claude/agent-memory/code-reviewer/MEMORY.md create mode 100644 .claude/agent-memory/code-reviewer/feedback_history-rewrite-verification.md create mode 100644 .github/workflows/ci.yml diff --git a/.claude/agent-memory/code-reviewer/MEMORY.md b/.claude/agent-memory/code-reviewer/MEMORY.md new file mode 100644 index 0000000..b3d74a9 --- /dev/null +++ b/.claude/agent-memory/code-reviewer/MEMORY.md @@ -0,0 +1 @@ +- [History rewrite verification](feedback_history-rewrite-verification.md) — raw-byte message compare, empty-tree fsck false positive, merge commits in "linear" chains diff --git a/.claude/agent-memory/code-reviewer/feedback_history-rewrite-verification.md b/.claude/agent-memory/code-reviewer/feedback_history-rewrite-verification.md new file mode 100644 index 0000000..61eb75c --- /dev/null +++ b/.claude/agent-memory/code-reviewer/feedback_history-rewrite-verification.md @@ -0,0 +1,18 @@ +--- +name: history-rewrite-verification +description: Gotchas when verifying content-replacement git history rewrites before a force push (raw message bytes, virtual empty tree, backup ref) +metadata: + type: feedback +--- + +When verifying a replayed/rewritten git history before an irreversible force push: + +- Compare commit messages as RAW BYTES from `git cat-file commit ` (slice after the first blank line by byte offset). `--format=%B` appends a trailing newline and will mask or fabricate a diff. A prior build in this project was rejected for exactly this. +- `git fsck` reporting `missing tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904` (the empty tree) is a FALSE POSITIVE. Git special-cases the empty tree, so it is absent from the object DB yet `cat-file -e` succeeds and `pack-objects` still builds a valid pack. Prove push viability with `pack-objects --stdout --revs --thin` rather than trusting fsck. +- Do not call a chain "linear" from commit count alone. Check `rev-list --min-parents=2`; a preserved segment can legitimately carry an inherited merge commit. + +**Why:** these three checks each produce a confident-looking pass/fail that is wrong, and the force push is irreversible. + +**How to apply:** on any repo-merge / history-rewrite review. Also confirm the remote backup ref exists via `git ls-remote --heads` BEFORE approving, since it is what keeps the orphaned SHAs alive on GitHub. + +Related: [[repo-merge-blast-radius-checks]] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2ed331a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: ci + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +jobs: + check: + name: fmt-clippy-test-windows-x64 + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust toolchain (pinned by rust-toolchain.toml) + uses: dtolnay/rust-toolchain@nightly + with: + components: rustfmt, clippy + + - uses: Swatinem/rust-cache@v2 + + - run: cargo fmt --all -- --check + - run: cargo clippy --workspace --all-targets -- -D warnings + - run: cargo test --workspace diff --git a/.gitignore b/.gitignore index 0dfd196..35ade69 100644 --- a/.gitignore +++ b/.gitignore @@ -21,5 +21,5 @@ Thumbs.db # Logs *.log -# Plans (we keep the C# project's plans separate) +# Plans (stateful working notes, not shipped docs) /plans/ diff --git a/Cargo.toml b/Cargo.toml index 79f5daf..a80be71 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,10 +13,11 @@ edition = "2021" license = "Apache-2.0" authors = ["tiennm99"] repository = "https://github.com/tiennm99/time-mocker" +# MSRV is informational: rust-toolchain.toml pins nightly, which retour needs for +# inline x64 detours. Stable rustc is not supported (see README § Requirements). rust-version = "1.90" [workspace.dependencies] -windows = { version = "0.58", default-features = false } windows-sys = "0.59" [profile.release] diff --git a/README.md b/README.md index 366f96b..da8a33e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A Windows tool that injects fake time into running processes by hooking Win32 ti ## Architecture ``` -time-mocker-rs/ +time-mocker/ ├── crates/ │ ├── time-mocker-core/ — shared types (MockTimeInfo) + named MMF helper + tick conversions │ ├── time-mocker-hook/ — cdylib injected into target processes; hooks 5 time APIs via retour @@ -90,4 +90,4 @@ Apache-2.0 — see [LICENSE](LICENSE). ## Related - `csharp/`, `cpp/` — earlier C# (EasyHook) and C++ (MS Detours) ports, preserved in git history only: `git log -- csharp/ cpp/` -- [`target/`](target/) — Java test target that validates injected fake time +- [`java-target/`](java-target/) — Java (Gradle) harness that prints the JVM clock every second, for observing the fake time from a managed runtime