Skip to content

fix: preserve hand-written notes in benchmark regeneration#128

Merged
carlos-alm merged 1 commit intomainfrom
fix/benchmark-notes-preservation
Feb 26, 2026
Merged

fix: preserve hand-written notes in benchmark regeneration#128
carlos-alm merged 1 commit intomainfrom
fix/benchmark-notes-preservation

Conversation

@carlos-alm
Copy link
Copy Markdown
Contributor

Summary

  • Adds NOTES_START/NOTES_END sentinel preservation to scripts/update-benchmark-report.js so CI-triggered regenerations no longer clobber hand-written analysis sections
  • Seeds the benchmark report with WASM regression analysis notes (v2.0.0 → v2.1.0 ↑32%, persisting through v2.3.0)

Test plan

  • Run node scripts/update-benchmark-report.js and verify the notes section survives regeneration
  • Verify the <!-- NOTES_START --> / <!-- NOTES_END --> block is preserved across multiple runs

Add NOTES_START/NOTES_END sentinel preservation to the benchmark
updater so CI-triggered regenerations no longer clobber hand-written
analysis sections. Also adds WASM regression notes to the benchmark
report.
@claude
Copy link
Copy Markdown

claude Bot commented Feb 26, 2026

Claude finished @carlos-alm's task —— View job


PR Review Complete

Reviewing PR #128: fix: preserve hand-written notes in benchmark regeneration

Todo List:

  • Read and analyze changed files
  • Perform root cause analysis
  • Check for configuration changes and test integrity
  • Evaluate code quality and approach
  • Provide final assessment with rating

Root Cause Analysis

Problem Being Solved: CI-triggered benchmark regeneration was clobbering hand-written analysis notes in the benchmark report, causing valuable investigative content (like WASM regression analysis) to be lost on each update.

Why This Approach: The sentinel-based preservation approach (/) is a standard, proven pattern for preserving hand-written content in generated files. This is solving a legitimate problem where automation was destroying manually curated content.

Risk Assessment: LOW RISK - This is a preservation feature that prevents data loss, not a configuration relaxation or symptom masking.

Code Quality Assessment

Strengths

  • Clean implementation: Lines 203-214 in update-benchmark-report.js implement the preservation logic cleanly with regex matching and conditional insertion
  • Non-breaking: The change gracefully handles files without existing notes sections
  • Valuable content preserved: The seeded notes contain detailed WASM regression analysis (v2.0.0 → v2.1.0 ↑32%) with technical root cause investigation
  • Follows existing patterns: Uses HTML comment sentinels consistent with the existing BENCHMARK_DATA preservation pattern

Technical Implementation

The preservation logic is sound:

let notes = '';
if (fs.existsSync(benchmarkPath)) {
    const existing = fs.readFileSync(benchmarkPath, 'utf8');
    const notesMatch = existing.match(/\n([\s\S]*?)/);
    if (notesMatch) {
        notes = notesMatch[1];
    }
}
if (notes) {
    md += `\n${notes}\n\n`;
}

Minor Observations

  • Regex is correctly non-greedy ([\s\S]*?) to avoid over-matching
  • Sentinel placement is logical (after data tables, before raw JSON)
  • No error handling around regex matching, but failure would just result in no preservation (acceptable degradation)

Critical Concerns

None identified. This is a legitimate bug fix that preserves valuable content without introducing security, performance, or maintainability issues.

Test Plan Verification

The PR includes appropriate test steps:

  • Manual verification that notes survive regeneration
  • Verification that sentinel blocks are preserved across multiple runs

Final Recommendation

  • Rating: ⭐⭐⭐⭐☆ (4/5)
  • Action: APPROVE
  • Reasoning: This is a well-implemented fix for a legitimate problem. The code is clean, follows established patterns, and preserves valuable investigative content that was being lost to automation. The implementation is minimal and non-breaking, with appropriate degradation behavior. The only minor improvement would be adding automated tests, but for a utility script this level of testing may be proportionate to the risk.

Quality indicators:

  • Solves real problem (CI clobbering manual content)
  • Minimal, focused change (+13 lines script, +20 lines preserved content)
  • Uses standard preservation patterns
  • Preserves valuable technical analysis content
  • Non-breaking implementation

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 26, 2026

Greptile Summary

Added sentinel preservation to the benchmark report regeneration script so CI can update metrics without clobbering hand-written analysis. The implementation uses <!-- NOTES_START --> / <!-- NOTES_END --> sentinels with regex extraction to preserve notes across regenerations. The PR seeds the report with detailed WASM regression analysis explaining the 32% performance degradation from v2.0.0 to v2.1.0.

  • Implementation is clean with proper edge case handling (missing file, no match, empty notes)
  • Regex pattern correctly uses non-greedy matching to capture content between sentinels
  • Notes are placed logically after metrics tables and before raw JSON data
  • The analysis notes provide valuable context about WASM/native performance divergence

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The change is well-implemented with proper edge case handling, uses standard regex patterns correctly, and solves a clear problem (preventing CI from overwriting hand-written notes). No logical issues, security concerns, or breaking changes.
  • No files require special attention

Important Files Changed

Filename Overview
scripts/update-benchmark-report.js Added sentinel-based preservation logic for hand-written notes sections - implementation is clean and handles edge cases properly
generated/BUILD-BENCHMARKS.md Added WASM regression analysis notes between sentinels - provides detailed context for performance regression from v2.0.0 to v2.1.0

Last reviewed commit: 299da2a

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@carlos-alm carlos-alm merged commit 2d79f18 into main Feb 26, 2026
17 checks passed
@carlos-alm carlos-alm deleted the fix/benchmark-notes-preservation branch February 26, 2026 22:52
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