Skip to content

Add a compatible session clock for reproducible template dates - #1383

Merged
leehack merged 10 commits into
mainfrom
feat/859-template-now
Oct 25, 2026
Merged

leehack merged 10 commits into
mainfrom
feat/859-template-now

Conversation

@leehack

@leehack leehack commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

Add TemplateTimeChatSession so each request uses one configured time for context budgeting and generation, including one-shot, structured-output and tool-loop paths. Apply explicit template clocks to strftime_now as well as date globals.

Closes #859. Uses published Dinja 1.3.2 from dinja#40.

Production-readiness scope

  • User-facing scope: Reproducible Dart-rendered prompt dates. The clock is captured when a request stream is listened to; changes affect the next request. Reset keeps the setting, and null restores the normal clock.
  • Supported platforms/paths: Dart template rendering on native and Web paths. Existing ChatSession implementations, subclasses and application extensions retain their public contract.
  • Unsupported or intentionally unavailable paths: Runtime-owned LiteRT-LM templates retain their runtime clock; this is documented rather than claiming native clock injection.
  • Out of scope / follow-ups: No shared request-options redesign, runtime pin change or deprecated language-option restoration. Versioned validation-pack clock coverage remains Keep the validation suite in step with public features #1196.

Completeness checklist

  • Declared API scope implemented with defaults preserved.
  • Unsupported/runtime-owned behavior documented.
  • Public Dartdoc, README, guide, runnable example, support matrix, consumer skill and both Unreleased changelogs updated.
  • Snapshot, trimming, reset/retry, structured/tool-loop, legacy-interface and application-extension regressions included.
  • Validation registry has a reasoned Keep the validation suite in step with public features #1196 exemption and inventory tests pass.
  • No credentials or secret-bearing payloads added; no global mutable template clock.
  • Follow-up scope is tracked above.

PR type guidance

  • Feature/bugfix: Additive session subtype avoids a required interface member or colliding extension. The real rendering test exposed the existing strftime clock gap; the reviewed dependency helper fixes it without copying a formatter or changing the default clock.

Test Plan

  • Published Dinja archive checksum and all 13 library files match independently audited owner source.
  • Ordinary pinned workspace preparation resolves published 1.3.2 without an override; generated chat lockfile committed.
  • Clean pinned preparation, format, analysis, platform boundaries and release-doc consistency against hosted Dinja 1.3.2.
  • Added clock-dependent renderer-to-parser tests: full parser suite 211 passed on VM and Chrome; explicit valid and malformed character-split results.
  • Final production/test freeze: VM 7909 passed / 123 skipped, Chrome 3690 passed / 1 skipped, docs links/build passed. Generated chat, docs and private-harness locks all pin hosted 1.3.2. The lock-only final revision also passes a real desktop bundle build with a clean source tree.
  • Fresh independent review accepted exact final head; no blocking findings. Focused VM/Chrome, parser, compiled grammar, format/analyze and all eleven causal controls passed. Formal v2 returns expected exit 2 / unverifiedPrerequisites; external enforcement is unconfigured, not claimed satisfied.
  • All applicable feature-head CI passed at 49beb9f1, including desktop bundles on Linux/macOS/Windows. The actual registry conflict with newly merged main is resolved at b22350ac; new-head CI is pending and combined-main verification follows the user-approved individual merges. Core run.

Matrix Evidence

Matrix row Scope covered Platform / model / backend Result Evidence / notes
static-format-analyze API, dependencies and platform boundaries Flutter 3.47.1 / Dart 3.13.1 PASS Clean preparation, format/analyze, boundaries and release-doc verification; no override.
root-vm / root-chrome Default regressions and real template rendering VM / Chrome, production renderer with fake backend PASS Counts above; final-head hosted Linux/Windows/macOS/Chrome lanes passed. No model inference is needed to assert prompt date rendering or API compatibility.
structured-output-adversarial Session forwarding, rollback and existing grammar contract VM / Chrome PASS 1461 template/parser/structured VM cases, 434 Chrome cases and eleven compiled-grammar controls; conservative shared-renderer impact reviewed.
docs-site API usage, support limits and example Jaspr PASS Built and checked links against hosted Dinja 1.3.2.
high-risk-exact-head-independent-qa Snapshot, rendering and compatibility controls Fresh independent auditor PASS Exact final revision accepted; eleven causal controls fail as intended and were restored.

Review Notes

Head b22350ac352132954d37caaf21d1e57d900d5126; current base b373a77ba56b134a6ff8a542130d684e226e4415. Dinja prerequisite is merged, published and archive-verified. Feature audit, CI, consumer tests/docs and clean desktop bundle verification passed at 49beb9f1. After #1425/#1424 landed, GitHub reported an actual registry conflict; both complete mappings were preserved. A bounded independent merge-resolution review is refreshed at b22350ac. Current-head CI is pending rather than represented as passed; the user requested merge first and verify combined main afterward.

High-risk regression review

  • Classification: High-risk: artifactConsumer, backendRuntime and conservative structuredOutput impact; all three recorded as affected.
  • Implementation task: Expose templateNow and guard ChatSession request-option parity #859 / existing Add a compatible session clock for reproducible template dates #1383.
  • Independent blocking QA task: Fresh template_clock_independent_audit; accepted final head. Evidence /private/tmp/template-clock-independent-audit/{REPORT.md,evidence-input.json,evaluation.json}.
  • Exact head / current base: Revisions above.
  • Production-branch deletion, bypass, or miswire proof: Eleven independently verified controls cover budget/generation forwarding, snapshot, clock injection, export, registry and renderer-to-parser/compiled-grammar paths. All restored; sole final lock change verified independently.
  • Affected-family real-model/artifact evidence: Published Dinja 1.3.2 archive verified. Prompt clock behavior uses the actual renderer; no inference-output change is claimed.
  • Explicit unavailable-family or other N/A evidence: Runtime-owned LiteRT-LM clock injection is outside scope; model/device inference is unnecessary for date-rendering assertions.
  • Known PR-caused P1 regressions: 0.
  • Unresolved review threads: 0 at exact-head readiness refresh.

@leehack

leehack commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Parked out of 0.16.2: the new exported ChatSessionTemplateNow extension can collide with an app's own templateNow extension on ChatSession (audit at 544f379), and the maintainer wants no minor bump for this release. Stays a draft until the API shape is decided; the exported-names test also needs the new name pinned.

@leehack leehack changed the title Forward templateNow through ChatSession requests Add a compatible session clock for reproducible template dates Oct 25, 2026
@leehack
leehack marked this pull request as ready for review October 25, 2026 18:30
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Chat app preview removed for leehack/llamadart-chat-pr-1383.

…sion

# Conflicts:
#	packages/llamadart_validation/assets/capability_coverage.json
@leehack
leehack merged commit f100bed into main Oct 25, 2026
11 of 12 checks passed
@leehack
leehack deleted the feat/859-template-now branch October 25, 2026 18:49
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.

Expose templateNow and guard ChatSession request-option parity

1 participant