[Mgmt] Harden SDK review contracts and trusted evidence preflight - #49231
Open
Yuchao Yan (msyyc) wants to merge 7 commits into
Open
Yuchao Yan (msyyc) wants to merge 7 commits into
Yuchao Yan (msyyc) wants to merge 7 commits into
Conversation
Use immutable evidence identities, deterministic routine checks, bounded read-only semantic preflight, and independent publication validation. Retain production regressions and document the post-merge canary gate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 33140644-f61b-423c-8c1c-8aeaae608f78
Preserve source collection diagnostics as partial review outcomes, require current SDK evidence for checks and findings, and exclude only the host-only service endpoint from link checks. Retain historical attribution evidence and cover both validation gates with regressions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 33140644-f61b-423c-8c1c-8aeaae608f78
… pipeline Resolve and pin Azure-owned SDK PR targets for msyyc manual dispatches, default to the selected workflow branch, and preserve the existing label path. Recheck authorization at service and publisher entry points for partial reruns. Exercise both event types through the same pinned publisher and retain fixed-target publication safeguards. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 33140644-f61b-423c-8c1c-8aeaae608f78
|
Azure Pipelines: Successfully started running 1 pipeline(s). 9 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Yuchao Yan (msyyc)
marked this pull request as ready for review
September 28, 2026 07:32
Yuchao Yan (msyyc)
requested review from
a team,
jenny (JennyPng),
Daniel Jurek (danieljurek) and
Libba Lawrence (l0lawrence)
as code owners
September 28, 2026 07:32
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Client and version evidence can be omitted when pyproject.toml was not already cached.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Hardens management SDK review evidence collection, validation, and publication.
Changes:
- Adds trusted evidence collection and deterministic checks.
- Introduces schema-v2 preflight and publication validation.
- Adds manual dispatch support and regression coverage.
| File | Description |
|---|---|
eng/ignore-links.txt |
Excludes the local review endpoint. |
.github/workflows/mgmt-sdk-pr-review.md |
Defines the hardened workflow. |
.github/workflows/mgmt-sdk-pr-review.lock.yml |
Compiles the updated workflow. |
.github/workflows/scripts/mgmt_sdk_review_context.py |
Collects and pins review context. |
.github/workflows/scripts/mgmt_sdk_review_contract.py |
Validates and renders reviews. |
.github/workflows/scripts/mgmt_sdk_review_evidence.py |
Implements evidence policy and checks. |
.github/workflows/scripts/mgmt_sdk_review_service.py |
Provides host-side preflight operations. |
.github/workflows/tests/test_mgmt_sdk_review_trigger.py |
Tests trigger authorization. |
.github/workflows/tests/test_mgmt_sdk_review_reliability.py |
Tests reliability boundaries. |
.github/workflows/tests/test_mgmt_sdk_review_context.py |
Updates collector expectations. |
.github/workflows/tests/test_mgmt_sdk_review_comment.py |
Updates publication contract tests. |
.github/workflows/tests/mgmt_review_runtime.cjs |
Extends runtime integration coverage. |
.github/workflows/tests/fixtures/mgmt-review/historical/contract-failures.json |
Captures historical failure shapes. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Check pinned sync and async client declarations as data and independently derive blocking findings with client.tsp customization guidance. Preserve existing-release exemptions and uncertain evidence outcomes. Pin authoritative rules to the same trusted workflow revision so branch tests exercise candidate policy without reading SDK PR rules. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 33140644-f61b-423c-8c1c-8aeaae608f78
Yuchao Yan (msyyc)
requested a review
from Praveen Kuttappan (praveenkuttappan)
as a code owner
September 28, 2026 08:12
Share API-map validation between preview compatibility and first-to-latest drift checks. Ignore nullable or conflicting apiVersion scalars, compare complete service mappings independently of key order, render both maps, and preserve explicit incomplete outcomes for malformed evidence. Replay the compute null-apiVersion regression from PR48997. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 33140644-f61b-423c-8c1c-8aeaae608f78
Fetch pinned project metadata before discovering version and client paths, preserving request and file limits. Share exact evidence URLs across multi-package reviews while retaining single-package output and publisher budgets. Add collector and pinned-runtime regression coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 33140644-f61b-423c-8c1c-8aeaae608f78
Comment on lines
+464
to
+465
| GH_REPOSITORY: ${{ github.repository }} | ||
| GH_TOKEN: ${{ github.token }} |
Comment out workflow_dispatch in the canonical source and annotate the regenerated lock with re-enable instructions. Preserve PR concurrency using event inputs. Include deferred unauthorized-user skip guards with an always-running policy notice and regressions for default-disabled and enabled test configurations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 33140644-f61b-423c-8c1c-8aeaae608f78
| prepared = prepare_output(load_json(output), context) | ||
| from mgmt_sdk_review_service import EvidenceRegistry | ||
|
|
||
| registry = EvidenceRegistry(context, os.environ.get("GH_TOKEN", "")) |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Replaces #49223 with the same implementation commit on an Azure-owned source branch:
Azure:mgmt-review-reliability. No code changes are introduced by this PR migration.Summary
Implement the management SDK review reliability improvements in one draft PR, rather than adding another prompt-only repair.
item_number; reject mismatches and unsupported publication fields. Partial reviews explicitly require human review, even when no findings are proven.Historical failures addressed
Preserves the protections and safeguards from #49097, #49147, #49149 and #49208.
The corpus covers stale base-revision tooling, restrictive Markdown grammar, the literal
-false-success shape, matching transport targets, SDK evidence mixed into specification-only attribution, missing anchors (including the five-reference shape reported in #49209 / PR #49163), contradictory unavailable/anchored citations, stability-version evidence, and high-confidence attribution without verified specification lines.Legacy fragments are explicit test migrations, not an accepted production fallback and not proof that a historical model's semantic claims were correct. Production accepts only schema version 2. Initial-release negatives for incomplete discovery, moves/renames, inaccessible evidence, historical releases, malformed dates and breaking entries remain covered.
Trust boundaries and remaining limitations
The agent, host service and publisher use separate copies of the pre-agent snapshot from the producer's immutable artifact ID. Executable tooling stays pinned to
github.workflow_sha; no PR-controlled checkout or package execution is added. The service runs outside the sandbox and exposes only describe/read/register/preflight operations. The agent is not granted general Python, curl, arbitrary host execution or repository write permissions.SDK collection retains existing request/per-file limits and adds an 8-MiB source-catalog text cap. Specification registration is limited to 20 files and up to 1 MiB of text per package, stopping conservatively when the remaining budget cannot cover another bounded file request. Missing/truncated/access-error evidence remains explicit.
The service mechanically caps validation calls within its process and closes after acceptance. Calling it before the built-in safe-output tool remains an agent instruction; the preflight digest is an edit detector, not a cryptographic attestation. A bypass/restart cannot bypass independent publisher validation. Line existence and structural/semantic-contract validation do not prove a citation supports a natural-language claim. Semantic README review and breaking-change causality remain model responsibilities.
Unsupported packaging layouts or a changed authoritative rule fingerprint produce unverified checks, not invented defaults. GitHub publication and older-comment hiding remain nontransactional; a later API failure is still possible. Preflight logs distinguish attempts/corrections and review completeness; publisher validation logs distinguish a validated artifact from pending built-in publication.
Test-only manual reviews (disabled by default)
Per the latest review decision,
workflow_dispatchis commented out before merge. The label trigger remains enabled. Both the canonical Markdown source and lockfile include re-enable guidance; the lockfile reminder is comment-only and is not preserved by the compiler. To test again, uncomment the source block on a trusted Azure-owned branch, compile with gh-aw v0.88.8, commit/push the source and lockfile, and dispatch that branch. Comment the source block again and recompile before merging. Merely selecting--refcannot enable a disabled trigger.This command requires an enabled revision to have been pushed first. Omitting
--refselects the default branch, where dispatch is unavailable while disabled. GitHub's manual-run UI also requires the dispatch entry point on the default branch. No live workflow was dispatched during this change.Keep workflow/job concurrency active: label events use their PR number, and temporarily enabled manual runs use
github.event.inputs.pr_number. Disabling only the group leaves an empty concurrency mapping, not a disabled trigger.When enabled, manual dispatch uses exactly the label-triggered collector, agent, preflight and real publisher, including older-review hiding after validation. Both original and rerun actors must be
msyyc, the execution repository remainsAzure/azure-sdk-for-python, and the target SDK PR source must be Azure-organization-owned. The fixed target is resolved through the GitHub API and bound to its immutable head. Closed target PRs remain supported; no general-purpose write capability or additional credentials are introduced.The previously deferred graceful-skip guards are now included: unauthorized manual actors skip the review jobs before setup. A permissionless notice logs the policy and a clear summary without failing; its explicit
always()handles the compiler-added dependency on skipped activation. The overall run can be successful because this notice job succeeds, while review jobs are skipped. Each job also guards partial reruns, and the existing collector/service/publisher authorization checks remain fail-closed backstops. Label eligibility is unchanged.Validation covered 146 tests in default-disabled mode, and 145 applicable tests in temporarily re-enabled mode, both with the pinned runtime and no skips (the disabled-state assertion is deliberately excluded only from the enabled-mode run). Both modes compiled strictly and passed targeted actionlint; the compiled notice Bash step was executed locally. Final lockfile executable content matches the disabled compiler output; only explanatory comments were added afterward. No authorization boundary was relaxed.
Initial-release client naming
Confirmed first releases now require synchronous and asynchronous public client names ending in the exact suffix
MgmtClient. Trusted code parses collected_client.pydeclarations as data only, and the independent publisher derives a Blocking finding even if the model submits no findings. The remediation asks the author to add or update the client-name customization inclient.tsp, then regenerate the SDK.This does not force renames in existing releases. Unknown first-release status, unreadable declarations and unsupported/ambiguous client layouts remain explicitly unverified. The original initial-release discovery safeguards and generated-source exclusions remain intact.
The authoritative rule text and its implementation are now pinned to the same trusted workflow commit. This lets manual branch runs test the new requirement before merge without taking rules from the SDK PR or silently mixing candidate tooling with older default-branch policy. The public model-authored schema is unchanged; the new check is snapshot-owned.
New regressions cover exact/case-sensitive suffix matching, sync/async blockers, existing-release exemptions, uncertain/missing/stale evidence, data-only parsing, immutable policy binding and publication-derived findings. The existing collection-budget boundary tests account for removing two unnecessary default-branch discovery calls; request limits are unchanged.
Unified API-version metadata
Both API-version drift and preview/beta compatibility now use the
_metadata.jsonapiVersionsservice-to-version map through one shared validator. The nullable or contradictory singularapiVersionis not used for judgments. A missing, empty or malformed map remains unverified, with no fallback to the singular field.Drift compares complete mappings (including changed service associations, additions and removals) while ignoring key order. The rendered finding preserves both service-to-version maps. Any map value containing
previewrequires a beta SDK, including mixed stable/preview maps; a service name containing that word alone is not a preview API.Regression provenance: #48997 (comment) . A read-only replay of the two cited revisions confirms
ComputeGallerychanged from2025-12-03to2026-03-03. The new implementation reports that real drift instead of becoming unverified becauseapiVersionis null. No live review was published during this replay.Follow-up review fixes
The collector now fetches pinned
pyproject.tomlbefore deriving version/client paths, including cold-cache packages handed off by the earlier per-package budget check. Both reads use the same bounded cache helper. The early project fetch counts toward the 16-file limit, and the final consistency-check request remains reserved. Missing/inaccessible/malformed project evidence is not converted into successful checks.Multi-package comments share exact evidence URLs through labeled references across completed checks, findings, unverified checks, API-version drift and breaking-change attribution. Different revisions and line ranges remain distinct; unavailable-line explanations remain at each use. The seven-package regression now contains 35 links instead of 77, and passes actual pinned-runtime ingestion and publication with mocked GitHub writes. The 48-link/60,000-byte gates remain enforced independently by the publisher, including genuinely oversized reviews.
Single-package output is unchanged: complete, partial and finding-bearing examples were byte-compared with the previous commit. Added regressions cover cache handoff, near-exhausted budgets, retained cached evidence, file caps, multi-package findings and partial checks, distinct ranges/revisions, shared specification evidence and special-character URL preservation through the pinned publisher. No authorization, review-policy or publication-permission changes are included in these fixes.
Validation
python -m unittest discover -s .github/workflows/tests -p "test_mgmt_sdk_review*.py"withGH_AW_RUNTIMEset to the v0.88.8 runtime.mgmt-sdk-pr-reviewcompiled with gh-aw v0.88.8, strict mode. The existingpull_request_targetwarning remains; no compiler upgrade or unrelated workflow regeneration.copilot-requeststwice and generatedconcurrency.queue). No new action/container pins changed except the compiler-required Python setup action; no additional secrets were introduced.git diff --checkpassed.Post-merge rollout gate — not performed in this PR
Label runs execute default-branch workflow tooling; manual runs execute the selected workflow revision. Local tests, PR CI and feature-branch manual runs do not establish deployment on the production default branch. After merge, use fresh triggers across initial releases, ordinary updates, breaking changes and incomplete evidence, including #49209's scenario.
Require ten consecutive representative canaries with a valid published review or explicit expected incomplete outcome, no unexplained contract rejection and no false clean-review status. Verify actual
toolingRevision,safe_outputsresult and the comment. Track first-pass acceptance, correction success and publication success separately.Related to #49209; do not consider the rollout verified until these canaries complete. Do not merge automatically.