sotashimozono_obsidian-remo.../plugin/tests/integration
sotashimozono 91da0f1e12
test: complete Phase C E2E case matrix (#109) (#235)
Closes #109. Brings the Phase C E2E suite from 8/9 cases to 9/9 by
adding the disconnect/queue/reconnect case and deepening two
existing cases per the issue spec.

## What changed in plugin/tests/integration/sync.e2e.test.ts

- "large file (1 MB)" → "large file (10 MB)". The issue specs 10 MB
  to push the wire-transfer envelope and verify the daemon doesn't
  time out on long writes. Budget multiplier bumped 5x → 20x for
  proportional headroom on slow CI links (~50 MB/s effective sftp
  throughput → ~200 ms transfer + reader's fs.changed → stat round-trip).

- 3-way conflict deepened. The pre-existing test only asserted the
  daemon rejects with PreconditionFailed (-32020). The new variant
  wires a real ConflictResolver + AncestorTracker on a third "Bob"
  adapter and verifies the full pipeline:
    Alice creates "version-1"  (becomes Bob's ancestor)
    Bob reads                  → ancestor remembered
    Alice overwrites with "alice-edit"  (becomes "theirs" on Bob)
    Bob writes "bob-edit"      → PreconditionFailed
      → ConflictResolver.resolve → onTextConflict({ancestor,mine,theirs})
      → stub returns keep-mine
    Remote ends up holding "bob-edit"
  This is the production wiring used by ThreeWayMergeModal — the old
  test only proved the daemon rejects, not that the resolver chain
  runs end-to-end.

- New: "disconnect → queue → reconnect" case. Pre-populates an
  OfflineQueue with mkdir + 3 writes and runs QueueReplayer against
  the connected writerAdapter. Asserts:
    - report.errors === []
    - report.drained === ops.length
    - queue is empty after drain
    - all 4 paths land on the reader's FakeFileExplorer
  Validates F3 (offline queue) + F6 (replay) + F19 (in-order
  delivery) from the plan's functional matrix. The "forcibly close
  the SSH socket" half of the spec is AdapterManager orchestration
  already covered by unit tests; this integration assertion is the
  one the unit suite can't make (queued ops surfacing as fs.changed
  events on the reader's vault).

## Imports added
- node:os + node:path (for the queue's tmp directory)
- ConflictResolver, ThreeWayPanes, AncestorTracker
- OfflineQueue, QueuedOp, QueueReplayer

## Verified locally
- tsc --noEmit clean
- npm run lint clean
- vitest run (unit suite) 780 pass / 1 Windows-skipped (integration
  tests don't run under `vitest run`; they're routed through
  vitest.integration.config.ts and require Docker test sshd)

## CI
The new integration tests will run under the `SSH integration` job
in .github/workflows/integration.yml, which spins up the Docker
test sshd. Local Windows can't exercise them; CI is the verification
path.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 08:45:21 +09:00
..
helpers fix(test): address code review comments on PR #211 2026-05-02 10:28:52 +09:00
daemon.deploy.test.ts fix(test): drop pgrep-based assertions, use socket-existence as daemon liveness signal 2026-04-28 11:03:23 +09:00
multiclient.rpc.test.ts test(plugin): Phase C.M5 — extract multiclientRpc helper for reuse (0.4.39) 2026-04-28 19:34:40 +09:00
multiclient.sftp.test.ts feat(test): Phase A1 — multi-client SFTP convergence integration tests + testing-strategy doc (0.4.19) 2026-04-28 10:51:08 +09:00
perf.sync.bench.test.ts fix: bench modify op expects 'created' not 'modified' event 2026-05-01 08:30:56 +09:00
ssh.integration.test.ts feat(test): docker sshd integration test environment (Tier B-1+B-3, 0.4.0) 2026-04-27 14:05:55 +09:00
sync.e2e.test.ts test: complete Phase C E2E case matrix (#109) (#235) 2026-05-04 08:45:21 +09:00
walk.equivalence.test.ts feat(test): Phase E1-α.3 — fs.walk vs adapter.list equivalence + qualitative benchmark (0.4.25) 2026-04-28 12:36:41 +09:00