Skip to content

Conversation

@Tobbe
Copy link
Member

@Tobbe Tobbe commented Jan 3, 2026

In preparation for switching over to oxc-format I need baseline perf metrics and good test coverage

@netlify
Copy link

netlify bot commented Jan 3, 2026

Deploy Preview for cedarjs ready!

Name Link
🔨 Latest commit dd474cb
🔍 Latest deploy log https://app.netlify.com/projects/cedarjs/deploys/695910bdd02b190009b537dc
😎 Deploy Preview https://deploy-preview-923--cedarjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added this to the chore milestone Jan 3, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 3, 2026

Greptile Summary

Added comprehensive test infrastructure and benchmarking script to establish baseline metrics before migrating from ts-morph to oxc-parser.

Key Additions:

  • Benchmark script (benchmark.mts): Measures initialization time, cold/warm diagnostic runs, and memory usage with statistical analysis (mean, median, p95, stddev)
  • Test suite covering 6 test categories: API contract stability, diagnostics parity, edge cases, extractor logic, integration tests, and serialization snapshots
  • Local test fixture (structure-test-project) with edge cases like nested Sets, spread props, unusual cell exports, and notfound routes
  • Snapshot baselines for diagnostic messages and project structure serialization across multiple fixtures

Test Coverage:

  • Public API contracts for RWProject, RWRouter, RWRoute, RWPage, RWCell, RWService
  • Error handling for malformed syntax, missing exports, and non-existent paths
  • Cross-package integration with @cedarjs/internal
  • Atomic extractor logic for cells vs components, GraphQL operations, service functions, and route attributes

The tests provide a safety net for refactoring and a baseline for comparing performance improvements when switching parsers.

Confidence Score: 5/5

  • Safe to merge - well-structured test infrastructure with no functional code changes
  • All changes are additive (tests, fixtures, documentation, benchmarking script) with no modifications to production code. The test suite is comprehensive, properly structured, and includes snapshot baselines. The benchmark script follows best practices with warmup iterations, GC control, and statistical analysis.
  • No files require special attention

Important Files Changed

Filename Overview
packages/structure/benchmark.mts Added comprehensive performance benchmarking script with warmup, cold/warm runs, memory tracking, and statistical analysis
packages/structure/src/tests/parity/api_contract.test.ts Public API stability tests ensuring expected properties exist on RWProject, RWRouter, RWRoute, RWPage, RWCell, and RWService
packages/structure/src/tests/parity/diagnostics.test.ts Snapshot tests for diagnostic output across multiple fixtures to ensure diagnostic consistency
packages/structure/src/tests/parity/extractors.test.ts Unit tests verifying correct extraction logic for cells, components, services, and route attributes
packages/structure/src/tests/parity/integration.test.ts Integration test verifying @cedarjs/internal package correctly consumes structure package API
packages/structure/src/tests/parity/snapshot.test.ts Comprehensive serialization snapshot tests for all project structures across multiple fixtures

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant Bench as benchmark.mts
    participant RWP as RWProject
    participant Tests as Test Suite
    participant Fixtures as Test Fixtures
    
    Note over Dev,Fixtures: PR Setup: Baseline Tests & Benchmarks
    
    Dev->>Fixtures: Create structure-test-project
    Fixtures-->>Tests: Provide test data
    
    Dev->>Tests: Run test suite
    Tests->>RWP: getProject(projectRoot)
    RWP-->>Tests: Project instance
    
    Tests->>RWP: Verify API contract
    Tests->>RWP: Extract diagnostics
    Tests->>RWP: Test extractors
    Tests->>RWP: Integration tests
    Tests->>RWP: Snapshot serialization
    RWP-->>Tests: Results
    Tests-->>Dev: Pass/Fail with snapshots
    
    Dev->>Bench: Run benchmark script
    Note over Bench: Warmup phase (2 iterations)
    loop Warmup
        Bench->>RWP: new RWProject()
        RWP-->>Bench: Instance
        Bench->>RWP: collectDiagnostics()
        RWP-->>Bench: Diagnostics
    end
    
    Note over Bench: Measurement phase (10 iterations)
    loop Measurements
        Bench->>Bench: forceGC()
        Bench->>RWP: new RWProject() [measure init]
        RWP-->>Bench: Instance + timing
        Bench->>RWP: collectDiagnostics() [cold]
        RWP-->>Bench: Diagnostics + timing
        Bench->>RWP: collectDiagnostics() [warm]
        RWP-->>Bench: Cached results + timing
        Bench->>Bench: Track memory delta
    end
    
    Bench->>Bench: calculateStats()
    Bench-->>Dev: Performance report (mean/median/p95)
Loading

@nx-cloud
Copy link

nx-cloud bot commented Jan 3, 2026

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit dd474cb

Command Status Duration Result
nx run-many -t build ❌ Failed 4s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-03 12:58:05 UTC

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.

2 participants