@sigloch/graph-view-edit 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.html CHANGED
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>graph-view-edit</title>
7
- <script type="module" crossorigin src="/assets/index-B6MGO4N_.js"></script>
8
- <link rel="stylesheet" crossorigin href="/assets/index-Cf27gkg2.css">
7
+ <script type="module" crossorigin src="/assets/index-CycvLIwi.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-B1CMXZjj.css">
9
9
  </head>
10
10
  <body>
11
11
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigloch/graph-view-edit",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "React/Vite viewer+editor over @sigloch/graphcode — 12 graph-views + 16 doc-views via a declarative View-Registry, plus an SE-Dashboard sibling route. Reads docs/graph/<member>.graph.json client-side (no 2nd Kuzu handle).",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,17 +21,17 @@
21
21
  },
22
22
  "comment:deps": "Runtime = what vite.config.js + bin/gve.mjs load at Node level when serving the prebuilt dist/. The UI libs (react, react-dom, elkjs, @tanstack/react-table, zustand) are bundled INTO dist/ by vite and must stay devDependencies — shipping them would make consumers download the whole UI stack twice.",
23
23
  "dependencies": {
24
- "@sigloch/contracts": ">=10.2 <11",
25
- "@sigloch/graph-api-core": ">=5.10.1 <6",
26
- "@sigloch/graphcode-client": ">=1.3 <2",
27
- "@sigloch/se-engine": ">=1.4 <2",
24
+ "@sigloch/contracts": ">=11 <12",
25
+ "@sigloch/graph-api-core": ">=5.10.2 <6",
26
+ "@sigloch/graphcode-client": ">=2 <3",
27
+ "@sigloch/se-engine": ">=2 <3",
28
28
  "@vitejs/plugin-react": "^4.3.4",
29
29
  "vite": "^5.4.11",
30
30
  "zod": "^4.3.6"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@playwright/test": "^1.58.2",
34
- "@sigloch/graphcode": ">=0.25 <1",
34
+ "@sigloch/graphcode": ">=0.29 <1",
35
35
  "@tanstack/react-table": "^8.20.5",
36
36
  "@testing-library/react": "^16.0.1",
37
37
  "elkjs": "^0.11.1",
package/vite.config.js CHANGED
@@ -34,8 +34,7 @@ import {
34
34
  healthPanel,
35
35
  VIEW_FILENAMES,
36
36
  ARTIFACT_CATALOG,
37
- analysisCreationCurrencyProvider,
38
- PHASE_GATE_RULES,
37
+ analysisSignals,
39
38
  groupViolations,
40
39
  callHost,
41
40
  HOST_SOCK_BASENAME,
@@ -289,12 +288,7 @@ function configApiPlugin() {
289
288
  export function loadGraph(file) {
290
289
  const json = JSON.parse(readFileSync(file, 'utf8'));
291
290
  const { nodes, edges } = fromOntologyGraph(json);
292
- // CR-GC-300: graph_export now stamps graphVersion at write time — the live
293
- // comparison value computeAnalysisCurrency() needs against each analysis
294
- // artifact's SYS.attributes.analysisFreshness.<id>.graphVersion stamp
295
- // (CR-GVE-229). Missing on a pre-CR-GC-300 export → 0, which reads every
296
- // stamp as stale/current per its own value rather than crashing.
297
- return { nodes, edges, graphVersion: json.graphVersion ?? 0 };
291
+ return { nodes, edges };
298
292
  }
299
293
 
300
294
  /**
@@ -313,67 +307,27 @@ export function recommendationsPayload(violations, limit = 50) {
313
307
  }
314
308
 
315
309
  /**
316
- * Gate-Blocker als strukturierte Gruppen (CR-GVE-256) — dieselbe Mechanik wie
317
- * `recommendationsPayload` (erst gruppieren, dann kappen; Counts aus den
318
- * UNGEKAPPTEN Listen), eingeschränkt auf die Regeln, die das Gate besitzt.
319
- * Nur error-severity blockiert (warnings/info sind advisory `open` —
320
- * readiness.js scorePhaseGate) — deshalb wird hier identisch gefiltert.
321
- */
322
- export function gateBlockerGroups(violations, ruleIds, elementLimit = 10) {
323
- return groupViolations(
324
- violations.filter((v) => v.severity === 'error' && ruleIds.includes(v.ruleId)),
325
- elementLimit,
326
- );
327
- }
328
-
329
- /**
330
- * Gate-übergreifende Aggregat-Sicht (CR-GVE-256): EINE Gruppe je ruleId über
331
- * alle Gates, mit Gate-Chips — dieselbe Regel wird nicht n-fach gelistet.
332
- * Die Gate-Zuordnung ist die VORHANDENE server-seitige Ableitung
333
- * (`PHASE_GATE_RULES` aus @sigloch/graphcode-client — dieselbe Tabelle, aus
334
- * der readiness.js die Gates scored), kein lokaler zweiter Regel-Katalog.
335
- * Impl-Gates besitzen keine Element-Regeln (ihre Blocker sind CRs/Scope/
336
- * Creations — strukturell, ohne ruleId) und tauchen deshalb hier nicht auf.
337
- */
338
- export function gateBlockerRollup(violations, gateRules = PHASE_GATE_RULES, elementLimit = 10) {
339
- const ruleToGates = new Map();
340
- for (const [gateId, ruleIds] of Object.entries(gateRules)) {
341
- for (const rid of ruleIds) {
342
- if (!ruleToGates.has(rid)) ruleToGates.set(rid, []);
343
- ruleToGates.get(rid).push(gateId);
344
- }
345
- }
346
- const owned = violations.filter((v) => v.severity === 'error' && ruleToGates.has(v.ruleId));
347
- return groupViolations(owned, elementLimit).map((g) => ({ ...g, gates: ruleToGates.get(g.ruleId) }));
348
- }
349
-
350
- /**
351
- * Das Readiness-Teilstück des Dashboard-Payloads (CR-GVE-256):
352
- * `readinessPanel` UNVERÄNDERT als Basis, aber je Gate ersetzt das flache
353
- * `blocking`-String-Array durch `blockerGroups` (regelbasierte Blocker,
354
- * gruppiert) + `blockingOther` (Milestones/CRs/Creations/Completeness — die
355
- * Zeilen ohne ruleId). Das flache Feld wird ENTFERNT, nicht daneben
356
- * weitergereicht — sonst rendert es irgendwann wieder jemand (Parallelpfad).
310
+ * Das Readiness-Teilstück des Dashboard-Payloads (CR-GVE-301, vorher CR-GVE-256).
311
+ *
312
+ * Die Marken SRR, PDR, CDR, TRR, Bau kommen FERTIG aus dem Report — `reached` und
313
+ * `holding` (die Befunde, die eine Marke halten) rechnet `computeMarks` in
314
+ * @sigloch/graphcode-client, beim Host. Hier wird nichts beurteilt: `reached` reist
315
+ * unverändert durch, und `holding` wird für die Anzeige mit DERSELBEN
316
+ * `groupViolations` zusammengefasst wie die Empfehlungen (erst gruppieren, dann
317
+ * kappen). `holdingCount` ist die Länge der ungekappten Liste.
318
+ *
319
+ * Die rohe `holding`-Liste wird ENTFERNT, nicht daneben weitergereicht: an einer
320
+ * roten Marke sind das hunderte Befunde je Marke, fünfmal.
357
321
  */
358
322
  export function readinessPayload(report) {
359
323
  const panel = readinessPanel(report);
360
- const enrich = (g) => {
361
- const ruleIds = PHASE_GATE_RULES[g.id] ?? [];
362
- const { blocking, ...rest } = g;
363
- return {
364
- ...rest,
365
- blockerGroups: gateBlockerGroups(report.violations, ruleIds),
366
- // Regel-Zeilen sind als Gruppen abgebildet; übrig bleiben die
367
- // strukturellen Blocker ("<CR> not done", "milestone … missing",
368
- // "<Creation> not performed", "… completeness x/y").
369
- blockingOther: blocking.filter((line) => !ruleIds.some((rid) => line.startsWith(`${rid}: `))),
370
- };
371
- };
372
324
  return {
373
325
  ...panel,
374
- phaseGates: panel.phaseGates.map(enrich),
375
- implGates: panel.implGates.map(enrich),
376
- blockerRollup: gateBlockerRollup(report.violations),
326
+ marks: panel.marks.map(({ holding, ...mark }) => ({
327
+ ...mark,
328
+ holdingCount: holding.length,
329
+ holdingGroups: groupViolations(holding),
330
+ })),
377
331
  };
378
332
  }
379
333
 
@@ -688,7 +642,7 @@ export function readMetricPolicy(repoRoot) {
688
642
  * Die Readiness beim graphcode-Host holen (CR-GC-402, Option C) — derselbe
689
643
  * `host.sock`-Weg wie /api/mutate und graph_suggest, also DAS Gate, DER Store,
690
644
  * EINE Rechnung. `detail:true`, weil der Payload sowohl den Report als auch die
691
- * rohen Violations braucht (Empfehlungen, Blocker-Gruppen, Architektur-Befunde) —
645
+ * rohen Violations braucht (Empfehlungen, Marken, Architektur-Befunde) —
692
646
  * ein zweiter Aufruf von `rules_evaluate` wäre eine zweite Erhebung derselben Liste.
693
647
  *
694
648
  * Auch die RC-Konformanzregeln (RC-01..06) kommen nur über diesen Weg: sie brauchen
@@ -702,7 +656,8 @@ export async function fetchHostReadiness(repoRoot, callHostImpl = callHost) {
702
656
  const socketPath = join(repoRoot, '.graphcode', HOST_SOCK_BASENAME);
703
657
  try {
704
658
  const report = await callHostImpl(socketPath, 'graph_readiness', { detail: true });
705
- if (!report?.compliance || !Array.isArray(report.violations)) {
659
+ // CR-GVE-301: ohne `marks` ist es ein Host vor contracts 11 — dessen Gates liest hier niemand mehr.
660
+ if (!report?.compliance || !Array.isArray(report.violations) || !Array.isArray(report.marks)) {
706
661
  return { report: null, error: 'graph_readiness lieferte keinen verwertbaren Report (detail:true)' };
707
662
  }
708
663
  return { report, error: null };
@@ -1104,21 +1059,20 @@ function dashboardApiPlugin() {
1104
1059
 
1105
1060
  /**
1106
1061
  * Artifact set = ARTIFACT_CATALOG (CR-GVE-225/F10), not VIEW_FILENAMES —
1107
- * the catalog also carries the 5 `kind:'analysis'` creations (conops/fmea/
1108
- * trade/implplan/assumption-review), which VIEW_FILENAMES's markdown-view
1062
+ * the catalog also carries the four `kind:'analysis'` artifacts (conops/fmea/
1063
+ * trade/assumption-review), which VIEW_FILENAMES's markdown-view
1109
1064
  * vocabulary never listed, so they never reached the dashboard before.
1110
1065
  */
1111
1066
  function scanArtifacts(graphFile, graph) {
1112
1067
  const graphMtime = existsSync(graphFile) ? statSync(graphFile).mtimeMs : 0;
1113
- // Real scope-currency (CR-SM-227/CR-GVE-229): each analysis artifact's
1114
- // SYS.attributes.analysisFreshness.<id> stamp vs. the live graphVersion
1115
- // graph_export now writes (CR-GC-300) — never via mtime (CR-GC-222's
1116
- // mtime-for-judgment-work conflation artifactsPanel's kind split guards
1117
- // against).
1118
- const analysisCurrency = analysisCreationCurrencyProvider(graph, graph.graphVersion);
1068
+ // CR-GVE-301: eine Analyse ist durchgeführt oder nicht — ihr Stempel unter
1069
+ // SYS.attributes.analysisFreshness.<id> liegt vor oder fehlt (`analysisSignals`,
1070
+ // dieselbe Bedingung wie AF-01..04). Der Vergleich gegen die graphVersion
1071
+ // ("veraltet") ist mit CR-SM-395 entfallen; nie über mtime (CR-GC-222).
1072
+ const analysis = new Map(analysisSignals(graph).map((sig) => [sig.id, sig]));
1119
1073
  const items = ARTIFACT_CATALOG.map((entry) => {
1120
1074
  if (entry.kind === 'analysis') {
1121
- return { id: entry.id, currency: analysisCurrency(entry.id) };
1075
+ return analysis.get(entry.id) ?? { id: entry.id, exists: false };
1122
1076
  }
1123
1077
  const fname = VIEW_FILENAMES[entry.id];
1124
1078
  const p = fname ? join(VIEWS_DIR, fname) : null;
@@ -1128,8 +1082,8 @@ function dashboardApiPlugin() {
1128
1082
  });
1129
1083
  // CR-GVE-252: welche Zeile ein Dokument oeffnen kann, entscheidet der
1130
1084
  // KATALOG, nicht `kind`. 14 der 15 Artefakte haben einen VIEW_FILENAMES-
1131
- // Eintrag — auch vier der fuenf `analysis`-Creations (conops/fmea/trade/
1132
- // implplan). Nur `assumption-review` hat keinen. Die frueher hier
1085
+ // Eintrag — auch drei der vier Analysen (conops/fmea/trade). Nur
1086
+ // `assumption-review` hat keinen. Die frueher hier
1133
1087
  // implizite Gleichsetzung `kind === 'render'` == "hat eine Datei" war
1134
1088
  // schlicht falsch (CR-GVE-250 §8.1). Dieselbe Tabelle, gegen die
1135
1089
  // /api/view-doc aufloest — kein zweites Kriterium im Client.
@@ -1181,12 +1135,19 @@ function dashboardApiPlugin() {
1181
1135
  ]);
1182
1136
  const localPolicy = host.report ? null : readMetricPolicy(cwd);
1183
1137
  const report = host.report ?? computeReadiness(engine.evaluate(graph, localPolicy.policy), graph);
1184
- // EINE Liste für Empfehlungen, Blocker-Gruppen und Architektur-Befunde — die
1138
+ // EINE Liste für Empfehlungen und Architektur-Befunde — die
1185
1139
  // des Reports, egal aus welcher der beiden Quellen er stammt.
1186
1140
  const violations = report.violations ?? [];
1187
1141
  // CR-GVE-262: graph_suggest liefert das Anwendbarkeits-Urteil — nur mit
1188
1142
  // laufendem Host; ohne bleibt suggest null und die Karte sagt es.
1189
- const suggest = await fetchSuggest(cwd);
1143
+ //
1144
+ // CR-GVE-301: hat in der ersten Welle KEINER der drei Aufrufe einen Host erreicht,
1145
+ // wird nicht ein viertes Mal gefragt. `callHost` wartet je Aufruf 2 s auf einen
1146
+ // noch bootenden Socket; die zweite Welle verdoppelte das auf 4 s und ließ die
1147
+ // Antwort ohne Host unter Last über das 5-s-Fenster der Tests laufen. Die Antwort
1148
+ // stünde ohnehin fest (null) — dieselbe Klammer wie bei `ruleHelp` unten.
1149
+ const hostAnswered = host.report != null || nextStep != null || hostMetrics.metrics != null;
1150
+ const suggest = hostAnswered ? await fetchSuggest(cwd) : null;
1190
1151
  const payload = {
1191
1152
  member: basename(file).replace(/\.graph\.json$/, ''),
1192
1153
  repoRoot: servedRepoRoot(),
@@ -1227,7 +1188,7 @@ function dashboardApiPlugin() {
1227
1188
  },
1228
1189
  // CR-GC-433 (Trigger-Art 2+3): die permanente Zeile „Der nächste Zug" —
1229
1190
  // Architektur (graph_suggest Top-1) und Hygiene (graph_next_step)
1230
- // nebeneinander, unabhängig davon, ob irgendein Gate-Endzustand erreicht ist.
1191
+ // nebeneinander, unabhängig davon, ob irgendeine Marke erreicht ist.
1231
1192
  nextMove: nextMovePayload(nextStep, suggest),
1232
1193
  // CR-GVE-257: Repo ohne Trajektorie → null (Karte zeigt den Hinweis).
1233
1194
  autopilot: existsSync(TRAJECTORY_FILE) ? autopilotStats(readFileSync(TRAJECTORY_FILE, 'utf8')) : null,
@@ -1236,16 +1197,13 @@ function dashboardApiPlugin() {
1236
1197
  // CR-GVE-269: Erklärungen für GENAU die Regeln, die diese Antwort nennt —
1237
1198
  // nach dem Zusammenbau, damit keine Liste doppelt gepflegt wird.
1238
1199
  //
1239
- // Nur fragen, wenn überhaupt ein Host geantwortet hat: ohne ihn kostet jeder
1240
- // Aufruf einen Connect-Timeout, und die Antwort stünde ohnehin fest (leer).
1241
- // Ohne diese Klammer lief die /api/dashboard-Antwort in einem Repo ohne Host
1242
- // über ihr 5-s-Fenster (gemessen 4,0 s → 5,3 s).
1243
- const hostAnswered = host.report != null || suggest != null || nextStep != null;
1200
+ // Nur fragen, wenn überhaupt ein Host geantwortet hat (`hostAnswered`, oben): ohne
1201
+ // ihn kostet jeder Aufruf einen Connect-Timeout, und die Antwort stünde ohnehin
1202
+ // fest (leer).
1244
1203
  payload.ruleHelp = !hostAnswered ? {} : await fetchRuleHelp(cwd, [
1245
1204
  ...(payload.recommendations?.groups ?? []).map((g) => g.ruleId),
1246
- ...[...(payload.readiness?.phaseGates ?? []), ...(payload.readiness?.implGates ?? [])]
1247
- .flatMap((g) => (g.blockerGroups ?? []).map((grp) => grp.ruleId)),
1248
- ...(payload.readiness?.blockerRollup ?? []).map((g) => g.ruleId),
1205
+ // CR-GVE-301: je Marke ihre Erklärung (graph_help kennt SRR…Bau) und die Regeln, die sie halten.
1206
+ ...payload.readiness.marks.flatMap((m) => [m.id, ...m.holdingGroups.map((grp) => grp.ruleId)]),
1249
1207
  ...payload.architecture.findings.map((f) => f.ruleId),
1250
1208
  payload.nextMove.architecture.top?.ruleId,
1251
1209
  // CR-GVE-273: die Kennzahl-Namen, die Karte 2 zeigt — dieselbe Quelle wie