Conversation
Tracking defaulted to on whenever APP_DEBUG was false, but its tables are
published in a separate opt-in step. The natural production install therefore
threw "no such table: prompt_versions" on the first Deck::get(). Caching gave
no protection, because the active version is resolved before the cache is
consulted, and prompt:activate failed the same way.
Tracking now defaults to off. Every database interaction is guarded and
degrades to metadata.json with a single logged warning:
- The connection is resolved through a latched helper, so a broken database
is attempted once per instance rather than once per prompt load. An
unreachable host would otherwise cost a connect timeout on every render,
which is worse than the fast crash it replaces. Throwable is caught there
because an undefined DECK_DB_CONNECTION raises InvalidArgumentException
from the connection resolver, not QueryException.
- track() catches Throwable and never rethrows. It runs after a completed,
paid-for AI call, and no analytics failure is worth discarding that.
- activate() degrades only when the table is genuinely absent, and rethrows
anything else. Swallowing a deadlock or constraint violation would write
metadata.json, return true, and leave the database — which
getActiveVersion() prefers — still pointing at the previous version.
activate() also now upserts rather than issuing an UPDATE that matched no rows
because nothing ever inserted them. The table was permanently empty, so the
lookup that crashed installs could fail but never succeed. Recording a version
requires user_prompt to be nullable, since Deck keeps content on disk.
Also fixes two unrelated defects in the same class:
- Prompt names were interpolated into filesystem paths unvalidated, so a
name containing '..' or a separator could read any file on disk.
- The version directory pattern was unanchored and applied to the full path,
so rev2, dev3 and archive-v9 registered as versions 2, 3 and 9 — listed by
prompt:list --all, then failing to load. PromptManager and make:prompt
must agree, so both are anchored against the directory name.
Records that tracking is now opt-in and how to turn it on, that prompt rendering never depends on it, and the constraints on prompt names. Documents the behaviour change with the widest reach: now that activate() genuinely populates prompt_versions, the database takes precedence over metadata.json, so editing active_version in git and deploying no longer changes what is served. Activation is environment state; the file is the bootstrap default. Adds an UPGRADE section covering the default flip, the new migration, and that anyone who published config/deck.php is unaffected.
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
track() validated the prompt name before its try block, so it threw on the one input the release had just taught it to reject — contradicting the promise in its own docblock two lines above. It builds no path; the name is only a column value, so the guard protected nothing. make:prompt still created names the manager refuses. Kebab-casing passes path separators through, so `make:prompt Support/Reply` scaffolded a nested support/reply that PromptManager rejects and prompt:list renders as a broken `support` entry at v0. Nested prompts never worked — prompt:list only ever scanned the top level — so the generator now fails cleanly rather than writing something unreadable. That is the same generator/loader disagreement this release already fixed for the version directory pattern, one file over, so the name pattern moves into a ValidatesPromptNames concern that both share. Two drifts of the same shape is enough to stop relying on the two staying in step by hand. The pattern is also re-anchored with \A and \z: $ matches before a trailing newline, so "order-summary\n" was accepted. Adds an UPGRADE note for anyone who organised prompts into subdirectories, which worked in 0.4.5 and does not now.
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.
Motivation and Context
Tracking defaulted to on in production, but its tables ship as a separate opt-in publish step. So the natural install
composer require, publish config, deploy threw on the firstDeck::get():Dependencies
None. One new migration, only if you use tracking. Two upgrade impacts, both in
UPGRADE.md:Test Instructions