Skip to content

ci(bench): make embedded README benchmark table optional in the freshness gate#6739

Merged
proggeramlug merged 1 commit into
PerryTS:mainfrom
proggeramlug:fix/relax-public-baseline-readme-gate
Jul 21, 2026
Merged

ci(bench): make embedded README benchmark table optional in the freshness gate#6739
proggeramlug merged 1 commit into
PerryTS:mainfrom
proggeramlug:fix/relax-public-baseline-readme-gate

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Problem

The lint job's Public benchmark evidence freshness step fails on every PR:

public baseline error: README generated markers are missing

#6736 ("rewrite README as a concise, marketing-focused landing page") replaced
the auto-generated <!-- public-node-bun:start/end --> benchmark block with a
different, hand-curated performance section — but benchmarks/public_baseline.py check
still requires that block. Result: lint has been red on main and every open PR
since #6736 merged, unrelated to any PR's code.

Fix

Relax the gate so the embedded README table is optional, without touching the
README:

  • New benchmarks/ci_public_baseline_check.py reuses public_baseline's functions
    to enforce artifact freshness/integrity (age ≤ 45d, schema, source + harness
    fingerprints) and suite/results/RESULTS.md drift — but validates README
    drift only when the generated markers are present.
  • The lint step now runs the wrapper instead of public_baseline.py check.

Why a separate module (not a patch to public_baseline.py)

public_baseline.py is a fingerprinted harness file (HARNESS_PATHS). Editing it
changes harness_fingerprint, which makes validate_public fail with
"harness changed; regenerate it" — unsatisfiable without re-running the full
Node/Bun/Perry benchmark suite. Importing its functions from a new, non-fingerprinted
file keeps the fingerprint (and the freshness guarantee) intact.

Validation

Local run of the exact lint step:

PYTHONPATH=. python3 tests/test_public_baseline.py     # 7 tests OK
python3 benchmarks/ci_public_baseline_check.py         # exit 0: "freshness OK (README table optional)"
python3 benchmarks/public_baseline.py check ...        # still exit 2 (proves the block was the only failure)

README.md is unchanged. When a future change re-adds the markers, README drift is
enforced again.

Summary by CodeRabbit

  • Chores
    • Improved automated validation of public benchmark data for freshness and integrity.
    • Benchmark checks now consistently verify that published results remain synchronized.
    • Optional documentation tables no longer cause validation failures when absent, while detected inconsistencies are still reported.
    • Added clearer validation status and error reporting to help identify outdated or mismatched benchmark information.

…reshness gate

PerryTS#6736 rewrote README.md as a concise marketing landing page with a different,
hand-curated performance section and intentionally dropped the auto-generated
`<!-- public-node-bun:start/end -->` block. The lint job's "Public benchmark
evidence freshness" step still ran `public_baseline.py check`, which *requires*
that block, so it failed on every PR ("README generated markers are missing") —
a repo-wide lint breakage unrelated to any PR's code.

Relax the gate without touching the README: a new `benchmarks/
ci_public_baseline_check.py` reuses `public_baseline`'s functions to enforce
artifact freshness/integrity (age, schema, source + harness fingerprints) and
`suite/results/RESULTS.md` drift, but validates the README table only when its
generated markers are present. The lint step now calls it instead of
`public_baseline.py check`.

The policy lives in a separate module on purpose: `public_baseline.py` is a
fingerprinted harness file (`HARNESS_PATHS`), so relaxing the check *inside* it
would change `harness_fingerprint` and trip `validate_public`'s "harness changed;
regenerate" guard — unsatisfiable without re-running the full Node/Bun/Perry
suite. Importing its functions from a new file leaves the fingerprint intact.

README.md is unchanged.
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Added a CI wrapper that validates public benchmark artifact freshness and consistency, then updated the test workflow to execute it while treating the embedded README table as optional.

Changes

Public benchmark freshness gate

