codeburn/tests/providers
iamtoruk 0e11b51516 fix(cache): make the shard layout safe against a second live writer
Two live processes share one cache directory routinely (a one-shot CLI
beside the resident serve child, two menubar polls), and the shard layout
had two ways to lose data there.

- The atomic write used a FIXED temp name, so two writers publishing the
  envelope — every save does — shared one `envelope.json.tmp` and
  interleaved into a torn payload, or one deleted the shards the other's
  envelope named. 39 of 40 rounds ended in a total cache loss. The temp
  name carries a nonce again, as it did before the shard layout.
- A save reused a shard filename from its own load snapshot without
  checking the file was still there. Another process republishing that
  provider unlinks the old shard, so the stale writer published an
  envelope naming a deleted file — read back as a corrupt provider and
  dropped whole, including PR-linked orphans no re-parse can recover. A
  reused shard is now existence-checked, and re-verified once more
  immediately before the envelope is published; a vanished one is
  rewritten from memory.

Also:
- Progress saves take a 30s floor beside the file counter. Only the
  claude scan reports per file; every other provider calls saveProgress
  once at its own boundary, so the counter alone never fired there.
- The unreferenced-shard sweep waits an hour (temps still 5 minutes): an
  unreferenced shard may belong to a concurrent save whose envelope has
  not landed yet.
- The sweep also retires the pre-v8 single-file temps in the parent
  directory, which nothing writes anymore.
- The shard directory is created 0o700.
- The claude and provider paths mark the cache dirty where they DELETE a
  stale entry, not only where they replace it: an unreadable file skips
  the replace, and the deletion would otherwise live only in memory.
- Codex only treats a grown file as an append when the recorded boundary
  still lands just after a newline, so a same-inode rewrite that happens
  to end up larger re-parses instead of resuming mid-line.
2026-08-16 19:23:39 -07:00
..
antigravity.test.ts
claude-config-dirs.test.ts
cline-cli.test.ts
cline.test.ts
codebuff.test.ts
codewhale.test.ts
codex-resume.test.ts
codex.test.ts
copilot-skills.test.ts
copilot.test.ts
crush.test.ts
cursor-agent.test.ts
cursor-bubble-dedup.test.ts
cursor-large-db-cap.test.ts
cursor-real-tokens.test.ts
cursor-workspace-breakdown.test.ts
cursor.test.ts
devin.test.ts
droid.test.ts
forge.test.ts
gemini.test.ts
grok.test.ts
hermes.test.ts
ibm-bob.test.ts
kilo-code.test.ts
kimi.test.ts
kimicode.test.ts
kiro.test.ts
lingtai-tui.test.ts
mistral-vibe.test.ts
mux.test.ts
omp.test.ts
open-design.test.ts
openclaude.test.ts
openclaw.test.ts
opencode-file.test.ts
opencode.test.ts
pi.test.ts
quickdesk.test.ts
roo-code.test.ts
vercel-gateway.test.ts
vscode-cline-parser.test.ts
warp.test.ts
zcode.test.ts
zed.test.ts
zerostack.test.ts