Skip to content

http oracle partial update put#1471

Open
omursahin wants to merge 8 commits intomasterfrom
oracle-partial-update-put
Open

http oracle partial update put#1471
omursahin wants to merge 8 commits intomasterfrom
oracle-partial-update-put

Conversation

@omursahin
Copy link
Copy Markdown
Collaborator

No description provided.

@omursahin omursahin requested a review from arcuri82 April 3, 2026 07:24
* PUT /path -> 2xx (successful update/create with body B)
* GET /path -> 2xx (must return exactly the fields that were PUT)
*
* Returns true if any field sent in the PUT body has a different value
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is partial. you need also to check that GET is not returning fields not used in the PUT. or, if those are returned, if they are null

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, need to check the differences in what declared in the schema, eg, the resource might have fields that are not supposed to be changed via a PUT (eg timestamps or ids)

val putBody = extractRequestBody(put)
val getBody = resGet.getBody()

if (putBody.isNullOrEmpty() || getBody.isNullOrEmpty()) return false
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if putBody is empty, but getBody is not, then we got a bug

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also added this statement: if putBody is not empty, but getBody is. What do you think about that? Is that correct or lead to false positives?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@omursahin hi, yes, should be fine, i guess shouldn't harm. but, anyway, those cases should still be handled when looking at fields one by one, isn't it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this,
if (putBody.isNullOrEmpty() && !getBody.isNullOrEmpty()) return true
yes, you are right. I am updating it now.

But I guess we don't need to check fields for this statement:
if (!putBody.isNullOrEmpty() && getBody.isNullOrEmpty()) return true
Because if we send any value with put, we expect that it should be returned in the get body, right?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, if send with PUT, we expect in GET.


if (putBody.isNullOrEmpty() || getBody.isNullOrEmpty()) return false

val fieldNames = extractModifiedFieldNames(put)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here it should rather check the field names of what declared in the schema of the PUT. i have added some more discussion and examples to 2026/httporacles/notes.txt

* Sequence checked:
* PUT /X body=B -> 2xx
* GET /X -> response body must match exactly B
* (no field from a previous state should bleed through)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see updated discussion at 2026/httporacles/notes.txt

@Test
fun testRunEM() {

runTestHandlingFlakyAndCompilation(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if best in a E2E or an integration test, but check to verify the example discussed in 2026/httporacles/notes.txt, especially making sure that K does not lead to flag a fault (ie false positive)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked it in \core\src\test\kotlin\org\evomaster\core\problem\rest\oracle\HttpSemanticsOracleTest.kt but if you want, I can write an integration test too.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as long as it checked, then it is fine :)

@omursahin omursahin requested a review from arcuri82 April 14, 2026 17:08
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.

2 participants