Layer / File(s) Summary
Baseline validation wrapper
benchmarks/ci_public_baseline_check.py
Adds freshness and integrity checks for the public benchmark artifact, RESULTS.md consistency validation, conditional README marker validation, and structured exit codes.
Workflow gate integration
.github/workflows/test.yml
Replaces the previous freshness command with the new CI wrapper and documents the optional README table behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: thehypnoo

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: making the README benchmark table optional in the freshness gate.
Description check ✅ Passed The description covers the problem, fix, rationale, and validation, with only non-critical template sections like screenshots/checklist omitted.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@benchmarks/ci_public_baseline_check.py`:
- Around line 47-49: Update the exception handling around the public baseline
validation to include ValueError alongside the existing ArtifactError, KeyError,
and OSError cases, so malformed generated_at timestamps produce the existing
“public baseline error” message and return status 2.
- Around line 42-46: Update the README validation condition around
pb.README_START, pb.README_END, and pb._replace_block to distinguish valid
marker pairs from malformed partial pairs: allow files containing neither
marker, but raise pb.ArtifactError when exactly one marker is present, while
preserving drift validation for complete pairs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ce0a2bab-b0b9-45e5-ad23-b0137afd694c

📥 Commits

Reviewing files that changed from the base of the PR and between 11865ab and 691b86d.

📒 Files selected for processing (2)
  • .github/workflows/test.yml
  • benchmarks/ci_public_baseline_check.py

Comment on lines +42 to +46
if pb.README_START in readme and pb.README_END in readme:
if pb._replace_block(readme, pb.readme_block(artifact)) != readme:
raise pb.ArtifactError(
"README Node/Bun table has drifted from the public artifact"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reject incomplete README marker pairs.

When only one generated marker is present, this condition skips README validation entirely. Treat an unmatched start/end marker as malformed, while continuing to allow README files with neither marker.

Proposed fix
         readme = pb.README.read_text(encoding="utf-8")
-        if pb.README_START in readme and pb.README_END in readme:
+        has_start = pb.README_START in readme
+        has_end = pb.README_END in readme
+        if has_start != has_end:
+            raise pb.ArtifactError("README generated markers are incomplete")
+        if has_start:
             if pb._replace_block(readme, pb.readme_block(artifact)) != readme:
📝 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
if pb.README_START in readme and pb.README_END in readme:
if pb._replace_block(readme, pb.readme_block(artifact)) != readme:
raise pb.ArtifactError(
"README Node/Bun table has drifted from the public artifact"
)
readme = pb.README.read_text(encoding="utf-8")
has_start = pb.README_START in readme
has_end = pb.README_END in readme
if has_start != has_end:
raise pb.ArtifactError("README generated markers are incomplete")
if has_start:
if pb._replace_block(readme, pb.readme_block(artifact)) != readme:
raise pb.ArtifactError(
"README Node/Bun table has drifted from the public artifact"
)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@benchmarks/ci_public_baseline_check.py` around lines 42 - 46, Update the
README validation condition around pb.README_START, pb.README_END, and
pb._replace_block to distinguish valid marker pairs from malformed partial
pairs: allow files containing neither marker, but raise pb.ArtifactError when
exactly one marker is present, while preserving drift validation for complete
pairs.

Comment on lines +47 to +49
except (pb.ArtifactError, KeyError, OSError) as exc:
print(f"public baseline error: {exc}", file=sys.stderr)
return 2

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Map malformed timestamps to the normal CI failure status.

public_baseline.validate_public parses generated_at with datetime.fromisoformat; malformed values raise ValueError, which is not caught here. The wrapper will therefore emit a traceback and exit with status 1 instead of the documented public baseline error status 2.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@benchmarks/ci_public_baseline_check.py` around lines 47 - 49, Update the
exception handling around the public baseline validation to include ValueError
alongside the existing ArtifactError, KeyError, and OSError cases, so malformed
generated_at timestamps produce the existing “public baseline error” message and
return status 2.

@proggeramlug
proggeramlug merged commit 4242d8b into PerryTS:main Jul 21, 2026
27 checks passed
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