Skip to content

Feedback tests for async and sync profiles#23

Merged
Vishwas-testing merged 1 commit intomainfrom
feedback-tests
Apr 9, 2026
Merged

Feedback tests for async and sync profiles#23
Vishwas-testing merged 1 commit intomainfrom
feedback-tests

Conversation

@Vishwas-testing
Copy link
Copy Markdown
Member

Description

Feedback Select AI tests

Test only transaction

@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Feb 25, 2026
Comment thread tests/feedback/conftest.py Outdated
prateeks99
prateeks99 previously approved these changes Mar 18, 2026
Copy link
Copy Markdown

@JJsudo7 JJsudo7 left a comment

Choose a reason for hiding this comment

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

Hi Vishwas,

Looks good overall.
Review comments/suggestions have been provided. Please check.

Thanks!

profile.delete_feedback(prompt_spec=(prompt, action))
logger.info("Retrieving prompt after deletion to verify removal")
show_prompt = profile.show_prompt(DUMMY_PROMPT)
assert response not in show_prompt
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

showprompt is a good downstream validation for response parameter.
But for feedback_content parameter, we might upstream validation of feedback index table. Is it possible to add?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

okkay sure



def test_4004(profile):
"""CASE : Negative feedback test with SHOWSQL ordering by name"""
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you highlight difference btw test test case 4001 and 4004?

Also, negative coverage for non supported actions like NARRATE, CHAT required in Python?

Copy link
Copy Markdown
Member Author

@Vishwas-testing Vishwas-testing Mar 24, 2026

Choose a reason for hiding this comment

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

might not be needed as it is delegating call to dbms_cloud_ai.feedback

Comment thread tests/feedback/test_4000_sync_profile.py Outdated
)
feedback_content = "print in descending order of total_points"
logger.info(
"Expecting DatabaseError when adding negative feedback with prompt=%s action=%s sql_id=%s",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When providing SQL_ID and SQL_TEXT we can have cases -

  1. SQL_ID and SQL_TEXT match - Expected: Feedback addition passes
  2. SQL_ID and SQL_TEXT mismatch - Expected error "ORA-20000: SQL_ID does not match with the SQL text"
    Please check if these cases are covered?

Test 4007 is case 2 since error expected?

Copy link
Copy Markdown
Member Author

@Vishwas-testing Vishwas-testing Mar 30, 2026

Choose a reason for hiding this comment

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

  1. Both sql_id and sql_text are not supported in the function . This behavour is consistent with dbms_cloud_ai.feedback.
  2. covered in new commit

feedback_content = "print in descending order of total_points"
logger.info("Adding negative feedback for prompt=%s action=%s", prompt, action)

profile.add_negative_feedback(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I see another add_negative_feedback() call in this test case with SQL_ID. Would this be needed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

changed

assert prompt in show_prompt

with pytest.raises(oracledb.DatabaseError) as exc_info:
profile.add_positive_feedback(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we have logging for add_positive_feedback?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done



def test_4013(profile):
"""CASE : SQL_TEXT DOES NOT MATCH ANY EXISTING FEEDBACK SQL_TEXT"""
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please have similar test case for Negative Feedback.

Txn lauzhao_bug-38415980 introduced negative feedback addition without need of existing SQL_TEXT. Hence, negative feedback addition with non-existing SQL_TEXT should pass.

Please refer txn joejos_rti-32183121 for the additional tests I have added for this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

added

assert response not in show_prompt
assert prompt not in show_prompt


Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please check if we have test case for feedback deletion with SQL_ID?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

added.



async def test_4119(profile):
"""CASE : SQL_TEXT DOES NOT MATCH ANY EXISTING FEEDBACK SQL_TEXT"""
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Similar maybe added for SQL_ID?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

sql_id = "sql_id_mismatch"

with pytest.raises(oracledb.DatabaseError) as exc_info:
profile.add_positive_feedback(sql_id=sql_id)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please check if we have positive feedback with valid SQL_ID?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

added

feedback_content=feedback_content,
)
logger.info("Retrieving prompt via show_prompt for dummy input")
show_prompt = await profile.show_prompt(dummyPrompt)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please log show_prompt for LRG integration.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ok

prompt_spec=(prompt, action)
)
logger.info("Retrieving prompt after deletion to verify removal")
show_prompt = await profile.show_prompt(dummyPrompt)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should it be logged ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

okkay done

feedback_content=feedback_content,
)
logger.info("Retrieving prompt via show_prompt for dummy input")
show_prompt = await profile.show_prompt(dummyPrompt)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please make sure to add additional logging as applicable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

okkay

logger.info("Deleting feedback for prompt=%s action=%s", prompt, action)
await profile.delete_feedback(
prompt_spec=(prompt, action)
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Verify if prompt is removed ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That is being verified using assert statements

prompt_spec=(prompt, action),
response=response,
feedback_content=feedback_content,
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a way to confirm is feedback is added ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes added logging for feedback table

Copy link
Copy Markdown
Member Author

@Vishwas-testing Vishwas-testing left a comment

Choose a reason for hiding this comment

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

Used cursor for tests as acknowledged by abhishek

Feedback tests for async and sync profiles

Adding feedback logging

address comments

reviewed comments

comments correction
prompt = PROMPT
action = Action.SHOWSQL
sql_id = SHOWSQL_SQL_ID
feedback_content = "print in ascending order of total_points"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In dbms_cloud_ai.feedback, providing negative feedback for existent SQL with just feedback content would yield LLM interaction and pass.

Please check if the disparity in behaviour btw python and SQL expected?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

sure i will check and file a bug if needed

Copy link
Copy Markdown
Member

@Pushpendra-Garg Pushpendra-Garg left a comment

Choose a reason for hiding this comment

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

Changes look good.

@Vishwas-testing Vishwas-testing merged commit cc524e2 into main Apr 9, 2026
1 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants