fix(adt): treat program includes as source-bearing objects, not class includes - #139
fix(adt): treat program includes as source-bearing objects, not class includes#139enricoandreoli wants to merge 1 commit into
Conversation
… includes EditSource, SyntaxCheck and the package/transport safety check all classified any URL containing "/includes/" as an ABAP *class* include. A *program* include URL — /sap/bc/adt/programs/includes/<NAME> — also contains "/includes/" but behaves like a program: its source lives at <url>/source/main, and the include itself is the repository object that carries the package/transport. Effects before the fix (program includes only): - EditSource read the bare object URL with Accept: text/plain instead of <url>/source/main -> backend returns HTTP 406 (Not Acceptable), so editing any program include (e.g. report sub-includes _TOP/_F01/...) was impossible. - SyntaxCheck pointed the artifact URI at the bare object URL. - normalizeObjectURLForPackageCheck collapsed the URL to /sap/bc/adt/programs, losing the include name for the package/transport gate and error messages. Fix: qualify the class-include detection with the /oo/classes/ prefix in all three spots, so program includes fall through to the normal /source/main path (matching GetSourceURL/GetSource, which already handle them correctly).
|
Confirming this from an independent report — we hit the exact same three spots on our fork (txape10/vibing-steampunk) while adding program-include write support, filed as our own issue #133, fixed in
Same fix shape as proposed here: scope all three checks to require Noting since PR #121 (which already carries this same fix bundled with the new |
fix(adt): treat program includes as source-bearing objects, not class includes
EditSource,SyntaxCheckand the package/transport safety check all treatedany URL containing
/includes/as an ABAP class include. A programinclude URL --
/sap/bc/adt/programs/includes/<NAME>-- also contains/includes/but behaves like a program: its source lives at<url>/source/mainand the include itself is the repository object carrying the package/transport.
Symptom
Editing any program include fails at the read step:
GetSourceon the same include works (it usesGetSourceURL, which alreadyappends
/source/mainforObjectTypeInclude), so the object and backend arehealthy -- only the edit / syntax-check / package-gate paths break.
Root cause
Three spots use a naive
strings.Contains(objectURL, "/includes/"):pkg/adt/workflows_edit.go(EditSourceWithOptions): when it thinks theobject is a class include it skips the
/source/mainsuffix, so it GETs thebare object URL with
Accept: text/plainand the backend returns HTTP 406.pkg/adt/devtools.go(SyntaxCheck): sets the artifact URI to the bareobject URL instead of the source location.
pkg/adt/client.go(normalizeObjectURLForPackageCheck): stripseverything from
/includes/to get the parent class, which collapses/sap/bc/adt/programs/includes/<NAME>down to/sap/bc/adt/programs, losingthe object for the package/transport gate and for
objectNameFromURL.A program-include URL
/sap/bc/adt/programs/includes/<NAME>also contains/includes/, while a program include's source is at<url>/source/mainandthe include itself is the repository object. Only class includes
(
/sap/bc/adt/oo/classes/<CLASS>/includes/<type>) expose source at the bareinclude URL and delegate package/transport to the parent class.
Fix
Qualify the class-include detection with the
/oo/classes/prefix in all threespots, so program includes fall through to the normal
/source/mainpath thatGetSourceURL/GetSourcealready use. Class includes are unaffected -- theirURLs contain both
/oo/classes/and/includes/.Testing
EditSourceon a programinclude returns HTTP 406, while
GetSourceon the same include succeeds --because
GetSourcealready routes through<url>/source/mainandEditSourcedid not.
/source/mainroute for theread, syntax-check, update and package-gate steps; class-include handling
(test classes etc.) is unchanged by construction (
/oo/classes/still matches).go build ./cmd/vsp, windows/arm64). End-to-end verification ofan edit on the patched binary is still pending and not yet confirmed here.