Skip to content

refactor: emit geometry-free PNML and slim the transformer to a pure translator#237

Closed
JakobDPunkt wants to merge 22 commits into
mainfrom
feature/WWI23B4_T2P
Closed

refactor: emit geometry-free PNML and slim the transformer to a pure translator#237
JakobDPunkt wants to merge 22 commits into
mainfrom
feature/WWI23B4_T2P

Conversation

@JakobDPunkt

Copy link
Copy Markdown

Description

Brings the WWI23B4 transformer work to main. The transformer is a lean, pure translator that emits geometry-free PNML and leaves layout to the downstream service.

  • Geometry-free PNML: no placeholder coordinates and no <orientation> — node positions and edge routing are owned downstream by t2p-2.0.
  • Correct operator orientation: workflow operators are oriented per type, so an AND-join is no longer mirrored as a split.
  • Cleaner labels: PNML transition names are no longer prefixed with [UserTask] / [ServiceTask].
  • Slimmed down: removed dead model fields, never-called methods and an orphan module; consolidated the b2p split/join dispatch and the same-type arc wiring; tidied test assets.

Checklist

  • Code has been tested locally
  • All existing tests pass
  • Changes are documented
  • PR adheres to the contributing guidelines
  • Reviewers have been assigned

Additional Notes

No merge conflicts: main had no commits this branch was missing, so this merges cleanly (fast-forwardable). The geometry-free output pairs with the layout work in the t2p-2.0 PR, which now owns positions and edge waypoints.

JakobDPunkt and others added 22 commits May 20, 2026 09:04
Point .woped-hooks submodule at the live main branch and add a root
pre-commit config referencing the PythonHooks/ subfolder, since the
upstream hooks repo was reorganized and the pinned commit/branch no
longer exist.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Initial formatting sweep so existing code matches the pre-commit
ruff-format hook. Formatting only; no behavioral changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
OR (inclusive) gateways are rejected at BPMN Process construction
(NotSupportedBPMNElement), so the inclusive-gateway preprocessing pass
could never run. Remove the unreachable module, its pipeline
registration, the unused ORGatewayDetectionIssue exception, and the
orphaned OR test asset. The OrGateway model and the construction-time
rejection (the actual validation) are kept.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the f-string debug log with the logging module's %s-args form so
interpolation only happens when DEBUG is enabled, and clear the E501
on that line.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bump version.py to 2.1.0 ahead of the combined feature-branch release PR.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The README documented a non-existent API and entry point. Corrected:

- POST /transform: direction is a query param (bpmntopnml|pnmltobpmn) and
  the model is form-data (key bpmn|pnml), response {"pnml"|"bpmn": ...} —
  not a JSON {data, format} body
- GET /health returns {"healthy": true} (+ optional ?message=), not
  {status, timestamp}
- Entry point is flasky.py (flasky:app via boot.sh), not a missing wsgi.py
- Docker section reflects the real Dockerfile (python:3.13-slim, venv,
  ENTRYPOINT boot.sh) and port 5000, not a fabricated gunicorn-on-8080 image
- Dependencies: pydantic_xml/defusedxml, not lxml
- Drop the stale "Recent Refactoring (February 2026)" section and footer

Also remove two empty 0-byte sub-READMEs (app/transform, app/health).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Clears Dependabot alerts: flask-cors 6.0.5, urllib3 2.7.0, requests 2.34.2,
Werkzeug 3.1.8, Jinja2 3.1.6, idna 3.18, python-dotenv 1.2.2, pytest 9.1.1.
Removes orphaned app/transform/requirements.txt (not installed anywhere, lxml
unused) and the dead requirements references in the devcontainer postCreate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ceTask]

