Skip to content

[migrate] Restore standard Draft-07 SDK validation - #10603

Draft
mahakjain314 wants to merge 1 commit into
Azure:mainfrom
mahakjain314:mahja/draft07-sdk-validation
Draft

mahakjain314 wants to merge 1 commit into
Azure:mainfrom
mahakjain314:mahja/draft07-sdk-validation

Conversation

@mahakjain314

@mahakjain314 mahakjain314 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ️✔️ All clear

Breaking Changes Suppressions
️✔️ None ️✔️ None

This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

az migrate runbook parameter configure

az migrate runbook execution parameter configure

Summary

Restore the standard JSON Schema SDK approach from commit 28846b7f53b187d8f6ec4c7419923ddb3686cd03 in #10487 as a separate draft comparison PR, based on latest main (d87a4bb1d1fff6fd3a4e38d8593fd6c601d1db5c at implementation time).

The current editor implements only a custom subset of conditional rules. This draft replaces that matcher with the original pinned @cfworker/json-schema 4.1.1 SDK, bundled into each generated HTML file with its MIT license and Draft-07 meta-schema. No CDN, runtime npm requirement, network access, or dynamic code generation is needed.

The SDK handles Draft-07 conditions and assertions, including if/then/else, nested allOf/anyOf/oneOf/not, dependencies, array assertions, boolean schemas, and local references. Schemas are meta-validated; malformed schemas, other dialects, unresolved references, and the pinned SDK's unsupported $ref with sibling $id combination fail visibly.

Intentional behavior differences from main

This restores the referenced SDK implementation's strict semantics, not the later custom-rule behavior:

  • All defined inputs remain visible. Conditional schemas validate values but no longer hide controls or dynamically change the original descriptor-based required markers.
  • properties: { "field": false } rejects a present property, including a null value; it does not mean hide the control or replace its value with null.
  • Draft-07 required checks property presence. Schemas must also use constraints such as type, minLength, or minItems if null/empty values should fail.
  • Exports preserve the actual editor values and schema; there is no conditional nulling, deletion, or redistribution into workload overrides.
  • Effective workload inputs are validated independently. Shared controls use the shared values, so workload overrides do not change another workload's validation or shared field errors.

Legacy descriptor validation and partial-update command preparation remain when no Draft-07 validation failures exist. Schema failures block upload-command preparation, while invalid work can still be saved as a draft.

The newer local-execution support on main is preserved. No release version, changelog, or extension-index change is included in this draft; the package version remains 3.0.0b7.

Implementation and regressions

  • Restore the historical pinned SDK bundle, license, meta-schema, lockfile, and reproducible esbuild script.
  • Embed the SDK through the existing nonce-protected renderer and include the assets in wheel package data.
  • Remove the competing custom condition evaluator, condition-driven layout updates, and conditional export transformer.
  • Retain issue caching and existing form/error/save infrastructure.
  • Show leaf validation failures rather than duplicate SDK aggregate summaries, and attribute missing required inputs to their own controls.
  • Restore and extend runtime tests against the actual rendered script, with string/WASM code generation disabled.

Validation

Working directory Exact command Result
src\migrate ..\..\env\Scripts\python.exe -m pytest .\azext_migrate\tests\latest\runbook\test_runbook_unit.py -q Passed: 327 tests and 126 subtests, including 17 JavaScript runtime cases.
src\migrate ..\..\env\Scripts\python.exe .\scripts\runbook_coverage.py Passed: 330 tests and 126 subtests; 97% coverage, above the 95% gate.
Repository root, activated environment python -m azdev style migrate Passed: pylint and flake8.
Repository root, activated environment python -m azdev linter migrate Passed: CLI and custom pylint rules.
src\migrate\scripts\schema-validator npm ci followed by npm run build Passed; rebuilt SDK bundle is byte-identical to the historical commit (git blob SHA 95fe082fd4b21444a441b1cbeb6a53e0073e6f54).
Repository root git --no-pager diff --check Passed.

Coverage:

TOTAL                                                  1991     57    97%

The modified Python renderer is 98% covered (47 statements, 1 missed); no coverage drop in modified code.

Additional verification:

  • Isolated setup.py build ... bdist_wheel ... completed successfully without changing the release version. The built wheel's renderer, HTML template, SDK JavaScript, and license were verified byte-for-byte against source.
  • Headless Edge verification passed with real field edits and a real Save/download: conditional error recovery, independent workloads, shared control stability, exact invalid-draft export, and preservation of the original schema.
  • No browser page errors, CSP violations, or outbound HTTP(S) requests. No unsafe-eval or external script resource was added.
  • python scripts/ci/test_index.py -q was not run; this draft does not change src/index.json or release metadata.

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install azdev required)
  • My extension version conforms to the Extension version schema

For new extensions:

Not applicable: this modifies the existing migrate extension.

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

Engineering review

  1. Selected design: restore the pinned standard SDK at the existing browser validation boundary; a standard validator owns JSON Schema semantics.
  2. Alternatives: keeping or expanding the hand-written evaluator would maintain a competing schema dialect; a CDN would break offline use; dynamic-code-generating bundles would weaken the existing CSP.
  3. Reuse: historical SDK assets/build tooling and existing renderer, field descriptors, effective workload values, issue cache, issue navigation, upload gate, and draft-save machinery.
  4. Consolidation: remove the custom matching, condition-driven re-rendering, and export rewriting; Draft-07 assertions flow through one SDK-backed helper.
  5. Duplicate logic removed: no second evaluator remains; duplicate SDK aggregate diagnostics are suppressed without changing validation outcomes.
  6. Abstractions: restore only the SDK preparation/issue adapter and build script needed to keep the runtime offline and packageable.
  7. Net lines: 1,013 added and 373 removed (net +640) across 12 files. Restored SDK/build/license/meta-schema/lockfile assets contribute 758 added lines; the editor template shrinks by 34 lines.
  8. Technical debt/limitations: intentional draft behavior differences are enumerated above. Unsupported dialects, unresolved references, and the pinned SDK's $ref/sibling-$id limitation fail visibly rather than silently falling back. No unverified implementation behavior is claimed.
  9. Maintainability: 9/10; the SDK replaces custom validation semantics, with exact dependency pins, a reproducible bundle, and focused regression tests for the adapter.
  10. Simplest correct solution: reuse the requested historical SDK approach, remove superseded custom behavior, and avoid parallel validation or speculative UI projection of arbitrary schemas.

Restore the pinned JSON Schema SDK approach from 28846b7 on latest main. Replace custom conditional matching and export transformations with strict Draft-07 validation, preserve independent workload contexts and draft saving, and restore reproducible offline bundling and focused tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d53ebcbc-f948-464f-8d13-d12fbed0619f
@microsoft-github-policy-service microsoft-github-policy-service Bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Nov 19, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Thank you for your contribution mahakjain314! We will review the pull request and get back to you soon.

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

@x-engineering-agent

Copy link
Copy Markdown

Hi mahakjain314,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in pyproject.toml (or setup.py, if the extension has not migrated yet) as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants