From a24ff28031e2aa24770a7b9834084956a6b97f46 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Wed, 12 Mar 2025 13:28:01 -0700 Subject: [PATCH] refactor: Remove 'env' key from .cast file header --- scripts/redact-cast.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/redact-cast.py b/scripts/redact-cast.py index d5611383e..67ffaee9d 100755 --- a/scripts/redact-cast.py +++ b/scripts/redact-cast.py @@ -42,9 +42,16 @@ def process_file(input_path, output_path): open(output_path, "w", encoding="utf-8") as outfile, ): for line in infile: - # Always include the header (first line) + # Process the header (first line) if is_first_line: - outfile.write(line) + try: + header = json.loads(line) + if 'env' in header: + del header['env'] + outfile.write(json.dumps(header) + "\n") + except json.JSONDecodeError: + # If we can't parse the header, keep it as is + outfile.write(line) is_first_line = False continue