Use shared assets instead of prompt prefix change detectors

This commit is contained in:
2026-07-21 13:59:28 +00:00
parent 3d70920f3d
commit e01b8d1b6d
2 changed files with 49 additions and 74 deletions

View File

@@ -56,34 +56,28 @@ module-specific message:
wording differs by lane. Factor the common bytes into one message and leave
the differences in later messages instead.
Tests inspect the fully rendered Scriptorium request boundary. Source-level
message identity alone is not treated as proof of cache identity.
Shared messages are embedded once and referenced by every applicable prompt.
This makes reuse of the canonical asset the easiest way to preserve cache
identity and avoids parallel module-specific copies that can drift.
### Exact Prompt And Input Identity Is Protected
### Shared Prompt Ownership And Input Behavior Are Protected
Focused tests at the narrowest stable boundary expose the fully prepared
provider-neutral request.
Focused tests protect shared asset composition and input behavior without
snapshotting the length or exact boundary of the common message prefix.
- Render each extractor prompt with the same transcript and campaign
references and assert that the intended common message prefix has identical
roles, content bytes, ordering, and cache-control metadata.
- Assert that spells and combat turns render identical NPC-registry messages
for the same bound or unbound registry.
- Verify that each applicable prompt mounts and renders the canonical shared
assets rather than module-specific copies.
- Verify common input material identity, including name, media type, content,
digest, origin URI, size, empty-value representation, reference ordering,
and `roster` fallback behavior.
- Test both identical and intentionally different chunks and reference sets so
the test proves the cache boundary rather than merely snapshotting one
request.
- Add an explicit assertion for the length of the common prefix. A new
module-specific message inserted inside that prefix should require deliberate
review.
- Test that every prompt fingerprint includes exactly the assets actually
rendered by that prompt. The current grouped reference hash helper should be
replaced or refined so a module does not fingerprint an unused shared asset,
while no used asset is omitted.
- Prefer semantic assertions over complete prompt snapshots, except for the
common rendered prefix whose exact bytes are the behavior under protection.
- Document the expected shared message ordering and cache-control policy so
later changes are reviewed against the caching intent.
- Prefer behavioral and ownership assertions over message-count, prefix-length,
or full-prompt snapshots.
### Stable Extraction Preparation Is Centralized
@@ -175,10 +169,10 @@ This roadmap is complete when:
- the three lanes expose the same stable structural conventions while keeping
documented domain differences local;
- shared provider-visible messages and inputs are produced from one source and
verified byte-for-byte at the rendered-request boundary;
- the common prompt prefix is deliberate, tested, and as long as extraction
quality permits;
- shared provider-visible messages are produced from canonical shared assets,
and shared inputs have one deterministic implementation;
- the common prompt ordering is deliberate, documented, and as cache-friendly
as extraction quality permits;
- every validator policy that affects reusable results participates in
checkpoint identity;
- source-reference traversal and diagnostics no longer drift between lanes;