AP1.15c: Join/Branch-Topologie mit parallel_group und optional_branch.
Deploy Development / deploy (push) Successful in 50s
Test Suite / pytest-backend (push) Successful in 2m18s
Test Suite / lint-backend (push) Successful in 3s
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

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-07-11 09:27:56 +02:00
1 parent 364ad44759
commit d7aefed0de
13 files changed
+321 -43

No files matched your search

@@ -19,11 +19,14 @@ function formatDate(value) {
export function GateDesignerNodePanel({
item,
graphState,
criteriaProgress,
onClose,
}) {
if (!item) return null
const graphItem = graphState?.items?.[item.id]
const progress = criteriaProgress?.[item.id]
const closed = progress?.closed ?? 0
const total = progress?.total ?? 0
@@ -69,8 +72,20 @@ export function GateDesignerNodePanel({
)}
</dl>
{item.goal_description && (
<p className="gate-designer-node-panel__goal muted">{item.goal_description}</p>
{item.goal_description && (
<p className="gate-designer-node-panel__goal muted">{item.goal_description}</p>
)}
{graphItem?.parallel_group_keys?.length > 0 && (
<p className="gate-designer-node-panel__topology muted">
Parallel: {graphItem.parallel_group_keys.join(', ')}
</p>
)}
{graphItem?.optional_prerequisites?.length > 0 && (
<p className="gate-designer-node-panel__topology muted">
Optional: {graphItem.optional_prerequisites.length} Zweig(e) — blockieren nicht
</p>
)}
<div className="gate-designer-node-panel__actions">
+38 -13
View File
@@ -15,7 +15,7 @@ import {
loadManualGatePositions,
storeManualGatePositions,
} from '../plan/gateGraphDesigner.js'
import { DESIGNER_EDGE_KINDS, DESIGNER_EDGE_LABELS } from '../plan/gateGraphTopology.js'
import { DESIGNER_EDGE_KINDS, DESIGNER_EDGE_LABELS, edgeKindNeedsGroupKey, resolveDependencyEndpoints } from '../plan/gateGraphTopology.js'
import { LoadingState } from './LoadingState.jsx'
import { ErrorState } from './ErrorState.jsx'
import { EmptyState } from './EmptyState.jsx'
@@ -62,6 +62,7 @@ export function GateGraphDesigner({
busy: busyProp = false,
onCreate,
onGraphChanged,
graphState,
}) {
const viewportRef = useRef(null)
const [dependencies, setDependencies] = useState([])
@@ -73,6 +74,7 @@ export function GateGraphDesigner({
const [error, setError] = useState(null)
const [busyLocal, setBusyLocal] = useState(false)
const [edgeType, setEdgeType] = useState('requires')
const [groupKey, setGroupKey] = useState('phase-1')
const [selectedEdgeId, setSelectedEdgeId] = useState(null)
const [selectedNodeId, setSelectedNodeId] = useState(null)
const [showCreate, setShowCreate] = useState(false)
@@ -150,21 +152,28 @@ export function GateGraphDesigner({
onGraphChanged?.()
}
async function handleCreateEdge(fromId, toId) {
if (!fromId || !toId || fromId === toId) return
async function handleCreateEdge(sourceId, targetId) {
if (!sourceId || !targetId || sourceId === targetId) return
if (edgeKindNeedsGroupKey(edgeType) && !groupKey.trim()) {
setError('Parallelgruppe benötigt einen Schlüssel (group_key).')
return
}
setBusyLocal(true)
setError(null)
try {
let fromItemId = fromId
let toItemId = toId
if (edgeType === 'requires') {
fromItemId = toId
toItemId = fromId
}
await addRoadmapItemDependency(fromItemId, {
const { from_item_id: fromItemId, to_item_id: toItemId } = resolveDependencyEndpoints(
edgeType,
sourceId,
targetId,
)
const body = {
to_item_id: toItemId,
dependency_type: edgeType,
})
}
if (edgeKindNeedsGroupKey(edgeType)) {
body.group_key = groupKey.trim()
}
await addRoadmapItemDependency(fromItemId, body)
await notifyGraphChanged()
} catch (err) {
setError(err?.message || 'Kante konnte nicht angelegt werden.')
@@ -448,6 +457,20 @@ export function GateGraphDesigner({
</label>
)}
{canManage && edgeKindNeedsGroupKey(edgeType) && (
<label className="gate-graph-designer__edge-type">
<span className="muted">Gruppenschlüssel</span>
<input
type="text"
value={groupKey}
maxLength={128}
disabled={busy}
placeholder="z. B. phase-1"
onChange={(e) => setGroupKey(e.target.value)}
/>
</label>
)}
<div className="gate-graph-designer__zoom-group" role="group" aria-label="Zoom">
<button
type="button"
@@ -493,8 +516,9 @@ export function GateGraphDesigner({
{canManage && (
<p className="gate-graph-designer__hint muted">
Vom unteren Punkt eines Gates zur Zielkante ziehen. Doppelklick auf leere Fläche legt ein
Gate an. Klick auf Gate öffnet das Info-Panel.
Vom unteren Punkt ziehen: Voraussetzung/Block/Bezug/Parallel/Optional. Join-Gates
verbinden mehrere Pflicht-Voraussetzungen (AND). Doppelklick auf leere Fläche legt ein
Gate an.
</p>
)}
@@ -627,6 +651,7 @@ export function GateGraphDesigner({
{selectedItem && (
<GateDesignerNodePanel
item={selectedItem}
graphState={graphState}
criteriaProgress={criteriaProgress}
onClose={() => setSelectedNodeId(null)}
/>
+8
View File
@@ -105,6 +105,14 @@ export function GateMapView({ initiativeId, items, graphState: graphStateProp })
<span className="gate-map-view__legend-line gate-map-view__legend-line--related" />
Bezug
</span>
<span className="gate-map-view__legend-item">
<span className="gate-map-view__legend-line gate-map-view__legend-line--parallel" />
Parallel
</span>
<span className="gate-map-view__legend-item">
<span className="gate-map-view__legend-line gate-map-view__legend-line--optional" />
Optional
</span>
</div>
<div className="gate-map-view__canvas-wrap">
@@ -130,6 +130,7 @@ export function GatesPlanPanel({
busy={busy}
onCreate={canManage ? onCreate : undefined}
onGraphChanged={refreshGraphState}
graphState={graphState}
/>
)}
</div>
+5 -1
View File
@@ -132,7 +132,11 @@ export function computeGateGraphLayout(items, dependencies) {
y: node.y + node.height / 2,
})
if (dep.dependency_type === 'related') {
if (
dep.dependency_type === 'related' ||
dep.dependency_type === 'parallel_group' ||
dep.dependency_type === 'optional_branch'
) {
const from = center(sourceNode)
const to = center(targetNode)
return {
+30 -6
View File
@@ -1,13 +1,19 @@
/**
* Kantentypen für Zielzustands-Graph — AP1.15c erweitert um Topologie.
* Siehe ADP_Roadmap_Graph_and_Gate_Checklist_v0.1.md § Join/Branch deferred.
* Kantentypen für Zielzustands-Graph — AP1.15c Topologie.
* OR-Alternativpfade bewusst nicht enthalten (PO-Deferral).
*/
/** Im Designer AP1.15a/b nutzbar */
export const DESIGNER_EDGE_KINDS = ['requires', 'blocks', 'related']
/** Basis-Kanten im Designer */
export const DESIGNER_EDGE_KINDS = [
'requires',
'blocks',
'related',
'parallel_group',
'optional_branch',
]
/** AP1.15c — parallel_group, optional_branch; ggf. OR später */
export const DEFERRED_TOPOLOGY_EDGE_KINDS = ['parallel_group', 'optional_branch']
/** Erfordert group_key bei Anlage */
export const EDGE_KINDS_REQUIRING_GROUP_KEY = ['parallel_group']
export const DESIGNER_EDGE_LABELS = {
requires: 'Voraussetzung',
@@ -16,3 +22,21 @@ export const DESIGNER_EDGE_LABELS = {
parallel_group: 'Parallelgruppe',
optional_branch: 'Optional',
}
/** @deprecated use DESIGNER_EDGE_KINDS */
export const DEFERRED_TOPOLOGY_EDGE_KINDS = ['parallel_group', 'optional_branch']
export function edgeKindNeedsGroupKey(kind) {
return EDGE_KINDS_REQUIRING_GROUP_KEY.includes(kind)
}
/**
* Kanten-Richtung beim Anlegen per Drag (Quelle → Ziel).
* requires: Ziel hängt von Quelle ab (from=Ziel, to=Quelle).
*/
export function resolveDependencyEndpoints(edgeKind, sourceId, targetId) {
if (edgeKind === 'requires') {
return { from_item_id: targetId, to_item_id: sourceId }
}
return { from_item_id: sourceId, to_item_id: targetId }
}
+22 -3
View File
@@ -2,14 +2,33 @@ import { describe, expect, it } from 'vitest'
import {
DEFERRED_TOPOLOGY_EDGE_KINDS,
DESIGNER_EDGE_KINDS,
edgeKindNeedsGroupKey,
resolveDependencyEndpoints,
} from './gateGraphTopology.js'
describe('gateGraphTopology', () => {
it('keeps designer and deferred edge kinds separate', () => {
it('includes topology kinds in designer', () => {
expect(DESIGNER_EDGE_KINDS).toContain('requires')
expect(DEFERRED_TOPOLOGY_EDGE_KINDS).toContain('parallel_group')
expect(DESIGNER_EDGE_KINDS).toContain('parallel_group')
expect(DESIGNER_EDGE_KINDS).toContain('optional_branch')
for (const kind of DEFERRED_TOPOLOGY_EDGE_KINDS) {
expect(DESIGNER_EDGE_KINDS).not.toContain(kind)
expect(DESIGNER_EDGE_KINDS).toContain(kind)
}
})
it('requires group_key for parallel_group', () => {
expect(edgeKindNeedsGroupKey('parallel_group')).toBe(true)
expect(edgeKindNeedsGroupKey('requires')).toBe(false)
})
it('resolves requires edge direction for join semantics', () => {
expect(resolveDependencyEndpoints('requires', 'a', 'b')).toEqual({
from_item_id: 'b',
to_item_id: 'a',
})
expect(resolveDependencyEndpoints('optional_branch', 'a', 'b')).toEqual({
from_item_id: 'a',
to_item_id: 'b',
})
})
})
+25
View File
@@ -1697,6 +1697,16 @@
border-top-style: dashed;
}
.gate-map-view__legend-line--parallel {
border-top-color: #7c3aed;
border-top-style: dashed;
}
.gate-map-view__legend-line--optional {
border-top-color: #059669;
border-top-style: dashed;
}
.gate-map-view__canvas-wrap {
overflow: auto;
border: 1px solid var(--jk-border, #dde3ea);
@@ -1727,6 +1737,16 @@
stroke-dasharray: 6 4;
}
.gate-map-view__edge--parallel_group {
stroke: #7c3aed;
stroke-dasharray: 4 3;
}
.gate-map-view__edge--optional_branch {
stroke: #059669;
stroke-dasharray: 8 4;
}
.gate-map-view__arrow--requires {
fill: #2563eb;
}
@@ -1963,6 +1983,11 @@
font-size: 0.875rem;
}
.gate-designer-node-panel__topology {
margin: 0 0 0.75rem;
font-size: 0.8125rem;
}
.gate-designer-node-panel__actions {
display: flex;
flex-wrap: wrap;