Skip to content

fix: recheck staleness on every call when the stale TTL is 0 - #138

Merged
itsflaid merged 1 commit into
mainfrom
fix/mcp-stale-ttl
Oct 31, 2026
Merged

itsflaid merged 1 commit into
mainfrom
fix/mcp-stale-ttl

Conversation

@itsflaid

Copy link
Copy Markdown
Owner

Problem

The v0.9.0 Publish run failed at "Test CLI" with 481/482 passing, so nothing was published to npm.

The failing test was a flake: results flag a stale snapshot after the project changes (staleTtlMs: 0). snapshotProvider reused its cached staleness result while now() - checkedAt > ttl. With a TTL of 0, two calls in the same millisecond still shared the cache, so a file added between them was reported as stale: false. A fast runner makes that likely; it also failed about once in eight local runs.

Fix

  • now() - staleCache.at >= ttl: a TTL of 0 never caches. The default 10s TTL behaves as before.
  • Regression test with a frozen clock. It fails without the fix and passes with it.

Checks

  • pnpm test:cli: 483 pass, 0 fail
  • MCP server and freshness tests run 6 more times in a loop: no failures

Release

0.9.0 was never published to npm, so package.json stays at 0.9.0. The existing v0.9.0 tag points at the failed run's commit and needs to be moved to the merge of this PR before publishing again.


Generated by Claude Code

The snapshot provider reused its cached staleness result while now() - checkedAt > ttl. With staleTtlMs: 0 two calls in the same millisecond still shared the cache, so a file added in between was reported as stale:false. On a fast CI runner this made 'results flag a stale snapshot after the project changes' fail in the v0.9.0 publish run. The comparison is now >=, so a TTL of 0 never caches. Adds a frozen-clock regression test.
@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
devmap-web Skipped Skipped Oct 31, 2026 3:09am UTC

@github-actions

Copy link
Copy Markdown

✅ Welcome ke DevMap!

Terima kasih sudah buat PR. Pastikan checklist ini terpenuhi sebelum review:

  • devmap doctor lolos (tanpa error)
  • Test pnpm test:cli lolos (semua pass)
  • New commands diupdate di docs/commands.md
  • Tidak ada console.log di command files
  • Registry terms sesuai standar (baca docs/guide/05-signal-registry.md)
  • Code style match dengan CONTRIBUTING.md

CI akan jalan otomatis pada setiap update. Kalau gagal, akan muncul link run di komentar ini.

Kalau DevMap membantu, tolong star ya: https://github.com/itsflaid/devmap

Terima kasih kontribusinya! 🙏

@itsflaid
itsflaid merged commit 5c9cfb3 into main Oct 31, 2026
3 checks passed
@itsflaid
itsflaid deleted the fix/mcp-stale-ttl branch October 31, 2026 03:25

This branch was previously deployed

1 inactive deployment
Preview — 64969fb5 Deployed Oct 31, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants