Skip to content

Sql guardrails, Improve error handling, fix precision defaults for float attribute#185

Open
sagebree wants to merge 4 commits into
mainfrom
users/sagebree/ga_fixes2
Open

Sql guardrails, Improve error handling, fix precision defaults for float attribute#185
sagebree wants to merge 4 commits into
mainfrom
users/sagebree/ga_fixes2

Conversation

@sagebree
Copy link
Copy Markdown
Contributor

  • SQL guardrails — block statement stacking and writes hidden by comments, string literals, or zero-width prefixes
  • DataFrame MultiIndex columns rejected up-front with a flatten hint instead of producing tuple keys that fail deep in the JSON encoder
  • records.get() deprecation warning now names both migration paths (retrieve() for single-by-ID and list(filter=...) for filtered queries)
  • Server error.innererror.message appended to HttpError.message on both single-request and batch paths, so the offending field/dtype reaches users without inspecting the wire payload
  • "float"/"double" shorthand precision default raised from 2 to 5 (max for DoubleAttributeMetadata.Precision) so values like 2.718 round-trip without silent truncation; decimal/money left at 2

… messages for better debugging; update precision defaults for float attributes; add tests for innererror handling and MultiIndex DataFrames.
Copilot AI review requested due to automatic review settings May 28, 2026 04:44
@sagebree sagebree requested a review from a team as a code owner May 28, 2026 04:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens Dataverse client validation and improves user-facing diagnostics around SQL safety, pandas DataFrame conversion, deprecated record retrieval, and server error messages.

Changes:

  • Adds SQL guardrails for stacked statements, comment-hidden writes, string-literal masking, and zero-width-prefixed write keywords.
  • Improves error messages for pandas MultiIndex columns and Dataverse innererror.message payloads.
  • Updates records.get() deprecation guidance and changes float/double metadata precision defaults from 2 to 5.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/PowerPlatform/Dataverse/utils/_pandas.py Rejects MultiIndex DataFrame columns before record conversion.
src/PowerPlatform/Dataverse/operations/records.py Expands records.get() deprecation warning with retrieve/list migration paths.
src/PowerPlatform/Dataverse/data/_odata.py Appends nested Dataverse inner error details to HttpError messages.
src/PowerPlatform/Dataverse/data/_odata_base.py Updates float precision default and strengthens SQL guardrails.
src/PowerPlatform/Dataverse/data/_batch_base.py Appends nested inner error details for top-level batch failures.
tests/unit/test_pandas_helpers.py Adds MultiIndex rejection coverage.
tests/unit/data/test_sql_guardrails.py Adds SQL guardrail regression coverage.
tests/unit/data/test_odata_internal.py Adds inner-error parsing and precision default tests.
tests/unit/data/test_batch_edge_cases.py Adds batch inner-error parsing coverage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/PowerPlatform/Dataverse/utils/_pandas.py Outdated
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