feat(A1): Minimum Usability Slice — CadenceInstance, Today-Übung, Gate-Fortschritt
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 4m54s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 13s

PO No-Go A1 adressieren: Tages-Tracking mit Messnotiz, Work-UI für Übung, Next-Action-Link, Gate-Fortschritt in Kontrolle, Eingang aus A1-Nav entfernt.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-07-28 12:32:23 +02:00
1 parent 0baa5952bc
commit b7d88ce24a
25 files changed
+936 -31

No files matched your search

+7
View File
@@ -21,3 +21,10 @@ export function updateRecurring(recurringId, body) {
export function deleteRecurring(recurringId) {
return apiFetch(`/api/recurring/${recurringId}`, { method: 'DELETE' })
}
export function completeRecurringPractice(recurringId, body = {}) {
return apiFetch(`/api/recurring/${recurringId}/complete`, {
method: 'POST',
body: JSON.stringify(body),
})
}
+53 -9
View File
@@ -1,28 +1,66 @@
import { useEffect, useState } from 'react'
import { Link } from 'react-router-dom'
import { MILESTONE_STATUS_LABELS } from '../constants/status.js'
import { listInitiativeRoadmapCriteriaProgress } from '../api/roadmap.js'
import { gatePath, scopedPath } from '../utils/routes.js'
import { EmptyState } from './EmptyState.jsx'
import { scopedPath } from '../utils/routes.js'
export function MaturityStagePanel({
initiativeId,
roadmapItems = [],
embedded = true,
}) {
const [criteriaProgress, setCriteriaProgress] = useState({})
const stages = [...roadmapItems]
.filter((item) => item.item_type === 'maturity_stage')
.sort((a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0))
const activeStage = stages.find((s) => s.status === 'active')
useEffect(() => {
if (!initiativeId) return undefined
let cancelled = false
listInitiativeRoadmapCriteriaProgress(initiativeId)
.then((data) => {
if (!cancelled) setCriteriaProgress(data || {})
})
.catch(() => {
if (!cancelled) setCriteriaProgress({})
})
return () => {
cancelled = true
}
}, [initiativeId, roadmapItems.length])
const activeProgress = activeStage ? criteriaProgress[activeStage.id] : null
const body =
stages.length === 0 ? (
<EmptyState message="Noch keine Reifegrad-Stufen — unter Plan anlegen oder Starter-Kit nutzen." />
) : (
<>
{activeStage && (
<p className="maturity-stage-active muted">
Aktive Stufe: <strong>{activeStage.title}</strong>
</p>
<>
<p className="maturity-stage-active muted">
Aktive Stufe:{' '}
<Link to={gatePath(activeStage.id)} className="link-inline">
<strong>{activeStage.title}</strong>
</Link>
</p>
{activeProgress && (
<p className="maturity-stage-progress muted">
Gate-Fortschritt:{' '}
<strong>
{activeProgress.closed ?? 0} / {activeProgress.total ?? 0}
</strong>{' '}
Kriterien erfüllt
{(activeProgress.open ?? 0) > 0 && (
<span> · {activeProgress.open} offen</span>
)}
</p>
)}
</>
)}
<ol className="item-list maturity-stage-list">
{stages.map((stage, index) => (
@@ -36,7 +74,9 @@ export function MaturityStagePanel({
>
<span className="maturity-stage-item__index muted">{index + 1}</span>
<div className="list-item-main">
<strong>{stage.title}</strong>
<Link to={gatePath(stage.id)} className="list-item-link">
<strong>{stage.title}</strong>
</Link>
<span className="muted list-item-sub">
{MILESTONE_STATUS_LABELS[stage.status] || stage.status}
</span>
@@ -45,9 +85,13 @@ export function MaturityStagePanel({
))}
</ol>
<p className="muted maturity-stage-hint">
Stufen und Übungen unter{' '}
<Link to={scopedPath('/control/journey', { initiativeId })} className="link-inline">
Kontrolle → Rhythmen & Journey
Kriterien und Verify am{' '}
<Link to={scopedPath('/plan/gates', { initiativeId })} className="link-inline">
Plan → Stufen
</Link>
; Übung unter{' '}
<Link to={scopedPath('/work/today', { initiativeId })} className="link-inline">
Ausführen → Heute
</Link>
.
</p>
@@ -62,7 +106,7 @@ export function MaturityStagePanel({
<div>
<h2>Reifegrad-Stufen</h2>
<p className="section-lead muted">
Aktive Stufe und Fortschritt — Steuerungshorizont für Reifegrad-Vorhaben (A1).
Aktive Stufe, Gate-Fortschritt und Orientierung — Steuerungshorizont (A1).
</p>
</div>
</div>
@@ -0,0 +1,99 @@
import { useMemo, useState } from 'react'
import { completeRecurringPractice } from '../api/recurring.js'
import { EmptyState } from './EmptyState.jsx'
function formatDue(iso) {
if (!iso) return null
try {
return new Date(iso).toLocaleString('de-DE', { dateStyle: 'medium', timeStyle: 'short' })
} catch {
return iso
}
}
/**
* A1 — Heutige Übung (CadenceInstance): Tages-Tracking mit optionaler Messnotiz.
*/
export function WorkTodayPracticePanel({
initiativeId,
recurringItems = [],
canManage = false,
onCompleted,
busy = false,
}) {
const [measurement, setMeasurement] = useState('')
const [submitting, setSubmitting] = useState(false)
const [error, setError] = useState(null)
const activePractice = useMemo(() => {
return (recurringItems || []).find((item) => item.status === 'active')
}, [recurringItems])
const openInstance = activePractice?.open_cadence_instance
if (!activePractice) {
return (
<section className="card work-today-practice" id="today-practice">
<EmptyState message="Keine aktive Übung — Starter-Kit oder Stufenwechsel prüfen." />
</section>
)
}
async function handleComplete(e) {
e.preventDefault()
if (!canManage || submitting) return
setSubmitting(true)
setError(null)
try {
await completeRecurringPractice(activePractice.id, {
measurement_note: measurement.trim() || undefined,
})
setMeasurement('')
await onCompleted?.()
} catch (err) {
setError(err.message)
} finally {
setSubmitting(false)
}
}
return (
<section className="card work-today-practice" id="today-practice">
<div className="section-header">
<div>
<h2>Heutige Übung</h2>
<p className="section-lead muted">
Tages-Tracking — erledigt markieren, optional Messwert notieren (z. B. Grad, Wiederholungen).
</p>
</div>
</div>
<div className="work-today-practice__focus">
<strong>{activePractice.title}</strong>
{openInstance?.due_at && (
<p className="muted list-item-sub">Fällig: {formatDue(openInstance.due_at)}</p>
)}
</div>
{canManage ? (
<form className="inline-form-block work-today-practice__form" onSubmit={handleComplete}>
<label>
Messwert / Notiz (optional)
<input
value={measurement}
onChange={(e) => setMeasurement(e.target.value)}
placeholder="z. B. 45° Spagat, 3×30 Sek."
maxLength={2000}
/>
</label>
{error && <p className="error">{error}</p>}
<button type="submit" className="btn btn-primary" disabled={submitting || busy}>
{submitting ? 'Speichern …' : 'Heute erledigt'}
</button>
</form>
) : (
<p className="muted">Keine Berechtigung zum Markieren der Übung.</p>
)}
</section>
)
}
@@ -37,6 +37,7 @@ export function InitiativeCompositionSurface({
uiFeatures: ops.uiFeatures,
dataSlices: ops.dataSlices,
onAcceptBacklogProposal,
refreshOm: ops.refreshOm,
}),
[
ops.initiativeId,
@@ -53,6 +54,7 @@ export function InitiativeCompositionSurface({
ops.uiFeatures,
ops.dataSlices,
onAcceptBacklogProposal,
ops.refreshOm,
],
)
@@ -78,6 +78,16 @@ export const COMPOSITION_PROVIDERS = [
scopeTypes: ['initiative'],
order: 16,
},
{
key: 'work.practice.today',
kind: 'steering_element',
steeringElement: 'recurring_rhythm',
slotKeys: ['work.today.primary'],
componentKey: 'WorkTodayPracticePanel',
requiresCapability: 'kairo.recurring.read',
scopeTypes: ['initiative'],
order: 5,
},
{
key: 'steering.next_action',
kind: 'steering_element',
@@ -7,6 +7,7 @@ import { RecurringRhythmPanel } from '../components/RecurringRhythmPanel.jsx'
import { AgentSlotsPanel } from '../components/AgentSlotsPanel.jsx'
import { SteeringProposalsPanel } from '../components/SteeringProposalsPanel.jsx'
import { NextActionWidget } from '../widgets/NextActionWidget.jsx'
import { WorkTodayPracticePanel } from '../components/WorkTodayPracticePanel.jsx'
import { WorkActionsPanel } from './WorkActionsPanel.jsx'
/** Roadblocker-Strip — extrahiert aus InitiativeOverviewPage für Composition. */
@@ -45,6 +46,7 @@ export const PROVIDER_COMPONENTS = {
RoadblockersStrip,
WidgetHost,
WorkActionsPanel,
WorkTodayPracticePanel,
}
/**
@@ -201,6 +201,18 @@ export function buildProviderProps(provider, input) {
initiativeId: ops.initiativeId,
recurringItems: ops.recurringItems || [],
}
case 'WorkTodayPracticePanel':
return {
initiativeId: ops.initiativeId,
recurringItems: ops.recurringItems || [],
canManage: capabilities.has('kairo.recurring.manage'),
busy: ops.formBusy,
onCompleted: async () => {
if (typeof ops.refreshOm === 'function') {
await ops.refreshOm(['recurring', 'steering_snapshot'])
}
},
}
case 'NextActionWidget': {
const nextActionUi = resolveNextActionUi(elements, input.steeringSnapshot)
return {
@@ -1,4 +1,4 @@
import { describe, expect, it } from 'vitest'
import { describe, expect, it, vi } from 'vitest'
import { COMPOSITION_PROVIDERS } from './compositionProviders.js'
import {
resolveSteeringComposition,
@@ -265,19 +265,39 @@ describe('resolveSteeringComposition', () => {
const result = resolveSteeringComposition({
surfaceKey: 'work.today',
scope: 'initiative',
capabilities: CAPS,
steeringElements: ['next_action_primary', 'critical_path'],
capabilities: new Set([...CAPS, 'kairo.recurring.read']),
steeringElements: ['next_action_primary', 'recurring_rhythm', 'critical_path'],
steeringSnapshot: { counts: {}, next_actions: [{ kind: 'action', title: 'X' }] },
opsContext: { initiativeId: 'init-1' },
})
expect(result.slots['work.today.primary']?.some((p) => p.key === 'steering.next_action')).toBe(
true,
)
expect(result.slots['work.today.primary']?.some((p) => p.key === 'work.practice.today')).toBe(
true,
)
expect(result.slots['work.today.actions']?.some((p) => p.key === 'work.actions.today')).toBe(
true,
)
})
it('buildProviderProps wires WorkTodayPracticePanel complete refresh', async () => {
const provider = COMPOSITION_PROVIDERS.find((p) => p.key === 'work.practice.today')
const refreshOm = vi.fn().mockResolvedValue(undefined)
const props = buildProviderProps(provider, {
opsContext: {
initiativeId: 'init-1',
recurringItems: [{ id: 'rec-1', status: 'active', title: 'Spagat' }],
formBusy: false,
refreshOm,
},
capabilities: new Set([...CAPS, 'kairo.recurring.read', 'kairo.recurring.manage']),
})
expect(props.canManage).toBe(true)
await props.onCompleted()
expect(refreshOm).toHaveBeenCalledWith(['recurring', 'steering_snapshot'])
})
it('activates sprint backlog provider when active work cycle', () => {
const result = resolveSteeringComposition({
surfaceKey: 'work.sprint',
+1 -1
View File
@@ -70,7 +70,7 @@ const ARCHETYPE_UI = {
planDefaultRoute: '/plan/gates',
workDefaultRoute: '/work/today',
controlDefaultRoute: '/control/status',
planOutlineKeys: ['profile', 'gates', 'inbox', 'work'],
planOutlineKeys: ['profile', 'gates', 'work'],
workNavKeys: ['today', 'mine', 'sprint'],
},
'initiative.program': {
@@ -64,6 +64,17 @@ describe('methodUiDefaults', () => {
expect(resolvePlanOutlineNodes({}).length).toBe(6)
})
it('maturity archetype omits inbox from plan outline', () => {
const ui = resolveMethodUiDefaults({ archetypeKey: 'initiative.maturity_journey' })
expect(ui.planDefaultRoute).toBe('/plan/gates')
expect(ui.planOutlineKeys).toEqual(['profile', 'gates', 'work'])
expect(resolvePlanOutlineNodes({ archetypeKey: 'initiative.maturity_journey' }).map((n) => n.key)).toEqual([
'profile',
'gates',
'work',
])
})
it('resolves active process step from pathname', () => {
const steps = resolveProcessSteps({ archetypeKey: 'initiative.product' })
expect(resolveActiveProcessStepKey('/plan/inbox', steps)).toBe('inbox')
+10
View File
@@ -9,7 +9,11 @@ import { WidgetCard } from '../components/WidgetCard.jsx'
import { actionPath, scopedPath } from '../utils/routes.js'
import { formatPortfolioRank } from '../utils/portfolioRank.js'
import { useProgramScope } from '../context/ProgramScopeContext.jsx'
function NextActionList({ items, initiativeId, showInitiativeLink = true }) {
const { hrefWithScope } = useProgramScope()
if (items.length === 0) {
return (
<EmptyState message="Keine Empfehlungen — entweder alles erledigt oder noch nichts zu steuern." />
@@ -17,6 +21,12 @@ function NextActionList({ items, initiativeId, showInitiativeLink = true }) {
}
function actionLinkForItem(item) {
if (item.recurring_id && item.initiative_id) {
return {
to: `${hrefWithScope('/work/today', { initiativeId: item.initiative_id })}#today-practice`,
label: 'Übung ausführen',
}
}
if (item.action_id) {
return { to: actionPath(item.action_id), label: 'Arbeitspaket' }
}