Skip to content

Proposal: some improvements, and how to track them #9

Open

Description

@nucliweb

Hi @jackfranklin,

I've been using trace-engine-cli and spent some time going through the codebase. I have a list of possible improvements. Before opening a batch of issues, I'd like to check which ones make sense to you and how you prefer to handle them.

Bugs (reproduced locally)

  • insights and navigations silently ignore --time-range. The option is global, so both commands accept it and return data for the full trace.
  • insights reports navigationId: null even when it uses the first InsightSet.
  • Numeric options are not validated. tasks --top -5 and profile --bucket 0 return empty results with exit code 0, which an agent reads as "nothing found".
  • scan silently skips files it cannot decompress or parse. With a directory containing one valid trace, one truncated .json and one corrupt .json.gz, scan <dir> --grep RunTask reports totalFilesScanned: 3, totalFilesMatched: 1 and exits 0 with no warning, so a broken file looks the same as a file with no matches.

Features

  • compare <baseline> <candidate>: compare two traces (CWV deltas and rating changes, main thread busy time, long tasks, top function regressions). Useful for before/after checks on a PR.
  • Cover more insight models. insights exposes 5 of the 19 models in the engine (ForcedReflow, DOMSize, LCPDiscovery, DocumentLatency, ImageDelivery and FontDisplay are missing, among others). Exposing state and metricSavings would also help agents prioritize.
  • --format json, and possibly stdin input and --fail-on thresholds for CI.

Tests and infra

  • Add a small real Chrome trace with snapshot tests. All fixtures are synthetic, and Dependabot bumps @paulirish/trace_engine daily, so a change in the engine's output shape could still pass CI.
  • Add "engines": { "node": ">=22" }. scan uses fs.globSync, which is not available in Node 20.

Docs

  • A section on how to record a compatible trace (DevTools, Puppeteer, chrome-devtools-mcp).

Would it be OK if I open one issue per item (or only for the ones you're interested in), and then send a PR for each once we agree on the approach in the issue? If you'd prefer to skip some of these or handle them differently, just let me know.

Thanks!

Activity

  1. jackfranklin commented on Nov 9, 2026

    @jackfranklin
    Collaborator

    Hey, thanks for digging into this!

    All the bugs you found are definitely legit and need fixing, so PRs welcome for that.

    Feature wise: yes let's chat. I think other than the compare idea, the rest are slam dunks and happy to see PRs. The compare idea I'm less convinced by immediately, but happy for you to open an issue and we can chat.

    TL;DR: yes to all of this. Appreciate the help!

  2. nucliweb commented on Nov 25, 2026

    @nucliweb
    ContributorAuthor

    Progress update. Most of this list is merged, a large part of it thanks to @kurtextrem's work on #14.

    Bugs

    Features

    Tests and infra

    Docs

    Next, I plan to work on insight coverage and the real-trace snapshot tests. About --fail-on: with --format json, a CI job can already check thresholds with jq. Do you still want a built-in option, or should we drop it?

  3. jackfranklin commented on Nov 26, 2026

    @jackfranklin
    Collaborator

    Can you give me an example of what you would pass to --fail-on ? I'm trying to decide how much we should support that honestly vs the flexibility of either:

    1. An agent reading the output --json and parsing that with jq/etc
    2. People writing their own scripts to use the trace engine to parse & define the threshold in code very precisely.

    wdyt?

  4. nucliweb commented on Nov 26, 2026

    @nucliweb
    ContributorAuthor

    The idea was a CI gate on Core Web Vitals, something like:

    trace-engine-cli overview trace.json.gz --fail-on lcp=2500,cls=0.1
    trace-engine-cli overview trace.json.gz --fail-on poor

    With --format json, the same checks are one jq -e call, and its exit code already fails the CI job:

    trace-engine-cli overview trace.json.gz -f json | jq -e '.coreWebVitals.lcp.valueMs <= 2500 and .coreWebVitals.cls.value <= 0.1'
    trace-engine-cli overview trace.json.gz -f json | jq -e '[.coreWebVitals[].rating] | all(. != "poor")'

    So I agree with you. --fail-on would add a small threshold syntax to maintain, and it would only cover the fields we choose to support. jq or a custom script is more flexible. Let's drop it. If it helps, I can add these two examples to the README so people who use the CLI in CI can find them.

  5. jackfranklin commented on Nov 26, 2026

    @jackfranklin
    Collaborator

    SGTM! Let's add to the readme. For any other issues in this list, let's make new child bugs if we don't already and we can chat about them there. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions