Skip to content

Conversation

@moreal
Copy link
Contributor

@moreal moreal commented Jan 17, 2026

This is a minor issue, but when looking at the data on https://rustpython.github.io/benchmarks, it is difficult to tell which commit the results were generated from. To address this, I updated the process to include metadata and push it to the RustPython/rustpython.github.io repository. I will also open a PR to the RustPython/rustpython.github.io repository.

See also RustPython/rustpython.github.io#83.

Summary by CodeRabbit

  • Chores
    • Benchmark publishing workflow now generates and commits metadata JSON containing timestamp and commit information alongside benchmark results.

✏️ Tip: You can customize this high-level summary in your review settings.

Generate a metadata file alongside criterion benchmark data containing
the commit hash, ref name, and timestamp for tracking purposes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 17, 2026

📝 Walkthrough

Walkthrough

The workflow's benchmark publishing step now generates and commits a JSON metadata file alongside criterion benchmark results, containing generation timestamp, commit hash, and reference information.

Changes

Cohort / File(s) Change Summary
GitHub Actions Workflow
\.github/workflows/cron-ci.yaml
Benchmark results publishing step now generates JSON metadata file (criterion-metadata.json) with timestamp, commit hash, and ref information; commits both metadata and criterion assets together

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 Metadata whispers join benchmark songs,
JSON perfection to right any wrongs,
Timestamps dancing with commits so true,
References shining in workflows anew,
Benchmarks now flourish, refined and new! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding metadata to the benchmark upload process. It is concise, specific, and clearly conveys the primary purpose of the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@moreal moreal marked this pull request as ready for review January 17, 2026 17:08
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.github/workflows/cron-ci.yaml:
- Around line 183-187: The current printf call writing
./_data/criterion-metadata.json can produce invalid JSON if values like "${{
github.ref_name }}" contain quotes or special characters; replace the
printf-based template with a JSON encoder invocation (e.g., call out to Python
or jq) to construct and write the JSON so values are properly escaped and
serialized; update the step that writes criterion-metadata.json (replacing the
printf usage) to build a dict/object with keys generated_at, rustpython_commit,
rustpython_ref and output it via the JSON encoder, then keep the subsequent git
add ./assets/criterion ./_data/criterion-metadata.json as-is.

Comment on lines +183 to +187
printf '{\n "generated_at": "%s",\n "rustpython_commit": "%s",\n "rustpython_ref": "%s"\n}\n' \
"$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
"${{ github.sha }}" \
"${{ github.ref_name }}" > ./_data/criterion-metadata.json
git add ./assets/criterion ./_data/criterion-metadata.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Guard against invalid JSON by escaping metadata values.

printf writes raw strings; github.ref_name can legally contain quotes, which would corrupt the JSON file. Prefer a JSON encoder (Python or jq) to guarantee correct escaping.

✅ Suggested fix (Python JSON encoder)
-          printf '{\n  "generated_at": "%s",\n  "rustpython_commit": "%s",\n  "rustpython_ref": "%s"\n}\n' \
-            "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-            "${{ github.sha }}" \
-            "${{ github.ref_name }}" > ./_data/criterion-metadata.json
+          python - <<'PY' > ./_data/criterion-metadata.json
+          import json, os, datetime
+          data = {
+              "generated_at": datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"),
+              "rustpython_commit": os.environ["GITHUB_SHA"],
+              "rustpython_ref": os.environ["GITHUB_REF_NAME"],
+          }
+          print(json.dumps(data, indent=2))
+          PY
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
printf '{\n "generated_at": "%s",\n "rustpython_commit": "%s",\n "rustpython_ref": "%s"\n}\n' \
"$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
"${{ github.sha }}" \
"${{ github.ref_name }}" > ./_data/criterion-metadata.json
git add ./assets/criterion ./_data/criterion-metadata.json
python - <<'PY' > ./_data/criterion-metadata.json
import json, os, datetime
data = {
"generated_at": datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"),
"rustpython_commit": os.environ["GITHUB_SHA"],
"rustpython_ref": os.environ["GITHUB_REF_NAME"],
}
print(json.dumps(data, indent=2))
PY
git add ./assets/criterion ./_data/criterion-metadata.json
🤖 Prompt for AI Agents
In @.github/workflows/cron-ci.yaml around lines 183 - 187, The current printf
call writing ./_data/criterion-metadata.json can produce invalid JSON if values
like "${{ github.ref_name }}" contain quotes or special characters; replace the
printf-based template with a JSON encoder invocation (e.g., call out to Python
or jq) to construct and write the JSON so values are properly escaped and
serialized; update the step that writes criterion-metadata.json (replacing the
printf usage) to build a dict/object with keys generated_at, rustpython_commit,
rustpython_ref and output it via the JSON encoder, then keep the subsequent git
add ./assets/criterion ./_data/criterion-metadata.json as-is.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant