Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b22dfe1
kill timeout process
fangyangci Apr 14, 2026
eca23ab
Merge branch 'main' into fangyangci/scale
fangyangci Apr 15, 2026
ad4a87c
use env default rule path
fangyangci Apr 15, 2026
64ec29d
Merge branch 'fangyangci/scale' of https://github.com/microsoft/Model…
fangyangci Apr 15, 2026
61ebe70
align check_patterns with check_ops
fangyangci Apr 16, 2026
919c90b
Merge branch 'main' of https://github.com/microsoft/WinML-ModelKit in…
fangyangci Apr 16, 2026
92b1897
sync check patterns with check ops
fangyangci Apr 17, 2026
6cefe93
delete unused case_runner.py
fangyangci Apr 17, 2026
5bb7bb3
ignore empty fileds
fangyangci Apr 18, 2026
0d9c013
Potential fix for pull request finding 'CodeQL / Empty except'
fangyangci Apr 20, 2026
2277cc2
add test_runner.py
fangyangci Apr 20, 2026
dab6b1b
Merge branch 'fangyangci/scale' of https://github.com/microsoft/WinML…
fangyangci Apr 20, 2026
3b9b8d1
fix conflict
fangyangci Apr 20, 2026
48d29ef
Merge branch 'main' of https://github.com/microsoft/WinML-ModelKit in…
fangyangci Apr 20, 2026
a8f9994
move rules to rules_zip
fangyangci Apr 21, 2026
01ae0a5
Merge branch 'main' of https://github.com/microsoft/WinML-ModelKit in…
fangyangci Apr 21, 2026
b8bd69f
Potential fix for pull request finding 'CodeQL / Empty except'
fangyangci Apr 21, 2026
a20d681
Potential fix for pull request finding 'CodeQL / Empty except'
fangyangci Apr 21, 2026
9c5a833
Potential fix for pull request finding 'CodeQL / Empty except'
fangyangci Apr 21, 2026
55c740a
Potential fix for pull request finding 'CodeQL / Empty except'
fangyangci Apr 21, 2026
092d47c
fix for lint
fangyangci Apr 22, 2026
36ef596
Merge branch 'main' into fangyangci/scale
fangyangci Apr 22, 2026
d459e11
support relative path
fangyangci Apr 22, 2026
c6cb510
Merge branch 'fangyangci/scale' of https://github.com/microsoft/WinML…
fangyangci Apr 22, 2026
56e0e6c
add materialize_rules_zip.py
fangyangci Apr 23, 2026
ec22ac6
relative path
fangyangci Apr 23, 2026
6927b05
expand rules first time
fangyangci Apr 23, 2026
1dfa6ce
disable init
fangyangci Apr 23, 2026
0fddee7
fix lint disable test_resolve_auto_expands_when_marker_missing
fangyangci Apr 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pipelines/modelkit-official-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ extends:
displayName: 'Check Python version'

- powershell: |
$rulesDir = "$(Build.SourcesDirectory)\ModelKitArtifacts\op_check_results\rules"
$rulesDir = "$(Build.SourcesDirectory)\ModelKitArtifacts\rules_zip"
$destDir = "$(Build.SourcesDirectory)\src\winml\modelkit\analyze\rules\runtime_check_rules"
$outDir = "$(ob_outputDirectory)"
New-Item -ItemType Directory -Path $outDir -Force | Out-Null
Expand Down
94 changes: 94 additions & 0 deletions scripts/materialize_rules_zip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
"""Materialize runtime rule zip snapshots into full JSON payloads.

This script resolves ``delta_v1`` snapshot chains and rewrites each JSON payload
as a full dictionary without snapshot metadata keys.

Usage:
uv run python scripts/materialize_rules_zip.py --rules-dir <dir>
uv run python scripts/materialize_rules_zip.py --rules-dir <dir> --output-dir <out>
"""

from __future__ import annotations

import argparse
from pathlib import Path
import sys


def _load_materializer():
"""Load materializer utility from package, with src fallback in repo mode."""
try:
from winml.modelkit.analyze.utils.rule_expander import expand_rules_zip_dir

return expand_rules_zip_dir
except ModuleNotFoundError:
repo_root = Path(__file__).resolve().parent.parent
src_path = repo_root / "src"
if str(src_path) not in sys.path:
sys.path.insert(0, str(src_path))

from winml.modelkit.analyze.utils.rule_expander import expand_rules_zip_dir

return expand_rules_zip_dir


def main() -> None:
parser = argparse.ArgumentParser(
description=(
"Materialize delta snapshots in runtime rule zips into full JSON payloads "
"(remove baseline dependencies)."
)
)
parser.add_argument(
"--rules-dir",
type=Path,
required=True,
help="Directory containing runtime rule zip files.",
)
parser.add_argument(
"--output-dir",
type=Path,
default=None,
help=(
"Output directory for materialized zips. "
"When omitted, zips are overwritten in-place."
),
)
parser.add_argument(
"--glob",
type=str,
default="*.zip",
help="Filename glob used to select zip files (default: *.zip).",
)
args = parser.parse_args()
expand_rules_zip_dir = _load_materializer()
summary = expand_rules_zip_dir(
args.rules_dir,
output_dir=args.output_dir,
glob_pattern=args.glob,
)

if not summary.per_zip:
print(f"No zip files matched '{args.glob}' in {args.rules_dir.resolve()}")
return

for zip_name, json_count, materialized_count in summary.per_zip:
print(
f"[{zip_name}] json_entries={json_count}, "
f"materialized_delta_entries={materialized_count}"
)

print("\nDone.")
print(f" zip_files_processed: {summary.zip_files_processed}")
print(f" zip_files_with_delta: {summary.zip_files_with_delta}")
print(f" json_entries_processed: {summary.json_entries_processed}")
print(f" delta_entries_materialized: {summary.delta_entries_materialized}")
print(f" output_mode: {summary.output_mode}")


if __name__ == "__main__":
main()
Loading
Loading