Skip to content

Commit 7106a27

Browse files
Fix CSR loading infrastructure: Add missing \ metadata (#954)
Fix missing $source metadata in YAML resolution pipeline Resolves "No $source" errors for all 371 CSR files Fixes infrastructure failures in regress-smoke tests Ensures proper source file tracking for database objects Maintains architectural separation between Python resolution and Ruby consumption first mentioned on #936 & #933 Fixes #953 @ThinkOpenly @dhower-qc @AFOliveira @adingank-qualcomm --------- Signed-off-by: Sukuna0007Abhi <[email protected]> Signed-off-by: GitHub <[email protected]> Co-authored-by: Derek Hower <[email protected]>
1 parent 62c8631 commit 7106a27

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

tools/ruby-gems/udb/python/yaml_resolver.py

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def resolve(rel_path: str | Path, arch_root: str | Path, do_checks: bool) -> dic
256256
fn_name = Path(rel_path).stem
257257
if do_checks and (fn_name != unresolved_arch_data["name"]):
258258
print(
259-
f"ERROR: 'name' key ({unresolved_arch_data['name']}) must match filename ({fn_name} in {arch_root}/{rel_path}",
259+
f"ERROR: 'name' key ({unresolved_arch_data['name']}) must match filename ({fn_name}) in {arch_root}/{rel_path}",
260260
file=sys.stderr,
261261
)
262262
exit(1)
@@ -563,6 +563,7 @@ def write_resolved_file_and_validate(
563563
):
564564
resolved_path = os.path.join(resolved_dir, rel_path)
565565
resolved_obj = resolve(rel_path, args.arch_dir, do_checks)
566+
resolved_obj["$source"] = os.path.join(args.arch_dir, rel_path)
566567
write_yaml(resolved_path, resolved_obj)
567568

568569
if do_checks and ("$schema" in resolved_obj):
@@ -628,7 +629,12 @@ def write_resolved_file_and_validate(
628629
arch_paths.extend(merged_paths)
629630
arch_paths = list(set(arch_paths))
630631

631-
for arch_path in tqdm(arch_paths, ascii=True, desc="Merging arch"):
632+
for arch_path in tqdm(
633+
arch_paths,
634+
ascii=True,
635+
desc="Merging arch",
636+
file=sys.stderr,
637+
):
632638
merged_arch_path = (
633639
os.path.join(args.merged_dir, arch_path)
634640
if os.path.isabs(args.merged_dir)
@@ -637,7 +643,10 @@ def write_resolved_file_and_validate(
637643
os.makedirs(os.path.dirname(merged_arch_path), exist_ok=True)
638644
merge_file(arch_path, args.arch_dir, args.overlay_dir, args.merged_dir)
639645

640-
print(f"[INFO] Merged architecture files written to {args.merged_dir}")
646+
print(
647+
f"[INFO] Merged architecture files written to {args.merged_dir}",
648+
file=sys.stderr,
649+
)
641650

642651
elif args.command == "resolve":
643652
arch_paths = glob.glob(f"*/**/*.yaml", recursive=True, root_dir=args.arch_dir)
@@ -650,7 +659,12 @@ def write_resolved_file_and_validate(
650659
iter = (
651660
arch_paths
652661
if args.no_progress
653-
else tqdm(arch_paths, ascii=True, desc="Resolving arch")
662+
else tqdm(
663+
arch_paths,
664+
ascii=True,
665+
desc="Resolving arch",
666+
file=sys.stderr,
667+
)
654668
)
655669
abs_resolved_dir = (
656670
f"{args.udb_root}/{args.resolved_dir}"
@@ -666,7 +680,12 @@ def write_resolved_file_and_validate(
666680
iter = (
667681
arch_paths
668682
if args.no_progress
669-
else tqdm(arch_paths, ascii=True, desc="Validating arch")
683+
else tqdm(
684+
arch_paths,
685+
ascii=True,
686+
desc="Validating arch",
687+
file=sys.stderr,
688+
)
670689
)
671690
for arch_path in iter:
672691
write_resolved_file_and_validate(
@@ -677,4 +696,7 @@ def write_resolved_file_and_validate(
677696
write_yaml(f"{abs_resolved_dir}/index.yaml", arch_paths)
678697
write_json(f"{abs_resolved_dir}/index.json", arch_paths)
679698

680-
print(f"[INFO] Resolved architecture files written to {args.resolved_dir}")
699+
print(
700+
f"[INFO] Resolved architecture files written to {args.resolved_dir}",
701+
file=sys.stderr,
702+
)

0 commit comments

Comments
 (0)