-
Notifications
You must be signed in to change notification settings - Fork 0
feat: enforce publication and interpretation policy checks #32
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1600524
feat(issue-23): add fairness disclaimer template and validator
aryeko fa996ec
feat(issue-24): add methodology changelog policy and check
aryeko adf4d45
feat(issue-25): enforce README and report publication sync checks
aryeko ec8a091
fix(pr-32): address review findings for policy checks
aryeko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| #!/usr/bin/env python3 | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
|
|
||
| ROOT = Path(__file__).resolve().parent.parent | ||
| REPORT = ROOT / "results" / "latest" / "report.md" | ||
| REPORT_GENERATOR = ROOT / "scripts" / "generate-report.py" | ||
| METHODOLOGY = ROOT / "METHODOLOGY.md" | ||
| README = ROOT / "README.md" | ||
|
|
||
|
|
||
| def report_content() -> str: | ||
| if REPORT.exists(): | ||
| return REPORT.read_text(encoding="utf-8") | ||
| return "" | ||
|
|
||
|
|
||
| def generator_template_content() -> str: | ||
| if not REPORT_GENERATOR.exists(): | ||
| raise SystemExit(f"report-disclaimer-check failed: missing generator at {REPORT_GENERATOR}") | ||
| return REPORT_GENERATOR.read_text(encoding="utf-8") | ||
|
|
||
|
|
||
| def disclaimer_check() -> None: | ||
| content = report_content() | ||
| template = generator_template_content() | ||
| required = [ | ||
| "## Fairness Disclaimer", | ||
| "Language-vs-framework caveat", | ||
| "## Anti-Misinterpretation Guidance", | ||
| "cross-language", | ||
| ] | ||
| for token in required: | ||
| if token not in template: | ||
| raise SystemExit(f"report-disclaimer-check failed: missing '{token}' in scripts/generate-report.py") | ||
| if REPORT.exists() and token not in content: | ||
| raise SystemExit(f"report-disclaimer-check failed: missing '{token}' in results/latest/report.md") | ||
| source = "report + generator" if REPORT.exists() else "generator template" | ||
| print(f"report-disclaimer-check: validated disclaimer sections via {source}") | ||
|
|
||
|
|
||
| def changelog_check() -> None: | ||
| if not METHODOLOGY.exists(): | ||
| raise SystemExit(f"methodology-changelog-check failed: missing {METHODOLOGY}") | ||
|
|
||
| content = METHODOLOGY.read_text(encoding="utf-8") | ||
| required = [ | ||
| "## Methodology changelog policy", | ||
| "### Update rules", | ||
| "### Entry format", | ||
| "### Changelog", | ||
| "comparability-impacting", | ||
| "| version | date (UTC) | change_type | summary | comparability_impact | required_action |", | ||
| ] | ||
| for token in required: | ||
| if token not in content: | ||
| raise SystemExit(f"methodology-changelog-check failed: missing '{token}' in METHODOLOGY.md") | ||
|
|
||
| changelog_rows = [ | ||
| line | ||
| for line in content.splitlines() | ||
| if line.startswith("|") and "comparability-impacting" in line | ||
| ] | ||
| if not changelog_rows: | ||
| raise SystemExit( | ||
| "methodology-changelog-check failed: changelog requires at least one comparability-impacting entry" | ||
| ) | ||
| print("methodology-changelog-check: validated changelog policy and comparability entries") | ||
|
|
||
|
|
||
| def publication_sync_check() -> None: | ||
| if not README.exists(): | ||
| raise SystemExit(f"publication-sync-check failed: missing {README}") | ||
|
|
||
| readme = README.read_text(encoding="utf-8") | ||
| report = report_content() | ||
| template = generator_template_content() | ||
| readme_folded = readme.casefold() | ||
| template_folded = template.casefold() | ||
| report_folded = report.casefold() | ||
|
|
||
| readme_required = [ | ||
| "## Publication policy", | ||
| "latest-results source of truth: `results/latest/summary.json` and `results/latest/report.md`", | ||
| "README must not publish standalone benchmark numbers", | ||
| ] | ||
| for token in readme_required: | ||
| if token not in readme: | ||
| raise SystemExit(f"publication-sync-check failed: missing '{token}' in README.md") | ||
|
|
||
| shared_caveats = [ | ||
| "Language-vs-framework caveat", | ||
| "cross-language", | ||
| "Parity failures invalidate performance interpretation", | ||
| ] | ||
| for token in shared_caveats: | ||
| token_folded = token.casefold() | ||
| if token_folded not in readme_folded: | ||
| raise SystemExit(f"publication-sync-check failed: missing caveat '{token}' in README.md") | ||
| if token_folded not in template_folded: | ||
| raise SystemExit(f"publication-sync-check failed: missing caveat '{token}' in scripts/generate-report.py") | ||
| if REPORT.exists() and token_folded not in report_folded: | ||
| raise SystemExit(f"publication-sync-check failed: missing caveat '{token}' in results/latest/report.md") | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| report_source = "report + generator" if REPORT.exists() else "generator template" | ||
| print(f"publication-sync-check: validated README/report caveat sync via {report_source}") | ||
|
|
||
|
|
||
| def main() -> None: | ||
| command = sys.argv[1] if len(sys.argv) > 1 else "report-disclaimer-check" | ||
| if command == "report-disclaimer-check": | ||
| disclaimer_check() | ||
| return | ||
| if command == "methodology-changelog-check": | ||
| changelog_check() | ||
| return | ||
| if command == "publication-sync-check": | ||
| publication_sync_check() | ||
| return | ||
| raise SystemExit( | ||
| "usage: publication-policy-check.py [report-disclaimer-check|methodology-changelog-check|publication-sync-check]" | ||
| ) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.