Repository navigation
Tin/update write artifact - #1114
Open
Tintinator wants to merge 5 commits into
Open
Tintinator wants to merge 5 commits into
Tintinator wants to merge 5 commits into
Conversation
ahal
requested changes
Nov 17, 2026
|
|
||
| with gzip.open(path, "wb") as f: | ||
| f.write(json.dumps(data)) # type: ignore | ||
| if filename.endsWith(".json.gz"): |
ahal
self-requested a review
November 19, 2026 21:39
ahal
requested changes
Nov 23, 2026
ahal
left a comment
Contributor
There was a problem hiding this comment.
Sorry for the delayed review!
This patch is technically correct, but there are a couple more changes I'd like before accepting it.
| f.write(json.dumps(data).encode("utf-8")) # type: ignore | ||
| else: | ||
| f.write(json.dumps(data)) # type: ignore | ||
| elif filename.endswith(".mm"): |
Contributor
There was a problem hiding this comment.
The .mm is a mermaid diagram and specific to gecko_taskgraph. Instead of checking specifically for this extension, let's just write the data as long as it's a string. So change this to elif isinstance(data, str):
| if filename.endswith(".json.gz"): | ||
| f.write(json.dumps(data).encode("utf-8")) # type: ignore | ||
| else: | ||
| f.write(json.dumps(data)) # type: ignore |
Contributor
There was a problem hiding this comment.
This has actually been broken this whole time. It's trying to write a str to a file opened in binary mode. I suspect it was regressed way back when we were migrating from Python 2 -> 3.
So you can simplify this and fix the bug by doing something like:
elif filename.endswith(".gz"):
import gzip # noqa: PLC0415
with gzip.open(path, "wt", encoding="utf-8") as f:
json.dump(data, f)
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.
updated write_artifacts to handle .json.gz and .mm files
this is done as a part of the effort to merge actions logic between gecko_taskgraph and taskgraph.