Skip to content

Conversation

@klappradla
Copy link
Member

NOTE: also remove the CURRENT_LLM_SYSTEM_PROMPT_ID environment variable
from the production and staging systems.

This adds a new boolean field - "active" to system prompts. The field
has a unique index on it, so that there can always only be one active
system prompt.

The migration also migrates the currently activated prompt from the runtime
configuration to be set to "active". If the configuration isn't present
any more, a random prompt from the DB will be set to as the active one.
The test is only verifying whether the unique index is present and
working as expected.
The test was not really testing anything: it was not checking whether
the system prompt was actually gone from the page. In fact, it checked
the opposite…

The problem was, that there are already two prompts in the database. And
as they are all from the same factory, they share the same prompt…
Activating a system prompt deactivates the currently active one.
We'll keep the configuration for a smoother migration path for now.
Also: update migration to only activate an existing system prompt of
there is no active one yet.
I felt like this makes the tests harder to reason about.
llm_config: %{
# Random IDs that is used in the tests!
model_config_provider_id: "9a21bfd3-cb0a-433c-a9b3-826143782c81",
system_prompt_id: "96123e4b-7d0a-4e14-82d4-63d68562e8f1",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can also get rid of the use of test_system_prompt_id() in the tests then, right? ✂️

Copy link
Member Author

Choose a reason for hiding this comment

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

Sweet! Done that 🗑️

NOTE: also remove the `CURRENT_LLM_SYSTEM_PROMPT_ID` environment variable
from the production and staging systems.
@klappradla klappradla force-pushed the story/ex-111-follow-up branch from 773edf3 to 83f9da5 Compare October 2, 2025 11:15
Base automatically changed from story/ex-111-activate-a-system-prompt to main October 13, 2025 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants