v0.21.0 — daemon staleness fixes, server split, prefer_project
Overview
v0.21.0 delivers a new daemon architecture for fw-context watch with correct
staleness detection, server code reorganization into handler modules, a new
prefer_project parameter for lookup_definition, and shared dep-file parsing.
All users of the watch daemon should upgrade — stale detection is now reliable.
Changes
Features
- Daemon staleness detection overhaul — new
daemon.pymodule replaces
ad-hoc checks inbackground.py. Uses PID-file based reindex detection,
catches files modified before daemon startup, and deduplicates modified files
by resolved absolute path.fw-context watch statusnow reports accurate
Index state (running vs idle) and Modified count drops to 0 after clean
reindex. - Server split — tool implementations moved from
server.pyto handler
modules (handlers/maintenance.py,handlers/source.py), keeping the
FastMCP server entry point focused on registration. - prefer_project ordering —
lookup_definitiongets a newprefer_project
parameter that insertss.is_project DESCinto the ORDER BY clause so
project-code symbols sort before vendor/SDK symbols when both share the same
name. - Header staleness in get_active_build — when
deps_verificationis
"full",get_active_buildnow reports the count of TUs affected by stale
dependency headers. - Shared dep-file parsing —
dep_files.pyextracted as a shared utility
used by both the index runner and query-time header staleness detection.
Fixes
- False "Index: running" —
_is_bg_reindex_runningno longer checks
watcher.lock, which was always present when the daemon ran (idle included).
Replaced withreindex.pidwritten only during active index subprocess. - Stale header mtimes after git checkout — Tier 1 mtime fast-path now
always updates TU stored mtimes and refreshes dependency header mtimes.
A new_refresh_header_mtimesfinal pass catches remaining headers whose
mtime drifted but were never updated (e.g. when.dfiles are absent). - Duplicate entries in
_count_modified_files— deduplicated by resolved
absolute path, keeping the maximum stored mtime. Fixes duplicates from
files indexed under both absolute and relative path formats. - Missed startup files — daemon
_staleness_checknow calls
_count_modified_fileson startup so files modified before the watcher
started trigger an immediate index run.
| File | Change |
|---|---|
CLAUDE.md |
Add GPG-signed commits requirement |
src/fw_context_mcp/cli.py |
Write/remove reindex.pid for standalone index runs |
src/fw_context_mcp/config/tools.py |
Streamline BASE_INSTRUCTIONS (160 to 90 lines) |
src/fw_context_mcp/indexer/dep_files.py |
New — shared dep-file parsing utility |
src/fw_context_mcp/indexer/runner.py |
Tier 1 mtime updates, _refresh_header_mtimes pass |
src/fw_context_mcp/mcp/background.py |
Replace watcher.lock with reindex.pid check |
src/fw_context_mcp/mcp/daemon.py |
New — daemon with correct staleness detection |
src/fw_context_mcp/mcp/handlers/maintenance.py |
Header staleness check in get_active_build |
src/fw_context_mcp/mcp/handlers/source.py |
prefer_project param in lookup_definition |
src/fw_context_mcp/mcp/server.py |
Move tool impls to handler modules |
src/fw_context_mcp/mcp/shared/stale.py |
Deduplicate modified files, drop pathlib resolve |
tests/test_incremental_reindex.py |
Update for new staleness behavior |
tests/test_lookup_definition.py |
New — prefer_project ordering tests |
Breaking changes
None.