Skip to content

refactor(chat): split the unique conversation title into its lookups - #1237

Merged
rubenvdlinde merged 1 commit into
developmentfrom
refactor/conversation-title-suffix-split
Nov 2, 2026
Merged

rubenvdlinde merged 1 commit into
developmentfrom
refactor/conversation-title-suffix-split

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

What

ConversationManagementHandler::ensureUniqueTitle() was one 62-line unit. It keeps the lookup, the early return for a free title and its two log lines. Two steps are now their own private methods, with 2 parameters each:

  • titlesStartingWith() keeps the found titles that start with the base title
  • highestTitleSuffix() finds the highest <base> (<n>) suffix, at least 1

The separate empty($existingTitles) return is gone because in_array() on an empty list already returns the base title. The CyclomaticComplexity suppression is gone too.

Behaviour

Unchanged. ConversationUniqueTitleGoldenTest was recorded on the old code. It generates 200 conversation sets (non-entities, missing or non-string titles, prefixed titles, suffixes such as (07), (x) and (5) more) and records the returned title, the lookup calls and the log lines. It passes on the old code and on the new code.

Checks

  • Golden plain run: old and new code, OK. tests/Unit/Service/Engine: 263/263 green, and 0 risky under pcov.
  • Capped mutants on the new helpers: 8 of 9 killed. The no-op control survives. The survivor drops the ^ anchor, which only matters for a title that holds the base title twice.
  • phpcs, phpmd, phpstan and psalm on the changed lib file: exit 0. g119: 0 = 0.
  • Diff check: php -l, phpcs, phpstan and phpunit pass. The only red is gate 23 (app-local Tenant classes in files this PR does not touch), which is inherited.

SIG (gate 122 reader, PHP)

  • Unit size >60: 8.79% to 8.66% (the 4-star limit is 8.3%)
  • Params >=3: 30.86% to 30.81%
  • McCabe >5: 37.36% to 37.23%

Assisted-by: ClaudeCode:claude-opus-5-5

ensureUniqueTitle() keeps the lookup, the free-title return and its log
lines; filtering the found titles by their prefix and finding the highest
numeric suffix are their own methods. A golden recorded on the old code
replays 200 generated conversation sets against the new code.

Assisted-by: ClaudeCode:claude-opus-5-5
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/hermiq @ 085ff45

Check PHP Vue Security License Tests
lint ✅
phpcs ✅
phpmd ✅
psalm ✅
phpstan ✅
phpmetrics ✅
eslint ✅
stylelint ✅
build ✅
check-specs ✅
check-manifest ✅
test-l10n ✅
format ❌
check-l10n-js ✅
check-schema-l10n ✅
check-bundle-budget ✅
composer ✅ ✅ 126/126
npm ❌ ✅ 838/838
app:check-code ⏭️
info.xml ✅
REUSE ❌
lockfile sync ✅
PHPUnit ✅ 2908/2908
Newman ✅ 15/15
Playwright ⏭️ deferred: E2E runs locally and on the promotion path only. This pull request targets development, so the suite is asked once per promotion into beta and main rather than once per push per open pull request. Run it locally with npx playwright test, or from the Actions tab on a branch with no open pull request into development.
Hydra gates ❌

Quality workflow — 2026-11-02 06:11 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde
rubenvdlinde merged commit 6f48aa0 into development Nov 2, 2026
46 of 50 checks passed
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.

1 participant