fix(adt): treat program includes as source-bearing objects, not class includes#139
Open
enricoandreoli wants to merge 1 commit into
Open
fix(adt): treat program includes as source-bearing objects, not class includes#139enricoandreoli wants to merge 1 commit into
enricoandreoli 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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.