The BPMN task type is already carried by the WoPeD toolspecific resource
marking, so prefixing it into the visible transition name only produces long,
redundant labels (e.g. "[ServiceTask] Ship Item") that downstream clients have
to strip again. Use the plain node name and update the affected test fixtures.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
WOPED reads a transition's <orientation> as the operator position and lets it
override the per-type default (split fans EAST, join fans WEST). The fixed
default of EAST was right for splits but mirrored every join, so an AND-join
rendered exactly like a split in the fat client. Set orientation per operator
type instead: splits -> EAST(1), joins/combined operators -> WEST(3).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Name offsets, trigger/resource graphics, and global bounds were
serialized with hardcoded 20,20 placeholders that t2p-2.0 strips and
recomputes anyway. Make these graphics fields Optional/None so the
transformer carries no geometry — layout is owned solely by t2p-2.0.
Also removes the source of the PNML label-offset stacking bug.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
<orientation> is presentation state, not semantics -- the operator type
already defines AND/XOR split/join. woped-next ignores it; the fat client,
when <orientation> is absent, applies the correct per-type default
(split->EAST, join->WEST, layout-aware), so the AND-join renders right
without us setting it. Drops the explicit assignment, the field default,
and the now-dead EAST/WEST constants; field kept for parse tolerance.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
It imports NotSupportedNode from bpmn.base, which does not exist -- the
module would raise ImportError if used. Nothing imports it; unsupported
BPMN elements raise NotSupportedBPMNElement on the live path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fields never read on parse nor set on write: Net.type_field,
Toolspecific.probability/displayProbabilityOn/displayProbabilityPosition,
and the now-unused orientation field. pydantic-xml ignores unknown
elements/attrs on parse, so dropping them is round-trip-safe.
Methods with no caller in app or tests: set_name, is_node_existing,
add_nodes, get_flow, get_flow_source_by_id, get_flow_target_by_id,
add_arc_with_handle_same_type_from_id.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
test_check_tokens only asserted True; real coverage is the checkTokens
e2e test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ToolspecificGlobal kept only window/UI state (scale, tree widths, panel
visibility, verticalLayout) plus never-produced BPEL/simulation slots;
transitions carried hardcoded <time>0</time>/<timeUnit>1</timeUnit>.
None are read by woped-next or required by the fat client (all isSet-
guarded, defaulted when absent). Keep only resources on the global block.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The e2e payload/expected files live under tests/transform/assets/diagrams,
but the tests referenced tests/assets/diagrams (a non-existent dir), so they
would FileNotFoundError if run with E2E_URL set.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
21 BPMN/PNML diagrams under assets/diagrams were loaded by no test. Move them
to assets/examples/ with a README so the corpus is clearly stored-but-unused
and cannot be mistaken for active fixtures. diagrams/ now holds only the
e2e_*.xml the e2e suite uses.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The 'scan flattened net for NetElements matching a predicate' query was
copy-pasted: find_triggers plus two byte-identical resource comprehensions
in workflow_helper. Extract _find_net_elements(net, predicate); express
find_triggers/find_workflow_resources through it and route the workflow_helper
copies through find_workflow_resources. pnmltobpmn-only, no cross-direction
coupling.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
vanilla_gateway_transition and event_trigger both turned a high-degree node
into an explicit helper + gateway wiring via near-identical
handle_split/join/join_split plus a degree-dispatch loop. Extract the skeleton
into split_dispatch.split_by_degree, parameterized by the element factory
(+ a join-split hook and a sequence-split flag). Each module keeps only its
factory. pnmltobpmn-only, no cross-direction coupling.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The remaining-flow loop inlined a byte-for-byte copy of
add_arc_with_handle_same_type (place->place inserts a silent transition,
transition->transition a silent place, else a plain arc). Call the Net method
instead and drop the now-unused import. bpmntopnml-only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
transform_workflow_helper.add_arc reimplemented the place<->place /
transition<->transition silent-node bridging that
Net.add_arc_with_handle_same_type already does (identical for all reachable
Place/Transition inputs; only the unreachable same-type-non-node else-branch
differed). Delegate to the Net method and drop the now-unused imports.

The six add_wf_* operator builders are left as-is on purpose: they encode
distinct XOR/AND split/join/split-join patterns and already share their
primitives, so merging them would be a false abstraction, not real dedup.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
No caller in app or tests; the specific predicates (is_workflow_operator,
is_workflow_resource, is_workflow_event_trigger, ...) are used instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@JakobDPunkt JakobDPunkt requested a review from KanBen86 June 24, 2026 19:52
@JakobDPunkt

Copy link
Copy Markdown
Author

Closing without merging — superseded by a forthcoming PR with the up-to-date version and without the stray/poor merge-conflict patches that ended up in this one.

@JakobDPunkt JakobDPunkt deleted the feature/WWI23B4_T2P branch June 29, 2026 10:58
@JakobDPunkt JakobDPunkt restored the feature/WWI23B4_T2P branch June 29, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant