Cleanup after the name generator: the old AI names code, and only used runs kept (#1345) #1353

Merged
claude-bot merged 5 commits from chore/1345-names-cleanup into main 2026-11-06 21:03:41 +00:00
Collaborator

Findings for #1345.

1. Old AI names code. audio_service.generate_name_options had no caller outside tests: the session route POST /sessions/{id}/name-options/generate (its handler shares the name) runs the names Workbench tool, which draws from app/names/ through name_service.draw. Prep's Names drawer uses that, and Describe uses name_service.describe, which does not touch what was removed. Removed: the function, _NAME_CATEGORY_DESCRIPTION_HINTS, _NAME_CATEGORY_DESCRIPTION_HINTS_BY_SYSTEM, _NAME_GENERATOR_SYSTEM_PROMPT, the three pf2e/free-form/dnd5e hint tests, and the generate_name_options half of test_names_sends_its_schema. Kept: NAME_OPTIONS_SCHEMA (the names tool's output schema, used by generation_service).

2. Names runs. A "names run" is a generation_results row with tool_id='names'. Every draw is persisted (sheet route and Planning both go through run_and_record), plus one name_offers row per name. The old retention kept an unused run for 30 days. A draw reads name_offers and the wiki titles and aliases (name_service.excluded_keys), never generation_results, so name_offers alone gives "never twice" and is untouched.

Signals for "used": a run in a prep sheet or For later (kept_clause, "Keep it") was already recorded. Saving to the wiki records no link to the run (Planning calls createLoreEntry, a sheet calls canonical-names), and "copied" is client-only, recorded nowhere. So a run counts as used when kept_clause holds it, or one of its names (compared by name_key) is now a live wiki page title or alias in the same campaign. Copying does not count.

Done: generation_result_service.delete_unused_names_runs (24 h), called from the existing daily prune_generation_results task. No migration.

Closes #1345.

🤖 Generated with Claude Code

Findings for #1345. **1. Old AI names code.** `audio_service.generate_name_options` had no caller outside tests: the session route `POST /sessions/{id}/name-options/generate` (its handler shares the name) runs the `names` Workbench tool, which draws from `app/names/` through `name_service.draw`. Prep's Names drawer uses that, and Describe uses `name_service.describe`, which does not touch what was removed. Removed: the function, `_NAME_CATEGORY_DESCRIPTION_HINTS`, `_NAME_CATEGORY_DESCRIPTION_HINTS_BY_SYSTEM`, `_NAME_GENERATOR_SYSTEM_PROMPT`, the three pf2e/free-form/dnd5e hint tests, and the `generate_name_options` half of `test_names_sends_its_schema`. Kept: `NAME_OPTIONS_SCHEMA` (the `names` tool's output schema, used by `generation_service`). **2. Names runs.** A "names run" is a `generation_results` row with `tool_id='names'`. Every draw is persisted (sheet route and Planning both go through `run_and_record`), plus one `name_offers` row per name. The old retention kept an unused run for 30 days. A draw reads `name_offers` and the wiki titles and aliases (`name_service.excluded_keys`), never `generation_results`, so `name_offers` alone gives "never twice" and is untouched. Signals for "used": a run in a prep sheet or For later (`kept_clause`, "Keep it") was already recorded. Saving to the wiki records no link to the run (Planning calls `createLoreEntry`, a sheet calls `canonical-names`), and "copied" is client-only, recorded nowhere. So a run counts as used when `kept_clause` holds it, or one of its names (compared by `name_key`) is now a live wiki page title or alias in the same campaign. Copying does not count. Done: `generation_result_service.delete_unused_names_runs` (24 h), called from the existing daily `prune_generation_results` task. No migration. Closes #1345. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test: use a real names style in the sweep test (#1345)
Some checks failed
CI / Summarisation accuracy eval harness (stub provider) (pull_request) Successful in 1m3s
CI / Backend lint (ruff) (pull_request) Successful in 1m7s
CI / Feedback site tests (pull_request) Successful in 1m3s
CI / Bot/backend version sync (pull_request) Successful in 54s
CI / Bot tests and audit (pull_request) Successful in 2m23s
CI / Which journeys does this change need? (pull_request) Successful in 21s
CI / Does this change touch the recording path? (pull_request) Successful in 29s
CI / Docker image build (pull_request) Successful in 2m32s
CI / Frontend (shard 2/2) (pull_request) Successful in 11m9s
CI / Frontend (shard 1/2) (pull_request) Successful in 11m32s
CI / End-to-end journeys (desktop) (pull_request) Successful in 12m59s
CI / Synthetic session harness (no GPU, no LLM) (pull_request) Successful in 26m32s
CI / Backend migration, tests, and audit (pull_request) Failing after 1h25m11s
84f05c3b69
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
style: ruff format (#1345)
All checks were successful
CI / Backend lint (ruff) (pull_request) Successful in 34s
CI / Summarisation accuracy eval harness (stub provider) (pull_request) Successful in 1m57s
CI / Feedback site tests (pull_request) Successful in 1m2s
CI / Bot/backend version sync (pull_request) Successful in 52s
CI / Docker image build (pull_request) Successful in 25s
CI / Bot tests and audit (pull_request) Successful in 2m25s
CI / Does this change touch the recording path? (pull_request) Successful in 35s
CI / Which journeys does this change need? (pull_request) Successful in 28s
CI / Frontend (shard 1/2) (pull_request) Successful in 13m4s
CI / Synthetic session harness (no GPU, no LLM) (pull_request) Successful in 11m27s
CI / Frontend (shard 2/2) (pull_request) Successful in 18m41s
CI / End-to-end journeys (desktop) (pull_request) Successful in 13m53s
CI / Backend migration, tests, and audit (pull_request) Successful in 1h12m40s
908e63fce7
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No description provided.