Skip to content

fix(adt): treat program includes as source-bearing objects, not class includes#139

Open
enricoandreoli wants to merge 1 commit into
oisee:mainfrom
enricoandreoli:fix/program-include-editsource
Open

fix(adt): treat program includes as source-bearing objects, not class includes#139
enricoandreoli wants to merge 1 commit into
oisee:mainfrom
enricoandreoli:fix/program-include-editsource

Conversation

@enricoandreoli

Copy link
Copy Markdown

fix(adt): treat program includes as source-bearing objects, not class includes

EditSource, SyntaxCheck and the package/transport safety check all treated
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 carrying the package/transport.

Symptom

Editing any program include fails at the read step:

status 406 at /sap/bc/adt/programs/includes/<NAME>:
Accepted content types: application/vnd.sap.adt.programs.includes.v2+xml

GetSource on the same include works (it uses GetSourceURL, which already
appends /source/main for ObjectTypeInclude), so the object and backend are
healthy -- 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 the
    object is a class include it skips the /source/main suffix, so it GETs the
    bare object URL with Accept: text/plain and the backend returns HTTP 406.
  • pkg/adt/devtools.go (SyntaxCheck): sets the artifact URI to the bare
    object URL instead of the source location.
  • pkg/adt/client.go (normalizeObjectURLForPackageCheck): strips
    everything from /includes/ to get the parent class, which collapses
    /sap/bc/adt/programs/includes/<NAME> down to /sap/bc/adt/programs, losing
    the 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/main and
the include itself is the repository object. Only class includes
(/sap/bc/adt/oo/classes/<CLASS>/includes/<type>) expose source at the bare
include URL and delegate package/transport to the parent class.

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 that
GetSourceURL / GetSource already use. Class includes are unaffected -- their
URLs contain both /oo/classes/ and /includes/.

Testing

  • Reproduced on a live S/4 backend with v2.38.1: EditSource on a program
    include returns HTTP 406, while GetSource on the same include succeeds --
    because GetSource already routes through <url>/source/main and EditSource
    did not.
  • After the fix, program includes take that same /source/main route for the
    read, syntax-check, update and package-gate steps; class-include handling
    (test classes etc.) is unchanged by construction (/oo/classes/ still matches).
  • Builds clean (go build ./cmd/vsp, windows/arm64). End-to-end verification of
    an edit on the patched binary is still pending and not yet confirmed here.

… 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).
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