feat(#70): IMP-41 application_mode forwarding to FramePanel V4 badge tooltip (u1~u5)

Forward backend Step 9 `unit.application_candidates[]` (application_mode /
auto_applicable / delegated_to) onto FrameCandidate and surface the
application_mode as a Korean consequence phrase in the FramePanel V4-label
inline badge tooltip. Deterministic frontend-only refactor; no LLM call,
no V4-label color change, no outer composedTitle change.

u1: types/designAgent.ts — add optional applicationMode / autoApplicable /
    delegatedTo on FrameCandidate (legacy fixtures keep undefined).
u2: services/applicationMode.ts (new) — pure helper exporting
    ApplicationMode union, APPLICATION_MODE_TOOLTIP_KR (keyed by backend
    mode VALUE, NOT V4 label), buildBadgeTitle, mergeApplicationCandidates.
u3: tests/imp41_application_mode.test.ts (new) — 13 Vitest cases pinning
    composite output per mode, undefined/unknown→legacy fallback, merge by
    template_id, skip missing/empty/non-string keys, first-wins on dupes,
    empty/null/non-array input.
u4: services/designAgentApi.ts — bridge consumes mergeApplicationCandidates
    and forwards three fields onto FrameCandidate while preserving
    LABEL_PRIORITY sort and TOP_N_FRAMES slicing.
u5: components/FramePanel.tsx — V4-label badge `title` now calls
    `buildBadgeTitle(candidate.label, candidate.applicationMode)`;
    badge color className map preserved verbatim; outer composedTitle
    untouched.

Scope-qualified verification (5 files, IMP-41 axis only):
- Vitest: client/tests/imp41_application_mode.test.ts — 13/13 PASS.
- Diff↔Plan parity: 5 files match Stage 2 plan, no scope creep.
- AI-isolation contract honored: tooltip values originate from backend
  enum; no frontend re-derivation from V4 label.
- No spacing/font shrink; clipping resolution stays at layout/zone/frame
  layer (feedback_phase_z_spacing_direction).

Pre-existing unrelated diagnostics (BottomActions.tsx,
imp47b_human_review_toast.test.tsx) remain open on their own axes and are
not gated by this commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-22 00:17:32 +09:00
parent 90503cadd6
commit f358604fb3
5 changed files with 232 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ import { Badge } from '@/components/ui/badge';
import { motion } from 'framer-motion';
import type { Zone, InternalRegion, UserSelection, FrameCandidate, SlidePlan } from '../types/designAgent';
import { getSectionsForZone } from '../utils/slidePlanUtils';
import { buildBadgeTitle } from '../services/applicationMode';
interface FramePanelProps {
slidePlan: SlidePlan | null;
@@ -235,6 +236,13 @@ export default function FramePanel({
</span>
)}
{/* V4 label badge */}
{/* IMP-41 u5 — tooltip delegated to pure helper
`buildBadgeTitle` (services/applicationMode.ts).
applicationMode is forwarded by designAgentApi.ts
(u4) from Step 9 unit.application_candidates[];
helper falls back to the raw V4 label when the
mode is undefined or unknown. Badge color mapping
is intentionally untouched per Stage 2 scope. */}
{candidate.label && (
<span
className={`text-[8px] font-black uppercase tracking-tight px-1.5 py-0.5 rounded ${
@@ -246,7 +254,7 @@ export default function FramePanel({
? "bg-amber-100 text-amber-700"
: "bg-red-100 text-red-700"
}`}
title={`V4 label: ${candidate.label}`}
title={buildBadgeTitle(candidate.label, candidate.applicationMode)}
>
{candidate.label}
</span>