fix(aliases): store modal alias under raw model key + make aliases visible/manageable
CI / lint (push) Successful in 3s
CI / frontend-build (push) Successful in 22s
CI / backend-lint-and-test (push) Successful in 35s
CI / integration (push) Successful in 3m7s

The headline bug: aliases created from the modal NEVER resolved. Create
sent the normalized display name ('Sword', 'Uchiha Sasuke') while
resolution keys on the raw booru model key ('sword', 'uchiha_sasuke',
case-sensitive) — so the mapping was stored under a key nothing looks up,
and the prediction kept reappearing unaliased. The raw key wasn't even in
the /suggestions response, so the modal couldn't send it.

- Suggestion now carries raw_name (the model key an alias must use) and
  via_alias (surfaced via an operator alias); both serialized by the API.
- Modal alias-create sends raw_name, not display_name (the fix). Aliased
  suggestions show an 'alias' badge and a 'Remove alias' action; 'Treat as
  alias for…' is hidden for centroid hits (no model key) and already-aliased
  rows.
- Tag-side management: TagCard ⋮ → 'Aliases…' opens a dialog listing the
  model keys that fold into a tag, with remove (GET /api/tags/<id>/aliases +
  AliasService.list_for_tag). Creation stays in the modal suggestion flow.

Tests: full API round-trip locking the raw-key contract (raw_name exposed →
alias authored with it → resolves + via_alias on a later image);
list_for_tag (service + API); via_alias/raw_name on the existing service
suggestion tests. No migration.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-12 13:05:58 -04:00
parent 7c4b24c80d
commit 5c3f8ebd70
15 changed files with 364 additions and 8 deletions
+18 -1
View File
@@ -25,7 +25,7 @@
v-for="c in store.cards" :key="c.id" :card="c"
@open="openTag" @rename="onRename" @manage="onManage" @read="onRead"
@merge-with="onMergeWith" @delete="onDeleteTag"
@set-fandom="onSetFandom"
@set-fandom="onSetFandom" @aliases="onAliases"
/>
</div>
@@ -96,6 +96,13 @@
@updated="onFandomUpdated" @cancel="fandomDialogOpen = false"
/>
</v-dialog>
<v-dialog v-model="aliasesDialogOpen" max-width="480">
<TagAliasesDialog
v-if="aliasesTarget" :tag="aliasesTarget"
@close="aliasesDialogOpen = false"
/>
</v-dialog>
</v-container>
</template>
@@ -111,6 +118,7 @@ import TagCard from '../components/discovery/TagCard.vue'
import MergeConfirmDialog from '../components/discovery/MergeConfirmDialog.vue'
import DestructiveConfirmModal from '../components/modal/DestructiveConfirmModal.vue'
import FandomSetDialog from '../components/modal/FandomSetDialog.vue'
import TagAliasesDialog from '../components/discovery/TagAliasesDialog.vue'
// Must stay a subset of the backend TagKind enum (character, fandom,
// general, series, archive, post). 'fandom' is this model's
@@ -165,6 +173,15 @@ function onFandomUpdated() {
store.reset() // reload so the card reflects the new fandom (or its removal)
}
// Tag-side alias view (TagCard ⋮ → Aliases…): see/remove the model keys that
// fold into this tag. Creation lives in the image modal's suggestion flow.
const aliasesDialogOpen = ref(false)
const aliasesTarget = ref(null)
function onAliases(card) {
aliasesTarget.value = card
aliasesDialogOpen.value = true
}
function onManage(id) {
router.push({ name: 'series-manage', params: { tagId: id } })
}