Implement 0086 PromptManager default cache TTL#227
Merged
Conversation
PromptManager construction gains an optional default_cache_ttl_seconds
(prompt-management proposal 0086). fetch and get resolve the effective
cache_ttl_seconds by precedence: an explicit per-call value (including
0 force-fresh) wins; otherwise the manager default; otherwise None, so
the backend's own caching governs. An omitted or explicit-None per-call
value both select the default, so resolution is presence-independent.
A negative default is rejected at construction; the per-call negative
rejection is unchanged. get delegates to fetch and inherits the chain,
and the bundled caching backends already honor a resolved value, so no
backend changed.
Un-defers conformance fixture 036 (runtime and parse), wiring the
manager default-cache-ttl construction slot and the {manager: true}
target form into the prompt-management harness. Adds seven unit tests,
the concepts/prompts doc, and the 0.17.0 changelog entry.
There was a problem hiding this comment.
Pull request overview
Implements proposal 0086’s service-wide default cache TTL for PromptManager, aligning runtime behavior and conformance harness support with spec v0.79.0.
Changes:
- Add
default_cache_ttl_secondstoPromptManagerand apply precedence resolution when forwardingcache_ttl_secondsto backends. - Un-defer and support prompt-management fixture 036 by extending the conformance harness models and runner target shapes.
- Add unit + conformance coverage and document the new default TTL behavior; mark proposal 0086 implemented in
conformance.toml.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_prompts.py | Adds unit tests that assert TTL precedence at the backend boundary. |
| tests/conformance/test_prompt_management.py | Updates fixture runner to support {manager: true} targets and manager defaults; un-defers fixture 036. |
| tests/conformance/test_fixture_parsing.py | Removes parsing-layer deferral for fixture 036. |
| tests/conformance/harness/prompt_management.py | Extends fixture schema with optional backends, default_cache_ttl_seconds, and ManagerTarget. |
| src/openarmature/prompts/manager.py | Adds default_cache_ttl_seconds to PromptManager and resolves TTL precedence in fetch (affecting get). |
| docs/concepts/prompts.md | Documents service-wide default TTL behavior and precedence. |
| conformance.toml | Marks proposal 0086 as implemented since 0.17.0 with explanatory note. |
| CHANGELOG.md | Adds 0.17.0 entry describing the new default TTL feature. |
Address CoPilot review on #227: - CHANGELOG 0.17.0 header uses a hyphen, not an em dash, per .github/copilot-instructions.md (new entries avoid the em dash; older headers are intentionally left as-is). - The fetch negative-ttl ValueError message no longer says "None preserves current behavior"; with a manager default configured, per-call None selects the default. Reworded to match the precedence. Comment/wording only; no behavior change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase A of the v0.17.0 cycle (proposal 0086, prompt-management §6, spec v0.79.0).
PromptManagerconstruction accepts an optionaldefault_cache_ttl_seconds, applied to anyfetchorgetthat omits a per-callcache_ttl_seconds. Resolution follows a precedence chain:0force-fresh) wins;None, so the backend's own caching governs.An omitted or explicit-
Noneper-call value both select the default, so resolution does not depend on argument presence. A negative default is rejected at construction; the per-call negative rejection is unchanged.getdelegates tofetchand inherits the chain, and the bundled caching backends already honor a resolvedcache_ttl_seconds(0072), so no backend changed.Conformance
Un-defers fixture 036 at both the runtime and parse layers. Two harness additions carry the fixture's shape:
FixtureManagerSpecgainsdefault_cache_ttl_secondsand an optionalbackends(036'smanager:block omits it and defaults to all declared backends), and a newManagerTargetmodels the{manager: true}dict target form (Literal[True], so{manager: false}is rejected).Tests / docs
Seven unit tests pin each precedence branch at the backend boundary (default-on-omit, explicit-None-selects-default, per-call-0 override, no-default-forwards-None, zero default, negative reject, and get() inheritance), plus fixture 036 end-to-end (default applied, clock aging across the boundary, per-call 0 override). Docs updated in
concepts/prompts.md; new## [0.17.0]changelog section.Reviewed with
/reviewand/adversarial-review; all actionable findings folded in. Full suite green.