-
Notifications
You must be signed in to change notification settings - Fork 0
fix: preserve benchmark data across mkdocs deployments #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Update mkdocs.yml to save and restore benchmark files (data.js, index.html, benchmark.jpg) before deploying to gh-pages - Update CI.yml benchmark job to push benchmark image to gh-pages instead of main (avoids branch protection issues) - Update README to reference benchmark image from gh-pages URL This ensures benchmark data accumulates over time instead of being wiped on each mkdocs deployment. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Pull Request ReviewSummaryThis PR addresses a critical issue where MkDocs deployment was wiping accumulated benchmark data from the gh-pages branch, and fixes the benchmark image deployment which was blocked by branch protection rules. The solution is well-thought-out and addresses the root causes effectively. ✅ Strengths
🔍 Issues & ConcernsCritical Issue: Git Reference Bug in mkdocs.yml:80The commit message references HEAD after checking out gh-pages, which means it captures the previous gh-pages commit hash rather than the source commit from main/master being deployed. Current code (line 79-80): Problem: After Fix: Capture the source commit BEFORE switching branches: Minor: Incomplete Error Handlingmkdocs.yml:59 - If Suggestion: Add validation: Minor: Race Condition RiskIf both workflows run on a tag push to main, there is a small risk that mkdocs could restore an old benchmark.jpg after the benchmark workflow generates a new one. Likelihood: Low, since triggers are different (main push vs tag), but worth documenting. Mitigation: Add a comment explaining the ordering dependency, or use workflow Code Quality: Redundant Checkout Depthmkdocs.yml:14-15 - 🔒 Security Considerations✅ Good: Uses GitHub bot credentials consistently
📊 Testing & CoverageThe test plan in the PR description is appropriate and covers the key scenarios. Suggestion: Explicitly test the first-deployment case (when gh-pages does not exist yet). The ⚡ Performancemkdocs.yml: Using CI.yml: Using 📝 DocumentationREADME.md: The image URL change is correct. Consider adding alt text for accessibility: 🎯 Recommendations
✨ VerdictApprove with requested changes. The approach is sound and solves real problems effectively. The git reference issue should be fixed, but it does not break functionality - just makes the commit message misleading. The other suggestions are nice-to-haves that improve robustness. Great work identifying and fixing the MkDocs force-push issue! 🚀 |
- Fix git reference bug: capture source commit BEFORE switching to gh-pages branch (was showing gh-pages commit in message) - Add validation for site/ directory before copying to prevent deploying empty content if mkdocs build fails Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Pull Request Review - Follow-up AnalysisI've reviewed PR #50 and notice there was already a comprehensive review provided. Looking at the current state of the code, I can see that the critical git reference bug has been fixed - the code now correctly captures Let me provide additional observations on the current implementation: ✅ Resolved Issues
🎯 Additional Observations1. Workflow Execution OrderThe current setup has two workflows that could interact:
Potential race condition: If a tag is pushed that points to a commit on main, both workflows trigger simultaneously. The benchmark job could write Recommendation: Consider adding a workflow dependency or documenting the expected execution order. Since tags are typically pushed separately from branch commits, the race window is small but non-zero. 2. fetch-depth: 0 in mkdocs.ymlLine 15 sets
Impact: Minor performance overhead fetching unnecessary history. Recommendation: Remove 3. Benchmark Data Persistence StrategyThe current approach uses If someone manually deletes these files from gh-pages, they won't be restored even if they exist in the working tree after Current behavior: Only restores from gh-pages history, never from newly built docs. Is this correct? Probably yes - the benchmark data is generated by CI, not mkdocs. But worth confirming this is intentional. 4. Error Message ClarityLine 63-64 error message says "site/ directory is empty or missing" but exits with status 1, which might not clearly indicate why the workflow failed in GitHub Actions logs. Minor suggestion: Add more context to help debug failures faster. 🔒 Security Review✅ All git operations use proper bot credentials One consideration: The Safer order would be to validate site/ exists before removing files from gh-pages. This ensures you never have an empty gh-pages branch due to a validation failure. 📊 Testing RecommendationsBeyond the test plan in the PR description, consider testing:
⚡ Performance NotesGood choices:
Benchmark image format: The 📝 Documentation Suggestions
🎯 Final VerdictLGTM with minor suggestions ✅ The critical issues from the previous review have been addressed. The remaining suggestions are optimizations and edge case handling that would improve robustness but aren't blockers. Required: None Recommended:
Nice-to-have:
Great work fixing the MkDocs data preservation issue! This is a solid solution to a complex problem. 🚀 |
Summary
Problem
--forcewhich wipes the entire gh-pages branch, deleting accumulated benchmark dataSolution
dev/bench/data.js,dev/bench/index.html, andbenchmark.jpgfrom gh-pages before deploying, then restores them after copying new docsTest plan
🤖 Generated with Claude Code