Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
7e694be
chore: dependency update
ichxorya May 6, 2026
5730154
fix: move use-gui archunit output to `target`
ichxorya May 6, 2026
a95fb3e
chore: show existing problems before fix
ichxorya May 6, 2026
dc8a360
docs: add note on this PR
ichxorya May 6, 2026
d08243a
docs: (unchecked) cyclic visualization
May 6, 2026
8d3b7ea
refactor(api): break circular dependency between api and api.impl
ichxorya May 7, 2026
8df70f3
docs: update notes
ichxorya May 7, 2026
7eed12f
refactor(test): replace import to free the `exports org.tzi.use.api.i…
ichxorya May 15, 2026
1c64371
chore: clean up this mis-pasted text
ichxorya May 15, 2026
2d6f12e
fix: resolve cyclic bug 8
ichxorya May 15, 2026
f0e4b4f
docs: note that we need to address the breaking api changes, leading …
ichxorya May 15, 2026
4b22c80
fix: mini fix per copilot's comment
ichxorya May 15, 2026
4fe9153
fix: bug 5 resolved
ichxorya May 15, 2026
96ce6f3
fix: bug 6 resolved
ichxorya May 15, 2026
18303df
docs: plan for bug 7
ichxorya May 15, 2026
a7044e5
fix: bug 7 resolved
ichxorya May 16, 2026
044e1d0
fix: bug 2 resolved
ichxorya May 16, 2026
81f8a99
fix: address copilot review on generate_cycle_mermaid.py
ichxorya May 16, 2026
9435ae3
refactor: bug 3 Phase A — split runtime root into spi/ and bootstrap/
ichxorya May 16, 2026
b968dac
docs: bug 3 Phase A — before/after/Δ diagrams in PR notes
ichxorya May 16, 2026
c0f9624
refactor: bug 3 Phase B — SPI consolidation + descriptors next to fac…
ichxorya May 16, 2026
94ed78c
fix: bug 3 resolved — Phase C closes runtime cycles (5 → 0)
ichxorya May 16, 2026
e663e3f
fix: bug 1 Phase A — break mm → sys edges (uml triangle 5 → 3 cycles)
May 16, 2026
0aef0f0
fix: bug 9 + graph→util cleanup — core cycle 34 → 29
May 16, 2026
cfbb943
fix: bug 12 — move ModelBrowserSorting to gui.util/utilFX (GUI cycles…
May 16, 2026
8304e00
fix: bug 13 — kill viewsFX → mainFX edge (GUI 10 → 9 cycles)
May 16, 2026
48c0c82
fix: bug 14 — kill util → views (GUI 9 → 5 cycles)
May 16, 2026
e0192d3
docs: update PR notes — record Bugs 9, 10, 12, 13, 14; refresh metrics
May 16, 2026
16381e4
fix: bug 19 — kill uml → gen back-edge (core 29→20, entire 246→213)
May 17, 2026
b199fe7
fix: bug 20 — kill gen → parser back-edge (core 20→19, entire 213→203)
May 17, 2026
2136523
fix: bug 16 — move CompilationFailedException to parser; loosen Symbo…
May 17, 2026
3e320f1
refactor: move util.uml.sorting → uml.mm.sorting (no cycle change yet)
May 17, 2026
139cfe9
fix: bug 11 — move shared coverage visitors to uml.analysis.coverage …
May 17, 2026
9baafc4
fix: bug 23 — kill util → uml back-edge (core 8→2, entire 146→118)
May 17, 2026
f6f6a4d
refactor: move SrcPos + SemanticException to util (no cycle change yet)
May 17, 2026
6cee57f
fix: eliminate remaining uml → parser back-edge (entire-project 118 →…
May 17, 2026
712f1f6
fix: move ShellReadline + TestModelUtil — entire-project 94 → 3
May 17, 2026
7ba0b5d
docs: update PR notes — entire-project 275 → 3 (99% reduction)
May 17, 2026
1d0c69c
fix: bugs 26+27 — plugin SPI refactor, entire-project 3 → 0 ✅
May 17, 2026
8bfb54d
fix: extract IPluginActionProxy + relocate diagram plugin classes (gu…
May 17, 2026
a2d308f
fix: break views↔graphlayout + views↔mainFX cycles (gui 5 → 1)
May 17, 2026
26793fb
docs: update PR notes — entire-project 275 → 0 (100% ✅), gui 14 → 1
May 17, 2026
9122978
refactor: move ViewFrame to gui.views (incremental, main↔views cycle …
May 17, 2026
5be59e6
fix: break gui_main and shell sub-slice cycles
May 17, 2026
1a2339a
refactor: move ModelBrowser handlers + EvalOCLDialog (gui cycle uncha…
May 17, 2026
f01432a
refactor: move View interface from gui.views to gui.main
May 17, 2026
2f51a17
refactor: ViewManager invokes ViewFrame.close() reflectively
May 17, 2026
f5fa293
docs: PR notes — record sub-slice + layered-arch zero-cycle achievements
May 17, 2026
04d1e12
docs: document factory-pattern path for remaining gui:main↔views cycle
May 17, 2026
7e85b92
docs: final ArchUnit metrics — 11/13 tests pass with zero cycles
May 17, 2026
de27efc
fix: bug 17 + bug 1 — collapse gui.main↔views and uml mm/ocl/sys cycl…
May 17, 2026
a0f0c05
docs: refresh Current Metrics table — all 14 cycle tests at zero
May 17, 2026
52057e6
docs: finalization
May 17, 2026
42ab578
refactor: revert slicer-collapse rename + collapse ocl→mm subpackages
May 17, 2026
5721338
refactor: extract IModelState + relocate MLinkSet/MSystemException to…
May 17, 2026
1a40345
/8
May 17, 2026
aded938
refactor: relocate operation-invoking expressions to sys.expr and MLi…
May 17, 2026
a77e602
docs: refresh PR notes — Bug 1 Phase B+C now genuinely resolved
May 17, 2026
fb49605
docs: honest verification of ArchUnit state — what runs, what doesn't…
May 17, 2026
ed16b20
test: relocate expression/system tests to sys to clear uml-with-tests…
May 17, 2026
3e0e243
test: relocate all cross-slice tests to org.tzi.use.integration.*
May 17, 2026
5c10b6b
fix: cast MObject.state(IModelState) results in use-gui
May 17, 2026
d5af9fc
docs: PR notes reflect genuine zero across every ArchUnit test
May 17, 2026
94a857f
chore: move orphan package.html + correct doc's soil/RubyHelper paths
May 17, 2026
3056e38
docs: add diff analysis vs main with mermaid diagrams
May 17, 2026
54f16fb
fix: remove most of the warnings related to this PR
May 17, 2026
52ed155
docs: remove temp files that aren't needed anymore
May 17, 2026
96d283e
fix: GUI booting problems due to obsolete plugins
May 17, 2026
2ef8584
test(arch): run all 6 ArchUnit tests under surefire 3.5.2 + vintage, …
claude May 31, 2026
0d6ea24
docs: add temporary reviewer-facing verification status (decycle-2)
claude May 31, 2026
0c83e9b
docs: add independent code review of the decycle-2 PR
claude May 31, 2026
d0c684e
fix: guard MObjectState downcasts of getSelf().state() with a descrip…
ichxorya Jun 3, 2026
93d26bb
docs: add MIGRATING.md and correct two package-fact errors in the PR …
ichxorya Jun 3, 2026
d17335a
refactor(gui): relocate edges.GUI demo to break the edges<->util pack…
ichxorya Jun 3, 2026
5db1e15
test(arch): measure the gui.views.diagrams cycle blind-spot (non-gating)
ichxorya Jun 3, 2026
a2d5095
refactor(gui): extract diagrams.framework foundation slice
ichxorya Jun 3, 2026
8fe4ee5
refactor(gui): merge waypoints into elements.waypoints
ichxorya Jun 3, 2026
1c447ba
refactor(gui): peel elements off the diagram via framework interfaces
ichxorya Jun 3, 2026
4c375bd
refactor(gui): route diagram views through framework.IMainWindowServices
ichxorya Jun 3, 2026
d198b1f
refactor(gui): invert AllLayoutTypes/StyleInfoBase node coupling via …
ichxorya Jun 3, 2026
334b536
refactor(gui): relocate DiagramView framework to a base slice
ichxorya Jun 3, 2026
a373b64
refactor(gui): untangle event<->types (relocate Hide actions, invert …
ichxorya Jun 3, 2026
b22c24b
refactor(gui): break type/selection -> root via a framework main-wind…
ichxorya Jun 3, 2026
920418f
refactor(gui): move IFXWindowHost to framework + StyleInfo* into clas…
ichxorya Jun 3, 2026
d45022f
refactor(gui): dissolve the selection slice + gate gui.views.diagrams…
ichxorya Jun 3, 2026
8a1d193
build(assembly): bundle the 5 plugins rebuilt against the decycled 7.…
ichxorya Jun 3, 2026
23bfeab
docs(MIGRATING): document the gui.views.diagrams decycling relocations
ichxorya Jun 3, 2026
037f02f
chore: decycle-2 minor changes; autonomous refactor to fit the plugin…
ichxorya Jun 5, 2026
417bb34
Merge branch 'useocl:main' into main
ichxorya Jun 5, 2026
27d0ddb
Merge branch 'main' into decycle-2
ichxorya Jun 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "automatic"
}
161 changes: 161 additions & 0 deletions CODE_REVIEW_decycle-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# `decycle-2` — Independent Code Review (temporary)

> **Temporary reviewer-facing artifact.** Delete before merge. Companion to
> [`PR_decycle-2_STATUS.md`](./PR_decycle-2_STATUS.md) (build/verification status) and the
> author notes in [`README_nghiabt_notes_on_this_pr/`](./README_nghiabt_notes_on_this_pr/).
> This is a structured, multi-pass review of the **777-file** diff, with every candidate
> finding **adversarially verified against the actual code**.

---

## TL;DR for maintainers

> **Verdict: safe to merge on correctness grounds.** A 777-file diff that is **~95 % mechanical
> relocation**; the remaining logic changes were reviewed across 9 domains and produced
> **0 critical / 0 high / 0 medium** findings. The 14 low-severity items are either *intentional
> hardening*, *inherent external-API breaks already documented in the breaking-changes catalog*,
> or *latent interface-downcast fragility that is unreachable today*. One latent item
> (`MSystem` downcast) is worth an optional 2-line defensive fix (see Finding L-9).

```mermaid
flowchart TB
f1["777 files changed<br/>+59,600 / −50,761"] --> f2["9 review domains ×<br/>3 correctness angles<br/>(diff-scan · removed-behavior · cross-file)"]
f2 --> f3["27 candidate findings"]
f3 --> f4["adversarial verify<br/>(1 vote, recall-biased)"]
f4 --> f5["14 kept · 13 refuted"]
f5 --> sev["Severity: 0 critical · 0 high · 0 medium · 14 low"]
style sev fill:#d4f1e0,stroke:#2a9d8f
```

---

## 1. What actually changed (so a maintainer can grasp 777 files)

```mermaid
pie title decycle-2 change composition (777 files, rename-aware)
"Mechanical: renames + import/package-only edits" : 447
"Logic-bearing edits (reviewed in depth)" : 295
"New files (~13 types + docs/reports)" : 32
"Deleted (all moved or folded elsewhere)" : 3
```

| Bucket | Count | Risk | Notes |
|---|--:|:--:|---|
| Pure renames (byte-identical) | 3 | none | package line only |
| Renames + import fixups (`R<100`) | 277 | low | move + update `package`/`import` lines |
| Modified, **import/package only** | 167 | low | caller import rewrites for moved types |
| Modified, **logic-bearing** | ~295 | reviewed | type swaps, visibility, interface extraction, inlinings |
| Added | 32 | reviewed | ~13 new interfaces/classes (`UseSystemApiFactory`, `IModelState`, `IObjectState`, `IMainWindow`, `IShell`, `Launcher`, …) + docs |
| Deleted | 3 | none | `MainJavaFX`→folded into `JavaFXLauncher`; 2 SPI ifaces→`runtime.spi` |

**`module-info` completeness check (both modules): PASS** — every package move is mirrored in
`exports` (`uml.ocl.* → uml.mm.*`, `runtime → runtime.spi`, `views.selection →
views.diagrams.selection`, new `mm.instance` / `api.factory` / `sys.expr` exports). No orphaned
or missing export found.

---

## 2. Review surface by domain (where the logic actually lives)

```mermaid
xychart-beta
title "Logic-bearing files reviewed, by domain"
x-axis ["gui.diagrams", "uml.mm", "uml.sys", "mm.expr", "gui.other", "parser", "tests", "core.other", "gen", "api"]
y-axis "files" 0 --> 100
bar [82, 93, 89, 77, 81, 58, 56, 21, 17, 7]
```

### Per-domain behaviour-preservation verdict

| Domain | Verdict |
|---|---|
| core: `uml.mm` (instance/types/values) | **mostly mechanical** — moves + visibility widening + interface-type swaps; one interface narrowing (compile-verified) |
| core: `mm.expr` / operations | **mostly mechanical** — pure `ocl.expr→mm.expr` move; only `MSystemState→IModelState` swaps + 1 faithful inline |
| core: `uml.sys` | **mostly mechanical** — moves + downcasts to single-implementor types; no logic change |
| core: `parser` / soil | **mostly mechanical** — moves + faithful inlinings + safe downcasts |
| core: `api` | **mostly mechanical** — relocations + faithful factory extraction (2 files are pure whitespace/EOL) |
| core: `gen` + analysis/util/config | **behaviour-preserving** — 1 real change (ASSL compile pushed into Shell caller) verified equivalent |
| gui: `views.diagrams` (host + views) | **mostly mechanical** — relocations + type-safe interface downcasts + visibility widening |
| gui: other (main/mainFX/plugin) | **mixed** — bulk mechanical; 2 pieces gained defensive behaviour (L-1, L-7) |
| shell + runtime (SPI) | **mixed** — mechanical + interface extraction; a few benign behaviour changes (L-2, L-4, L-8) |
| tests → `integration.**` | **mostly mechanical** — test relocations + `UseSystemApi.create→Factory` rewrites; **no test bodies/assertions dropped**; arch tests deliberately strengthened |

---

## 3. Findings (14, all low — grouped by kind)

Severity is low across the board; grouping is by *why* it's low.

### A. Intentional hardening introduced during the refactor (not regressions)

| # | Location | What | Verdict |
|---|---|---|---|
| L-1 | `gui/plugin/PluginAction.java` | A misconfigured plugin (unloadable action class → null delegate) used to NPE loudly; now it logs `Log.error` and no-ops / disables. | CONFIRMED — arguably an improvement (still logs). |
| L-2 | `runtime/util/PluginDescriptor.java` | New `catch (LinkageError | ClassCastException)` skips+logs a plugin compiled against the *old* SPI instead of aborting startup. Intentional safety net for the SPI move. | CONFIRMED |
| L-3 | `architecture/*Test.java` | Arch tests now `assertEquals(0, …)` instead of only printing — they newly **fail the build on any cycle/violation**. (Added by this review's harness fix.) | CONFIRMED — desired strengthening. |

### B. External source/binary-compat breaks (inherent to the relocation; already in the breaking-changes catalog)

| # | Location | What | Verdict |
|---|---|---|---|
| L-4 | `runtime/spi/IPluginShellCmd.getShell()` | Return type `Shell → IShell` (empty marker). No in-tree caller; external plugins calling `Shell`-specific methods must downcast. | PLAUSIBLE |
| L-5 | `api/factory/UseSystemApiFactory` | `UseSystemApi.create(...)` removed, reproduced verbatim in the factory. In-tree callers migrated; external callers break. | PLAUSIBLE |
| L-6 | `uml/mm/instance/MInstanceState` | Interface dropped `getProtocolStateMachinesInstances()` (kept on concrete `MObjectState`/`MDataTypeValueState`). In-tree callers use the concrete type; external interface callers break. | CONFIRMED |

### C. Interface-extraction downcasts — safe today, rely on a single/final implementor

| # | Location | What | Verdict |
|---|---|---|---|
| L-7? | `gui/views/diagrams/MainWindow.java` | `(AbstractAction)` cast on a value now typed `IPluginActionProxy`. Sole impl `PluginActionProxy extends …AbstractAction` → safe; future impls could break. | PLAUSIBLE |
| L-8 | `uml/sys/MObjectImpl.java` | `state/exists/getNavigableObjects` widened to `IModelState`, then unconditionally `(MSystemState)`-cast. `MSystemState` is the **sole `final`** impl → safe. | PLAUSIBLE |
| **L-9** | **`uml/sys/MSystem.java:~599, ~685`** | `(MObjectState)` downcast of `getSelf().state(...)`. **`MInstanceState` has two impls — `MObjectState` *and* `MDataTypeValueState`** — so this lost polymorphism. **Unreachable today** (data-type selfs only flow through *query* ops, which skip this path), but it is the one genuine latent `ClassCastException`. | PLAUSIBLE — **worth a defensive fix.** |

> **Suggested optional hardening for L-9:** guard with `instanceof` (or restore the needed method
> on `IObjectState`) so a future non-query path with a data-type `self` can't `ClassCastException`.
> 2 lines; I can apply it if you want.

### D. Maintenance hazards / dead aggregator code (no runtime or CI impact)

| # | Location | What | Verdict |
|---|---|---|---|
| L-10 | `gui/main/ViewManager.java` | `closeFrame` now calls `close()` reflectively and **swallows** `ReflectiveOperationException`. A non-`ViewFrame` frame that used to CCE is silently ignored; a future non-public/renamed `close()` would silently skip `detachModel()`. | PLAUSIBLE |
| L-11 | `runtime/impl/PluginRuntime.java` | `getExtensionPoint` switched from an always-available singleton `switch` to a map populated only by `MainPluginRuntime.run()` — new init-ordering dependency (all current callers are correctly ordered & guarded). | PLAUSIBLE |
| L-12 | `integration/AllTests.java`, `parser/{shell,soil}/AllTests.java` | JUnit-3 `suite()` aggregators are now dead/inconsistent (omit some relocated tests). **No CI coverage loss** — Surefire 3.5.2 discovers every `*Test` by name — but a non-Maven `suite()` runner would miss tests. | CONFIRMED |

---

## 4. What the verification *refuted* (evidence the review was adversarial, not rubber-stamp)

13 plausible-sounding candidates were knocked down by checking the real code, e.g.:

- **"`gen start` warning-suppression regression"** — *factually wrong*: the ASSL compile path emits no `Log.warn` (warnings go straight to a `PrintWriter`), so moving compilation outside the `setShowWarnings(false)` window changes nothing.
- **"`PersistHelper` `Map<String,Object>` downcasts can CCE"** — every inserted value (incl. `WayPoint`) is provably a `PlaceableNode`.
- **"layering arch-rule was narrowed"** — the removed packages no longer exist as production code; coverage is retained by the surviving `parser..`/`uml..` clauses, and the rule was in fact *tightened* with a new assertion.
- **`SymbolTable.cause: ASTStatement→Object`, `SemanticException`/`SrcPos` move, `VarDeclList`/`MEvent` inlinings** — all verified byte-faithful / cast-safe.

---

## 5. Reproducible evidence (independently re-run)

| Check | Result |
|---|---|
| `mvn install` (Java 21) | ✅ BUILD SUCCESS |
| `mvn test` | ✅ 632 pass · 0 fail/err/skip |
| ArchUnit cycle/layered tests executing & asserting | ✅ 6/6 · all measured slices **0** |
| before→after cycles (re-measured on both branches) | ✅ entire-project **384→0**, layered **21→0** (full table in `PR_decycle-2_STATUS.md`) |
| Example plugins compile vs reshaped API ([use_plugins](../use_plugins)) | ✅ 5/5 |

**Known limitation (disclosed, not a code bug):** the arch suite never slices into
`gui.views.diagrams`, which carries ~600 internal cycles that are **mostly pre-existing,
inherent diagram-engine coupling** (`DiagramView ↔ elements/event/selection/waypoints`) — see
`PR_decycle-2_STATUS.md`. Out of scope for this decycling PR; recommended as a separate
diagram-engine refactor.

---

## 6. Reviewer's bottom line

- **Correctness:** no medium-or-higher defect found across the full diff after adversarial verification.
- **Behaviour preservation:** confirmed domain-by-domain; the handful of deviations are intentional and benign.
- **Completeness:** `module-info`, callers, and test coverage all consistent with the relocations.
- **Recommended before merge:** (a) apply the L-9 defensive cast guard (optional, 2 lines); (b) note the external-API breaks (L-4/5/6) in the release notes / `MIGRATING.md` (the author's catalog already covers them); (c) decide whether the dead `suite()` aggregators (L-12) are worth tidying.
Loading