diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 248cd864..00000000 --- a/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM node:22-slim -RUN apt-get update && apt-get install -y \ - bats \ - git \ - python3 \ - make \ - g++ \ - && rm -rf /var/lib/apt/lists/* -WORKDIR /app -# Copy git-warp -COPY git-warp/package*.json ./ -COPY git-warp/scripts ./scripts -COPY git-warp/patches ./patches -RUN npm install -COPY git-warp . -RUN git init -q \ - && git config user.email "container@git-warp.local" \ - && git config user.name "Git Warp Container" \ - && git add -A \ - && git commit --allow-empty -m "seed git-warp" >/dev/null -RUN printf '%s\n' '#!/usr/bin/env bash' 'exec node /app/bin/warp-graph.js "$@"' > /usr/local/bin/warp-graph -RUN chmod +x /usr/local/bin/warp-graph \ - && install -m 0755 /app/bin/git-warp /usr/local/bin/git-warp -ENV GIT_STUNTS_DOCKER=1 -# Default to tests, but can be overridden for benchmark -CMD ["npm", "test"] diff --git a/Dockerfile b/Dockerfile new file mode 120000 index 00000000..1836fdfd --- /dev/null +++ b/Dockerfile @@ -0,0 +1 @@ +docker/Dockerfile.node22-slim \ No newline at end of file diff --git a/FIXUPS.md b/FIXUPS.md deleted file mode 100644 index 742d5e6d..00000000 --- a/FIXUPS.md +++ /dev/null @@ -1,85 +0,0 @@ -# SEEKDIFF Code Review — Fixups - -Deep self-review of `seekdiff` branch (commit `9f3e02a`). -Severity: **BUG** = correctness issue, **PERF** = wasted work, **UX** = user-facing rough edge, **NIT** = code quality / style. - ---- - -## BUG - -- [x] **B1. `--diff-limit=0` produces misleading output.** Rejected `0` at parse time — validation now requires a positive integer (`n < 1`). Added BATS test for `--diff-limit=0`, `--diff-limit=-1`, and missing value. - - **Fix:** `bin/warp-graph.js` — `handleDiffLimitFlag` validation changed from `n < 0` to `n < 1` - ---- - -## PERF - -- [x] **P1. Triple materialization in the `latest` action.** When `--diff` already materialized at `maxTick`, skip the redundant `graph.materialize()` call. Non-diff path now uses `{ ceiling: maxTick }` for consistency. - - **Fix:** `bin/warp-graph.js` — `if (!sdResult) { await graph.materialize({ ceiling: maxTick }); }` - -- [x] **P2. Redundant re-materialization in `tick` and `load` actions.** Same pattern: skip `materialize()` when `computeStructuralDiff` already left the graph at the target tick. - - **Fix:** `bin/warp-graph.js` — `if (!sdResult) { await graph.materialize(...) }` in both paths - -- [x] **P3. No short-circuit when `prevTick === currentTick`.** Added early return with empty diff result when ticks are identical. - - **Fix:** `bin/warp-graph.js` — `computeStructuralDiff` returns empty diff immediately - ---- - -## UX - -- [x] **U1. `--diff` and `--diff-limit` missing from `HELP_TEXT`.** Added both flags to the Seek options section. - - **Fix:** `bin/warp-graph.js` — `HELP_TEXT` - -- [x] **U2. `--diff` silently ignored on `--save`, `--drop`, `--list`, `--clear-cache`.** Added validation at end of `parseSeekArgs`: `--diff` rejects with usage error when combined with non-navigating actions. Allowed on `status`, `tick`, `latest`, `load`. Added BATS test for `--save --diff` rejection. - - **Fix:** `bin/warp-graph.js` — `DIFF_ACTIONS` set check after parse loop - -- [x] **U3. Display truncation hides data-level truncation hint.** Combined message now shown when both display and data truncation are active: `"... and N more changes (N total, use --diff-limit to increase)"`. Added unit test. - - **Fix:** `src/visualization/renderers/ascii/seek.js` — `buildStructuralDiffLines` three-way if/else - -- [x] **U4. Truncation strategy is greedy, not proportional (misleading comment).** Fixed comment to say "greedy in category order." - - **Fix:** `bin/warp-graph.js` — comment at `applyDiffLimit` - ---- - -## NIT - -- [x] **N1. `getStateSnapshot()` JSDoc type in CLI typedef uses `@property {() => Promise<*>}`.** Fixed to reference `WarpStateV5 | null`. - - **Fix:** `bin/warp-graph.js` — `WarpGraphInstance` typedef - -- [x] **N2. `formatStructuralDiff(payload)` on the status render path is dead code.** Removed the dead call; added comment explaining status never carries diff data. - - **Fix:** `bin/warp-graph.js` — `renderSeek` status branch - -- [x] **N3. `applyDiffLimit` comment says "proportionally" — see U4.** Fixed alongside U4. - - **Fix:** `bin/warp-graph.js` - -- [x] **N4. `buildStructuralDiffLines` uses magic number 20 in two places.** Moved `MAX_DIFF_LINES` constant above `buildFooterLines` so both call sites reference the constant. - - **Fix:** `src/visualization/renderers/ascii/seek.js` — hoisted constant - -- [x] **N5. `collectDiffEntries` uses `@param {*}` for the diff parameter.** Changed to `import(...).StateDiffResult`. - - **Fix:** `src/visualization/renderers/ascii/seek.js` - -- [x] **N6. `buildStructuralDiffLines` uses `@param {*}` for the payload parameter.** Changed to `SeekPayload`. - - **Fix:** `src/visualization/renderers/ascii/seek.js` - -- [x] **N7. No unit test for `--diff-limit` argument parsing edge cases.** Added 4 BATS tests: `--diff-limit=0` rejected, `--diff-limit` without value rejected, `--diff-limit=-1` rejected, `--diff --save` rejected. - - **Fix:** `test/bats/cli-seek.bats` - -- [x] **N8. No test for `--diff` combined with `--latest` or `--load`.** Added BATS test for `--latest --diff --json`. Added 2 renderer unit tests for `latest` and `load` action payloads with `structuralDiff`. Added 1 unit test for combined display+data truncation. - - **Fix:** `test/bats/cli-seek.bats`, `test/unit/visualization/ascii-seek-renderer.test.js` - ---- - -## Summary - -| Severity | Count | Fixed | -|----------|-------|-------| -| BUG | 1 | 1 | -| PERF | 3 | 3 | -| UX | 4 | 4 | -| NIT | 8 | 8 | -| **Total**| **16**| **16**| - -### Verification - -- `npx eslint` — clean -- `npx vitest run` — 3209 passed, 0 regressions (8 pre-existing failures: 7 Deno/Docker-only, 1 flaky EPIPE) diff --git a/README.md b/README.md index 56b15b49..c8877e69 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [](https://www.npmjs.com/package/@git-stunts/git-warp)
-
+
node event-sourcing.js
+node scripts/event-sourcing.js
Prints the conceptual explanation to the console.
Treat every patch as a business event and use materialize as the projection step that builds the current domain state.
-Run it with node event-sourcing.js to write the event log and project it.
Run it with node scripts/event-sourcing.js to write the event log and project it.
node explore.js
+node scripts/explore.js
Requires setup.js to have created the demo graph.
This example re-opens the graph created in setup.js in read-only mode and demonstrates how to query nodes, properties, and neighbors.
-Run it with node explore.js after setup.js has created the graph.
Run it with node scripts/explore.js after setup.js has created the graph.
CREATE_CHECKPOINT=1 node inspect-index.js
+CREATE_CHECKPOINT=1 node scripts/inspect-index.js
Creates a checkpoint if one does not exist.
Inspect checkpoints and the serialized blobs that let materialize resume without replaying every patch.
-Run it with node inspect-index.js to build and decode a checkpoint.
Run it with node scripts/inspect-index.js to build and decode a checkpoint.
node lagrangian-path.js
+node scripts/lagrangian-path.js
Demonstrates resource-aware routing over WARP state.
Build a weighted graph and run shortest-path searches. Edge properties become costs, so traversal optimizes for resources.
-Run it with node lagrangian-path.js to build the graph and compute paths.
Run it with node scripts/lagrangian-path.js to build the graph and compute paths.
node multi-writer.js
+node scripts/multi-writer.js
Creates two writer refs under the same graph name.
Two writers append patches to the same graph name. Git keeps their histories separate while materialize merges them into one graph.
-Run it with node multi-writer.js to create both writer refs and patches.
Run it with node scripts/multi-writer.js to create both writer refs and patches.
node setup.js
+node scripts/setup.js
Creates user and post nodes, then materializes the graph.
This is your first WarpGraph. It writes three patches into a fresh repo, then materializes the CRDT state into a tiny social graph.
-Run it with node setup.js to create the repo, writer ref, and patches.
Run it with node scripts/setup.js to create the repo, writer ref, and patches.
node streaming-benchmark.js
+node scripts/streaming-benchmark.js
Adjust NODE_COUNT to stress test.
Stream a long chain of nodes into batches, then measure ingest speed, commit overhead, and materialization cost.
-Run it with node streaming-benchmark.js to generate a large chain and timings.
Run it with node scripts/streaming-benchmark.js to generate a large chain and timings.
node traversal-benchmark.js
+node scripts/traversal-benchmark.js
Creates synthetic graphs and times pathfinding.
Generate graphs of different shapes and sizes, then benchmark traversal algorithms against the materialized state.
-Run it with node traversal-benchmark.js to generate graphs and timings.
Run it with node scripts/traversal-benchmark.js to generate graphs and timings.