Skip to content

fix(schema): keep --schema/NSC_SCHEMA overrides out of the profile cache (#196) - #197

Merged
thomaschristory merged 1 commit into
mainfrom
fix/schema-override-cache-leak
Oct 24, 2026
Merged

thomaschristory merged 1 commit into
mainfrom
fix/schema-override-cache-leak

Conversation

@thomaschristory

Copy link
Copy Markdown
Owner

Fixes #196.

The override path used _build_and_cache, which saved the override's model into the active profile's cache with a fresh fetched_at. Later runs without the override then used it:

  • TTL fast-path: with the default schema_refresh: daily, for 24 hours, with no fetch and no warning.
  • Offline fallback: _find_any_cached, whenever NetBox was unreachable.

Fix: the new _build_override never writes to the profile's cache and never calls touch_fetched_at. If the profile already has an entry with the same hash (identical schema content), it's reused read-only and the fast path is kept. Otherwise the model is built in memory, which costs about 0.2s for the full NetBox schema.

Manual check: I ran the repro from the issue under both daily and on-hash-change. The second run, without --schema, no longer sees the override.

Tests (in tests/schema/test_source_ttl.py):

  • an override doesn't satisfy a later TTL fast-path, and the live fetch happens;
  • the offline fallback doesn't serve an override;
  • a same-hash override reuses the cache entry without bumping its fetched_at.

Docs: CHANGELOG, docs/architecture/schema-loading.md.

https://claude.ai/code/session_01RD8NgCVtp3yYFd6NSZpbUb

…che (#196)

The override path saved its model into the active profile's cache with a
fresh fetched_at, so later runs without the override served it via the
TTL fast-path (default: daily) or the offline fallback. Never write or
touch the profile cache for an override; reuse a same-hash entry
read-only, else build in memory.

Claude-Session: https://claude.ai/code/session_01RD8NgCVtp3yYFd6NSZpbUb
@thomaschristory
thomaschristory merged commit 63fffe5 into main Oct 24, 2026
12 checks passed
@thomaschristory
thomaschristory deleted the fix/schema-override-cache-leak branch October 24, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--schema/NSC_SCHEMA override is cached as the profile's fresh schema and leaks into later runs

1 participant