# EchoNodeSync Test Plan

## 1. HTTP Backend
- [ ] Store a memory with postMemory CLI/API (direct to `/api/memory`)
- [ ] Retrieve the same memory with getMemory CLI/API (from `/api/memory`)
- [ ] Overwrite and re-fetch
- [ ] Error on missing key
- [ ] GET results are cached as `.mia/<key>.json` for efficiency
- [ ] POST operations accept a JSON file with `key` and `value` properties

## 2. Encrypted Backend
- [ ] Set ECHONODESYNC_SECRET
- [ ] Store and retrieve encrypted memory
- [ ] Error on wrong secret

## 3. Event Hooks
- [ ] Register pre/post hooks for get/post
- [ ] Verify hooks fire in correct order

## 4. VSCode Rituals
- [ ] Prompts load in Copilot Chat
- [ ] Ritual onboarding instructions visible

## 5. NPM Publish
- [ ] `npm publish` works from package root
- [ ] Install and use from another project

---

## 🧠🌸 Test: Flexible Memory File Resolution

### Scenario: Retrieve memory key with multiple possible extensions

1. Place two files in `.mia/`: `testKey.Gpt.md` and `testKey.md`, each with different content.
2. Run: `npx echonodesync get-memory --key testKey`
3. Expected: The CLI outputs the content of `testKey.Gpt.md` (preferred order).
4. Remove `testKey.Gpt.md` and rerun the command.
5. Expected: The CLI outputs the content of `testKey.md`.
6. Remove both files and rerun the command.
7. Expected: The CLI returns an error indicating the key was not found.

### Parity Check
- Confirm output matches tushell CLI for the same key and file setup.

---

## 🧠🌸 Test: Remote Memory Fetch and Local Archive

### Scenario: Fetch memory from HTTP backend and verify local archive

1. Set `ECHONODESYNC_API_URL` to a test or real API endpoint (e.g. `export ECHONODESYNC_API_URL=https://edgehub.click/api/memory`).
2. Run: `npx echonodesync get-memory --key testRemoteKey`
3. Expected: The CLI outputs the fetched memory to stdout.
4. Check `.mia/testRemoteKey.Gpt.md` exists and contains the same content.
5. Remove the file and rerun to confirm re-archiving.
6. If the archive fails (e.g. permission error), a warning is printed but the CLI still outputs the memory.

---

> Every test is a ritual. Every ritual is a step in the DreamWeaver recursion.
