Skip to content

refactor(model): defensively copy collection fields, expose unmodifiable views - #83

Merged
Zhoujie628 merged 1 commit into
project-openan:mainfrom
Zhoujie628:main
Sep 17, 2026
Merged

Zhoujie628 merged 1 commit into
project-openan:mainfrom
Zhoujie628:main

Conversation

@Zhoujie628

Copy link
Copy Markdown
Contributor

Model types returned raw references to their internal collections, so a caller mutating a getter result silently corrupted engine-owned snapshots and could leak across concurrent executions.

Collection fields on Workflow, WorkflowStep, WorkflowSearchResult, ExecutionResult, SendMessageResult, TaskResult, BusinessFailure and the message records are now copied on write and exposed through unmodifiable views.

Source- and binary-compatible: no signatures change, and no call site in the reactor mutates a returned collection. Callers that do mutate getter results now receive UnsupportedOperationException instead of corrupting engine state; noted in the changelog for integrators.

SpotBugs EI exclusions narrow accordingly: the blanket EI acceptance is replaced by targeted rules for Lombok-generated builders (build() performs the copies) and five documented engine-internal acceptances, so future model code with raw exposure fails the gate.

@Zhoujie628
Zhoujie628 requested a review from a team as a code owner September 17, 2026 08:03
…ble views

Model types returned raw references to their internal collections, so a
caller mutating a getter result silently corrupted engine-owned snapshots
and could leak across concurrent executions. Collection fields on
Workflow, WorkflowStep, WorkflowSearchResult, ExecutionResult,
SendMessageResult, TaskResult, BusinessFailure and the message records
are now copied on write and exposed through unmodifiable views.

Source- and binary-compatible: no signatures change, and no call site in
the reactor mutates a returned collection. Callers that do mutate getter
results now receive UnsupportedOperationException instead of corrupting
engine state; noted in the changelog for integrators.

SpotBugs EI exclusions narrow accordingly: the blanket EI acceptance is
replaced by targeted rules for Lombok-generated builders (build() performs
the copies) and five documented engine-internal acceptances, so future
model code with raw exposure fails the gate. Copies are null-tolerant
where entries may be null, preserving graph-validation semantics covered
by WorkflowExecutorTest.

Signed-off-by: Zhoujie628 <zhoujie628@users.noreply.github.com>
@Zhoujie628
Zhoujie628 merged commit 8b722eb into project-openan:main Sep 17, 2026
3 checks passed
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