Skip to content

Python: Make media type detection documentation examples runnable - #9188

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
microsoft:mainfrom
BlueRaddish:docs/oct7-media-detection-examples
Oct 14, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
microsoft:mainfrom
BlueRaddish:docs/oct7-media-detection-examples

Conversation

@BlueRaddish

@BlueRaddish BlueRaddish commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Motivation & Context

The public detect_media_type_from_base64 examples used truncated base64 that fails strict decoding when copied. A maintainer identified one remaining invalid literal in the data_uri argument description after the two code blocks were corrected.

Description & Review Guide

  • What are the major changes? Use the valid base64-encoded PNG signature in both code blocks and the argument example.
  • What is the impact of these changes? Copying the remaining argument example now returns image/png instead of raising ValueError. This is a documentation-only change with unchanged runtime code; the actual argument example failed before this follow-up and passed on Windows Python 3.11.17 and Linux Python 3.13.16 afterward. Normal scoped repository hooks passed without changing the patch.
  • What do you want reviewers to focus on? Every base64 literal in this function's documentation uses the same valid PNG signature.

Related Issue

Addresses the maintainer's requested correction on this existing documentation PR. The one-line follow-up is an obvious correction to the copied argument example.

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: OpenAI Codex assisted with diagnosis, the focused documentation correction, verification and this description. The contributor personally reviewed and verified this change.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Copilot AI balanced review requested due to automatic review settings October 8, 2026 00:32

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@eavanvalkenburg

Copy link
Copy Markdown
Member

/review

@github-actions github-actions Bot 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.

MAF Automated Review — Iteration 1

Result: No findings
Scope: full PR (1 commit(s)): d32a23a7afc4
Model: gpt-5.6-sol

Overview

This documentation-only change replaces two invalid truncated Base64 examples with the complete encoding of the PNG signature. The corrected string passes strict Base64 decoding, exercises both the direct-string and data-URI paths, and matches the implementation's PNG magic-byte check without changing runtime or public API behavior. No publishable risk was established.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.

@eavanvalkenburg

Copy link
Copy Markdown
Member

BlueRaddish The public data_uri argument example in python/packages/core/agent_framework/_types.py still uses data:image/png;base64,iVBORw0KGgo..., which fails the implementation's validate=True base64 decode. The two example blocks are fixed, but copying this remaining argument example still raises ValueError; please replace it with valid base64 too.

@BlueRaddish
BlueRaddish deployed to github-app-auth October 13, 2026 09:13 — with GitHub Actions Active
@BlueRaddish
BlueRaddish deployed to github-app-auth October 13, 2026 09:13 — with GitHub Actions Active
Merged via the queue into microsoft:main with commit 168bfa3 Oct 14, 2026
46 checks passed

This branch was successfully deployed

1 active deployment
github-app-auth — aeed90ef Deployed Oct 13, 2026 by BlueRaddish via add_label #25113
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants