Skip to content

fix(adt): reuse an object's existing open transport on write instead of 409-ing (#144)#145

Open
zooloo303 wants to merge 1 commit into
oisee:mainfrom
zooloo303:fix/144-reuse-open-transport
Open

fix(adt): reuse an object's existing open transport on write instead of 409-ing (#144)#145
zooloo303 wants to merge 1 commit into
oisee:mainfrom
zooloo303:fix/144-reuse-open-transport

Conversation

@zooloo303

Copy link
Copy Markdown

Summary

Fixes #144. When editing an object that is already captured in an open transport
request of the current user, vsp binds the write to a new request, and SAP
rejects it with:

409 ExceptionResourceLockConflict
Object ... is already locked in request <id> ... cannot be edited under a new request

ADT / Eclipse reuse the lock's existing request automatically. This does the same:
when the caller supplies no transport, fall back to the request SAP already returns
on the LOCK response as LockResult.CorrNr.

Change

New helper resolveWriteTransport(supplied, lockCorrNr, opName)
(pkg/adt/transport_reuse.go), wired in right after the lock in the primary update
entry points:

  • WriteProgram, WriteClass (pkg/adt/workflows.go)
  • EditSourceWithOptions (pkg/adt/workflows_edit.go)

Safety

The fallback re-runs checkTransportableEdit on the resolved request, so auto-reuse
cannot bypass --allow-transportable-edits or the --allowed-transports
whitelist. An explicitly-supplied transport is used unchanged (already gated at the
top-level mutation gate). A local object (no open request) is unchanged (empty
transport).

Tests

TestResolveWriteTransport covers explicit-wins, local/no-op, fallback-when-allowed,
and the safety-critical case where the fallback is blocked because transportable
edits are disabled. go test ./pkg/adt/... is green.

Verified live against an on-prem system: editing an object already bound to an open
request now succeeds without the caller supplying the transport (previously a
409), and the object is left clean afterwards.

Scope / follow-up

Covers PROG/CLAS full-source writes and surgical EditSource (any object type). The
same one-line reuse applies to writeSourceUpdate (INTF/DDLS/BDEF/SRVD),
writeClassMethodUpdate, and UpdateFromFile — happy to fold those in if you'd
prefer one comprehensive change; kept minimal here for reviewability.

Note: this touches the same write paths as #125 / #108; it composes cleanly with them
(verified by stacking all three locally and exercising the combined path live).

When the caller supplies no transport, fall back to the request the object is
already bound to (LockResult.CorrNr) instead of binding the write to a new
request and hitting 409 ExceptionResourceLockConflict. The fallback re-checks
transportable-edit policy so it never bypasses --allow-transportable-edits.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

edit should auto-reuse an object's existing open transport instead of 409-ing

1 participant