Skip to content

[MCC-1484891] Python Lib - Align publish/dry_publish results on canonical envelope - #56

Merged
ibaig-mdsol merged 4 commits into
mainfrom
feat/MCC-1484891-harmonize-publish-response-envelope
Aug 5, 2026
Merged

[MCC-1484891] Python Lib - Align publish/dry_publish results on canonical envelope#56
ibaig-mdsol merged 4 commits into
mainfrom
feat/MCC-1484891-harmonize-publish-response-envelope

Conversation

@dsilaghi-mdsol

Copy link
Copy Markdown
Contributor

feature

  • Python Lib - Hide dataset_batch_number from publish/dry_publish output
  • MCC-1535269

Checklist

  • Review the pull request to fix typos and ensure variable/function names are intuitive, etc.
  • Make sure the pull request does not have excessive number of unnecessary commits. Utilize the git commit --amend --no-edit command to reduce commit messages when making small file changes (like changing linespacing).
  • Make sure you have added unit tests for the code changes. Tests should be added in the tests/ folder.
  • Modify docs, if required. Add any new documentation in the doc/ folder.
  • Rebase on latest active development branch (develop/main).

Changes Summary

Stop showing dataset_batch_number when a PublishResult or DryPublishResult is printed, without removing it from the API.

  • Mark ResultMetadata.dataset_batch_number repr=False. result.dataset_batch_number and result.metadata.dataset_batch_number keep working; only the printed representation changes.
  • No transport or mapper changes: the server still sends the field and the SDK still parses it, so ResponseMetadata stays an honest mirror of the wire.
  • Add tests asserting the field is absent from repr() for dry_publish (pass and fail) and publish, that it's still readable via both accessors, and that the rest of ResultMetadata is still printed.

Deployment Notes

None

…ical envelope

Parse the canonical envelope the Arrow Flight server now emits (MCC-1533427)
and expose it as metadata / metrics / checks / errors / invalid_records on
both public results.

- transport gains a single PublishEnvelope; DryPublishResponse and
  PublishResponse become aliases of it, so one wire type covers both calls
- the 16 flat json_result.get() lookups collapse into PublishEnvelope.from_json,
  which degrades to defaults on missing sections rather than raising
- flat fields (status, valid_record_count, no_of_columns, is_dataset_valid, …)
  are kept as properties reading through to the envelope, so existing
  notebooks and vignettes keep working with no duplicated state
- publish_response_to_domain and dry_publish_response_to_domain share one
  _envelope_to_domain mapper
- invalid_records still arrives on the Arrow IPC channel, not in the JSON

Tests use envelopes captured verbatim from the Arrow server, so the SDK
fails if it drifts from what the server actually emits.
… dry_publish output

The batch number is an internal detail and should not appear when users print
a publish or dry_publish result. Marking the field repr=False drops it from
the printed output while leaving it on the object, so callers reading
result.dataset_batch_number or result.metadata.dataset_batch_number keep
working and no deprecation cycle is needed.

Deliberately not removed from the API. Dropping a field that released clients
already read is what caused MCC-1533427, and the ticket only requires that it
stop being displayed.

No Arrow change: the server still sends dataset_batch_number and the transport
layer still parses it, so ResponseMetadata remains an honest mirror of the wire.

Tests assert the field is absent from the repr across all three entry points
(dry_publish failure, dry_publish success, publish) while remaining readable,
plus a guard that the rest of the metadata section is still printed. Verified
to fail without the change: 3 of 5 fail on revert.
butsyk-mdsol
butsyk-mdsol previously approved these changes Aug 4, 2026
@dsilaghi-mdsol dsilaghi-mdsol self-assigned this Aug 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown

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 updates the Python SDK’s canonical publish/dry_publish result envelope so dataset_batch_number remains part of the public API but is no longer shown in the default printed representation (repr/str) of results and their metadata.

Changes:

  • Hide ResultMetadata.dataset_batch_number from dataclass repr() output via repr=False while keeping the field accessible programmatically.
  • Add unit tests to assert dataset_batch_number is not present in printed output for publish and dry_publish results and that metadata still includes other expected fields.
  • Bump the package version to 1.1.0.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
dataconnect/models.py Marks dataset_batch_number as repr=False to hide it from printed output while preserving accessors.
tests/test_publish_envelope.py Adds tests validating dataset_batch_number is omitted from repr() and that metadata remains readable/printed as expected.
pyproject.toml Updates the library version to 1.1.0.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@ibaig-mdsol
ibaig-mdsol merged commit 8fe6520 into main Aug 5, 2026
5 of 7 checks passed
@ibaig-mdsol
ibaig-mdsol deleted the feat/MCC-1484891-harmonize-publish-response-envelope branch August 5, 2026 06:37
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.

4 participants