Skip to content

Implement 0086 PromptManager default cache TTL#227

Merged
chris-colinsky merged 2 commits into
mainfrom
feature/0086-prompt-default-cache-ttl
Jul 21, 2026
Merged

Implement 0086 PromptManager default cache TTL#227
chris-colinsky merged 2 commits into
mainfrom
feature/0086-prompt-default-cache-ttl

Conversation

@chris-colinsky

Copy link
Copy Markdown
Member

Phase A of the v0.17.0 cycle (proposal 0086, prompt-management §6, spec v0.79.0).

PromptManager construction accepts an optional default_cache_ttl_seconds, applied to any fetch or get that omits a per-call cache_ttl_seconds. Resolution follows a precedence chain:

  1. an explicit per-call value (including 0 force-fresh) wins;
  2. otherwise the manager default;
  3. otherwise None, so the backend's own caching governs.

An omitted or explicit-None per-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. get delegates to fetch and inherits the chain, and the bundled caching backends already honor a resolved cache_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: FixtureManagerSpec gains default_cache_ttl_seconds and an optional backends (036's manager: block omits it and defaults to all declared backends), and a new ManagerTarget models 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 /review and /adversarial-review; all actionable findings folded in. Full suite green.

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.
Copilot AI review requested due to automatic review settings July 21, 2026 02:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_seconds to PromptManager and apply precedence resolution when forwarding cache_ttl_seconds to 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.

Comment thread CHANGELOG.md Outdated
Comment thread src/openarmature/prompts/manager.py
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.
@chris-colinsky
chris-colinsky merged commit 011e5b7 into main Jul 21, 2026
6 checks passed
@chris-colinsky
chris-colinsky deleted the feature/0086-prompt-default-cache-ttl branch July 21, 2026 02:22
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.

2 participants