fix: parse activation response root element correctly#148
Open
Edgars-Ralfs-Dunis wants to merge 1 commit into
Open
fix: parse activation response root element correctly#148Edgars-Ralfs-Dunis wants to merge 1 commit into
Edgars-Ralfs-Dunis wants to merge 1 commit into
Conversation
The ADT activation response's ROOT element is <chkl:messages> (or <ioc:inactiveObjects>), but parseActivationResult declared them as child fields. xml.Unmarshal maps the root element onto the target struct itself, so the parser silently found zero messages and reported Success=true even when SAP rejected activation with syntax errors (type="E" messages). Declare the root's children (<msg> / <entry>) directly on the response struct so both known root forms parse. Adds regression tests using a real captured payload.
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.
Problem
Activatereturnssuccess: true, messages: []even when SAP rejects the activation — the object silently stays inactive. Every workflow that trustsactivation.Success(WriteSource,WriteClass,DeployFromFile,CreateTable,ActivatePackage— ~20 call sites) inherits the false positive. Verified on v2.38.1 and current main.Repro: write a program with a syntax error via
UpdateSource(so the pre-save check doesn't block), callActivate→{"success": true, "messages": []}, butGetInactiveObjectsshows the object still inactive.Root cause
Replaying the activation POST with curl shows SAP does return the error — HTTP 200 with:
parseActivationResultdeclaresmessages/inactiveObjectsas child fields, but<chkl:messages>(or<ioc:inactiveObjects>) is the root element.xml.Unmarshalmaps the root onto the target struct itself, so the parser looked for a<messages>child inside the root, matched nothing, decoded zero messages without error, andSuccessstayedtrue. (The siblingparseSyntaxCheckResultsdeclares its structs one level deeper, which is whySyntaxCheckworks.)Fix
Declare the root's children (
<msg>/<entry>) directly on the response struct — both known root forms parse with one struct since unmarshalling matches child local names.Testing
pkg/adt/devtools_activation_test.gousing a real payload captured from a NW 7.50 system: error-message root form, inactive-objects root form, empty-body success.go vet ./pkg/adtclean.