Skip to content

fix: clear previous results before record lookups - #147

Open
Shubham-Padkonde wants to merge 1 commit into
ServiceNow:mainfrom
Shubham-Padkonde:fix/clear-failed-record-lookups
Open

Shubham-Padkonde wants to merge 1 commit into
ServiceNow:mainfrom
Shubham-Padkonde:fix/clear-failed-record-lookups

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

get() can return False while leaving fields from an initialized or previously retrieved record accessible. The field/value lookup also appends to the previous result set. This lets callers continue reading stale data after a lookup misses.

Clear the result buffer, cursor, count, pagination and new-record state before each lookup in both clients. Query criteria and other request settings stay intact. After a miss, value access follows the existing empty-record behavior (NoRecordException) rather than returning the previous record's values.

Fixes #59.

Validation:

  • python -m pytest test/test_snc_get_state.py test/test_snc_element.py -q: 27 passed on Windows/Python 3.9.25 (pytest 7.4.4) and 3.12.6. Ten new cases cover initialized/retrieved records, empty field lookups, replacement results, and recovery after a miss in both clients. Six cases fail against the unchanged implementation.
  • python -m mypy: no issues in 14 source files.
  • git diff --check: passed.

The lookup tests mock the Table API boundary. I did not run the tenant-dependent integration suite or test against a live ServiceNow instance. Prepared and validated with Codex assistance.

This branch has not been deployed

No deployments
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.

inconsistent get behavior

1 participant