Skip to content

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

Merged
sagebree merged 4 commits into
mainfrom
users/sagebree/ga_fixes2
May 28, 2026
Merged

Sql guardrails, Improve error handling, fix precision defaults for float attribute#185
sagebree merged 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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
@sagebree sagebree merged commit 48271b7 into main May 28, 2026
9 checks passed
@sagebree sagebree deleted the users/sagebree/ga_fixes2 branch May 28, 2026 17:54
abelmilash-msft added a commit that referenced this pull request May 29, 2026
Release changelog and version bump for v1.0.0.

## Changes
- Converted `[Unreleased]` to `[1.0.0] - 2026-05-25` in `CHANGELOG.md`
- Incorporated all PRs merged since `v0.1.0b10`: async client (#171),
shorter imports (#165), OperationContext allowlisting (#181),
CreateEntities API (#183), migration tool fixes (#184), SQL guardrails /
error handling / float precision (#185), `QueryResult.__aiter__` (#187),
Python 3.10/3.11 fix (#188)
- Bumped `version` in `pyproject.toml` from `0.1.0b11` → `1.0.0`

---------

Co-authored-by: Abel Milash <abelmilash@microsoft.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants