feat(steering): Backlog-Vokabular aus Methoden-Vertrag (ADP P3)
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Successful in 3m56s
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 19s
Test Suite / playwright-smoke (push) Successful in 13s
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Successful in 3m56s
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 19s
Test Suite / playwright-smoke (push) Successful in 13s
backlog_epic_hierarchy als Steuerungselement, effektive steering_elements im Operating Context, Backend-Guards und UI ohne Slice-Ifs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
f33135b87f
commit
a3b14d9c00
18 files changed
+489
-35
No files matched your search
@@ -1,32 +1,31 @@
|
||||
import { useMemo } from 'react'
|
||||
import {
|
||||
BACKLOG_STATUSES,
|
||||
BACKLOG_STATUS_LABELS,
|
||||
BACKLOG_ITEM_KINDS,
|
||||
BACKLOG_ITEM_KINDS_WITH_EPIC,
|
||||
BACKLOG_ITEM_KIND_LABELS,
|
||||
PRIORITIES,
|
||||
PRIORITY_LABELS,
|
||||
} from '../constants/status.js'
|
||||
import { GateSelect } from './GateSelect.jsx'
|
||||
import { FeatureParentSelect } from './FeatureParentSelect.jsx'
|
||||
import { EpicParentSelect } from './EpicParentSelect.jsx'
|
||||
import { resolveBacklogVocabulary } from '../utils/resolveBacklogVocabulary.js'
|
||||
|
||||
export function BacklogItemForm({
|
||||
initial = {},
|
||||
roadmapItems = [],
|
||||
featureActions = [],
|
||||
epicItems = [],
|
||||
epicHierarchyEnabled = false,
|
||||
backlogVocabulary = null,
|
||||
onSubmit,
|
||||
onCancel,
|
||||
busy = false,
|
||||
submitLabel = 'Speichern',
|
||||
allowStatus = true,
|
||||
}) {
|
||||
const itemKinds = epicHierarchyEnabled ? BACKLOG_ITEM_KINDS_WITH_EPIC : BACKLOG_ITEM_KINDS
|
||||
const initialKind = initial.item_kind || 'story'
|
||||
const vocabulary = resolveBacklogVocabulary(backlogVocabulary)
|
||||
const itemKinds = vocabulary.kinds
|
||||
const initialKind = initial.item_kind || vocabulary.default_kind || 'story'
|
||||
const isEpic = initialKind === 'epic'
|
||||
const epicHierarchyEnabled = vocabulary.capabilities?.epic_hierarchy ?? vocabulary.epic_hierarchy
|
||||
|
||||
async function handleSubmit(e) {
|
||||
e.preventDefault()
|
||||
@@ -34,7 +33,7 @@ export function BacklogItemForm({
|
||||
const gateValue = form.roadmap_item_id?.value ?? ''
|
||||
const parentValue = form.parent_action_id?.value ?? ''
|
||||
const epicValue = form.parent_backlog_id?.value ?? ''
|
||||
const itemKind = form.item_kind?.value || 'story'
|
||||
const itemKind = form.item_kind?.value || vocabulary.default_kind || 'story'
|
||||
await onSubmit({
|
||||
title: form.title.value.trim(),
|
||||
description: form.description.value,
|
||||
@@ -53,7 +52,8 @@ export function BacklogItemForm({
|
||||
const statusLocked = initial.status === 'converted'
|
||||
const showFeatureRef =
|
||||
!isEpic &&
|
||||
((initial.item_kind || 'story') !== 'story' || featureActions.length > 0)
|
||||
((initial.item_kind || vocabulary.default_kind || 'story') !== 'story' ||
|
||||
featureActions.length > 0)
|
||||
|
||||
return (
|
||||
<form className="form workspace-form backlog-item-form" onSubmit={handleSubmit}>
|
||||
@@ -86,7 +86,7 @@ export function BacklogItemForm({
|
||||
>
|
||||
{itemKinds.map((kind) => (
|
||||
<option key={kind} value={kind}>
|
||||
{BACKLOG_ITEM_KIND_LABELS[kind]}
|
||||
{vocabulary.labels[kind] || kind}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
|
||||
@@ -8,8 +8,10 @@ import { ReorderControls } from './ReorderControls.jsx'
|
||||
import { gateTitleById } from './GateSelect.jsx'
|
||||
import { computeDropPatches, computeMovePatches, sortByOrder } from '../utils/reorder.js'
|
||||
import { buildBacklogDisplayRows, listEpicBacklogItems } from '../utils/backlogTree.js'
|
||||
import { backlogKindLabel, resolveBacklogVocabulary } from '../utils/resolveBacklogVocabulary.js'
|
||||
import { useMinWidth } from '../hooks/useMinWidth.js'
|
||||
import { BACKLOG_ITEM_KIND_LABELS } from '../constants/status.js'
|
||||
import { useInitiativeOperations } from '../context/InitiativeOperationsContext.jsx'
|
||||
import { hasSteeringElement } from '../registry/steeringElementRegistry.js'
|
||||
import { actionTitleById } from '../utils/actionReferences.js'
|
||||
|
||||
const PLANNING_STATUSES = new Set(['planned', 'active', 'at_risk'])
|
||||
@@ -24,7 +26,6 @@ export function BacklogSection({
|
||||
activeWorkCycle = null,
|
||||
featureActions = [],
|
||||
initiativeId = '',
|
||||
sprintPlanningEnabled = false,
|
||||
canManage,
|
||||
onCreate,
|
||||
onUpdate,
|
||||
@@ -36,6 +37,7 @@ export function BacklogSection({
|
||||
sectionTitle = 'Product Backlog',
|
||||
sectionLead = 'Eingang vor dem Commit — triagieren, dann in den Sprint planen.',
|
||||
}) {
|
||||
const { operatingContext, steeringElements } = useInitiativeOperations()
|
||||
const [modalMode, setModalMode] = useState(null)
|
||||
const [dragItemId, setDragItemId] = useState('')
|
||||
const [dropTargetId, setDropTargetId] = useState('')
|
||||
@@ -44,12 +46,23 @@ export function BacklogSection({
|
||||
const isDesktop = useMinWidth(1024)
|
||||
const canReorder = canManage && typeof onReorder === 'function'
|
||||
|
||||
const vocabulary = useMemo(
|
||||
() => resolveBacklogVocabulary(operatingContext?.backlog_vocabulary),
|
||||
[operatingContext?.backlog_vocabulary],
|
||||
)
|
||||
const sprintCommitEnabled = useMemo(
|
||||
() =>
|
||||
vocabulary.capabilities?.sprint_commit ??
|
||||
hasSteeringElement(steeringElements, 'work_cycle_scope'),
|
||||
[vocabulary, steeringElements],
|
||||
)
|
||||
|
||||
const planableSprints = useMemo(
|
||||
() => workCycles.filter((cycle) => PLANNING_STATUSES.has(cycle.status)),
|
||||
[workCycles],
|
||||
)
|
||||
|
||||
const showSprintPlanning = sprintPlanningEnabled && planableSprints.length > 0
|
||||
const showSprintPlanning = sprintCommitEnabled && planableSprints.length > 0
|
||||
|
||||
useEffect(() => {
|
||||
if (!showSprintPlanning || !initiativeId) {
|
||||
@@ -93,7 +106,7 @@ export function BacklogSection({
|
||||
return map
|
||||
}, [epicItems])
|
||||
|
||||
const epicHierarchyEnabled = sprintPlanningEnabled
|
||||
const defaultKind = vocabulary.default_kind || 'story'
|
||||
|
||||
function closeModal() {
|
||||
setModalMode(null)
|
||||
@@ -234,7 +247,7 @@ export function BacklogSection({
|
||||
)}
|
||||
</div>
|
||||
|
||||
{sprintPlanningEnabled && canManage && !showSprintPlanning && (
|
||||
{sprintCommitEnabled && canManage && !showSprintPlanning && (
|
||||
<div className="backlog-sprint-setup card-list-item">
|
||||
<p className="backlog-sprint-setup__title">
|
||||
<strong>Sprint-Planung:</strong> Lege zuerst einen Sprint an.
|
||||
@@ -332,9 +345,9 @@ export function BacklogSection({
|
||||
disabled={!canManage}
|
||||
>
|
||||
<strong>{item.title}</strong>
|
||||
{item.item_kind && item.item_kind !== 'story' && (
|
||||
{item.item_kind && item.item_kind !== defaultKind && (
|
||||
<span className="badge badge--kind muted">
|
||||
{BACKLOG_ITEM_KIND_LABELS[item.item_kind] || item.item_kind}
|
||||
{backlogKindLabel(vocabulary, item.item_kind)}
|
||||
</span>
|
||||
)}
|
||||
{item.description && (
|
||||
@@ -421,7 +434,7 @@ export function BacklogSection({
|
||||
roadmapItems={roadmapItems}
|
||||
featureActions={featureActions}
|
||||
epicItems={epicItems}
|
||||
epicHierarchyEnabled={epicHierarchyEnabled}
|
||||
backlogVocabulary={vocabulary}
|
||||
onSubmit={handleCreateSubmit}
|
||||
onCancel={closeModal}
|
||||
busy={busy}
|
||||
@@ -434,7 +447,7 @@ export function BacklogSection({
|
||||
roadmapItems={roadmapItems}
|
||||
featureActions={featureActions}
|
||||
epicItems={epicItems.filter((epic) => epic.id !== modalMode.item.id)}
|
||||
epicHierarchyEnabled={epicHierarchyEnabled}
|
||||
backlogVocabulary={vocabulary}
|
||||
onSubmit={handleEditSubmit}
|
||||
onCancel={closeModal}
|
||||
busy={busy}
|
||||
|
||||
@@ -7,7 +7,6 @@ export function InitiativeInboxPage() {
|
||||
initiative,
|
||||
initiativeId,
|
||||
backlogItems,
|
||||
dataSlices,
|
||||
roadmapItems,
|
||||
featureParentActions,
|
||||
workCycles,
|
||||
@@ -42,7 +41,6 @@ export function InitiativeInboxPage() {
|
||||
featureActions={featureParentActions}
|
||||
workCycles={workCycles}
|
||||
activeWorkCycle={activeWorkCycle}
|
||||
sprintPlanningEnabled={dataSlices.includes('work_cycles')}
|
||||
canManage={capabilities.has('kairo.backlog.manage')}
|
||||
onCreate={handleCreateBacklog}
|
||||
onUpdate={handleUpdateBacklog}
|
||||
|
||||
@@ -13,6 +13,9 @@ export const STEERING_ELEMENT_UI = {
|
||||
nextActionTitle: 'Nächster Schritt aus der Queue',
|
||||
nextActionSubtitle: 'Pull-Empfehlung aus dem Eingang.',
|
||||
},
|
||||
backlog_epic_hierarchy: {
|
||||
planInboxHint: 'Epic-Baum für Sprint-Planung und Refinement.',
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/** @typedef {import('../api/types.js').BacklogVocabulary} BacklogVocabulary */
|
||||
|
||||
export const DEFAULT_BACKLOG_VOCABULARY = {
|
||||
profile_key: 'standard_intake',
|
||||
kinds: ['story', 'bug', 'issue'],
|
||||
labels: {
|
||||
story: 'Story',
|
||||
bug: 'Bug',
|
||||
issue: 'Issue',
|
||||
},
|
||||
default_kind: 'story',
|
||||
epic_hierarchy: false,
|
||||
convertible_kinds: ['story', 'bug', 'issue'],
|
||||
capabilities: {
|
||||
sprint_commit: false,
|
||||
epic_hierarchy: false,
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Partial<BacklogVocabulary> | null | undefined} vocabulary
|
||||
* @returns {BacklogVocabulary}
|
||||
*/
|
||||
export function resolveBacklogVocabulary(vocabulary) {
|
||||
if (!vocabulary?.kinds?.length) {
|
||||
return { ...DEFAULT_BACKLOG_VOCABULARY }
|
||||
}
|
||||
return {
|
||||
...DEFAULT_BACKLOG_VOCABULARY,
|
||||
...vocabulary,
|
||||
labels: {
|
||||
...DEFAULT_BACKLOG_VOCABULARY.labels,
|
||||
...(vocabulary.labels || {}),
|
||||
},
|
||||
capabilities: {
|
||||
...DEFAULT_BACKLOG_VOCABULARY.capabilities,
|
||||
...(vocabulary.capabilities || {}),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Partial<BacklogVocabulary> | null | undefined} vocabulary
|
||||
* @param {string | null | undefined} itemKind
|
||||
*/
|
||||
export function backlogKindLabel(vocabulary, itemKind) {
|
||||
if (!itemKind) return ''
|
||||
const resolved = resolveBacklogVocabulary(vocabulary)
|
||||
return resolved.labels[itemKind] || itemKind
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
backlogKindLabel,
|
||||
DEFAULT_BACKLOG_VOCABULARY,
|
||||
resolveBacklogVocabulary,
|
||||
} from './resolveBacklogVocabulary.js'
|
||||
|
||||
describe('resolveBacklogVocabulary', () => {
|
||||
it('liefert Fallback bei leerem Input', () => {
|
||||
expect(resolveBacklogVocabulary(null)).toEqual(DEFAULT_BACKLOG_VOCABULARY)
|
||||
})
|
||||
|
||||
it('merged Continuous-Labels', () => {
|
||||
const vocab = resolveBacklogVocabulary({
|
||||
profile_key: 'continuous_intake',
|
||||
kinds: ['story', 'bug', 'issue'],
|
||||
labels: { story: 'Idee', issue: 'Störung' },
|
||||
epic_hierarchy: false,
|
||||
})
|
||||
expect(vocab.labels.story).toBe('Idee')
|
||||
expect(vocab.labels.issue).toBe('Störung')
|
||||
})
|
||||
|
||||
it('backlogKindLabel nutzt Profil-Label', () => {
|
||||
expect(
|
||||
backlogKindLabel(
|
||||
{ labels: { story: 'Idee' }, kinds: ['story'] },
|
||||
'story',
|
||||
),
|
||||
).toBe('Idee')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user