Skip to content

Move FileIO table labels into marker schemas - #6296

Open
fatadel wants to merge 2 commits into
firefox-devtools:mainfrom
fatadel:issue-6295
Open

Move FileIO table labels into marker schemas#6296
fatadel wants to merge 2 commits into
firefox-devtools:mainfrom
fatadel:issue-6295

Conversation

@fatadel

@fatadel fatadel commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Main | Deploy preview

Replace the hardcoded data.type branch that assembles FileIO table labels with a schema template. Optional segments let the template omit surrounding punctuation when source or filename fields are missing.

Closes #6295


Profile with IO enabled

@fatadel
fatadel requested review from canova and mstange September 2, 2026 14:03
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.87%. Comparing base (7abc8b8) to head (598a19b).
⚠️ Report is 42 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6296      +/-   ##
==========================================
+ Coverage   83.82%   83.87%   +0.05%     
==========================================
  Files         350      353       +3     
  Lines       37744    37857     +113     
  Branches    10646    10565      -81     
==========================================
+ Hits        31638    31753     +115     
+ Misses       5677     5675       -2     
  Partials      429      429              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fatadel

fatadel commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author
  • When this is merged, create a bug for the Gecko side.

@canova canova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR! Before I review completely, I see that this PR does 2 main things:

  • Adds optional segment syntax to marker labels
  • Adds a tableLabel to FileIO markers

It's difficult to review these two changes when they are combined together. Can you please split them into 2 commits?

Comment thread src/profile-logic/marker-schema.ts Outdated
@fatadel

fatadel commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the PR! Before I review completely, I see that this PR does 2 main things:

* Adds optional segment syntax to marker labels

* Adds a tableLabel to FileIO markers

It's difficult to review these two changes when they are combined together. Can you please split them into 2 commits?

Done ✅

@canova canova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re the optional segmenting in labels using ``[[ ... ]]`:
I'm a bit unsure about adding more and more label templating features to the marker labels. It feels like it can get out of hand quickly and not that easy to get it right.
Pinging and @mstange and @fqueze in case they feel strongly about it.

One issue that I can see is ternaries and the optional segment conflicts right now. For example [[{marker.data.canceled ? 'cancelled' : 'ok'}]] never prints ok if I understand correctly.

On the other hand, I believe this current behavior of FileIO marker can be implemented using ternaries already, right? I assume it'll be longer, but it saves us from adding more complexity here. What do you think?

Comment thread src/profile-logic/processed-profile-versioning.ts Outdated
Comment thread src/profile-logic/marker-schema.ts Outdated
@fatadel

fatadel commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Re the optional segmenting in labels using ``[[ ... ]]`: I'm a bit unsure about adding more and more label templating features to the marker labels. It feels like it can get out of hand quickly and not that easy to get it right. Pinging and @mstange and @fqueze in case they feel strongly about it.

One issue that I can see is ternaries and the optional segment conflicts right now. For example [[{marker.data.canceled ? 'cancelled' : 'ok'}]] never prints ok if I understand correctly.

On the other hand, I believe this current behavior of FileIO marker can be implemented using ternaries already, right? I assume it'll be longer, but it saves us from adding more complexity here. What do you think?

Your example does print ok when marker.data.canceled is false, optional segments are omitted only for missing, null, or empty-string values. But I agree that we are adding excessive complexity to the vocabulary.

We cannot have the same behavior with just the ternaries though. The current hardcoded FileIO code omits that entire section when source is empty. Existing ternaries cannot conditionally include the interpolation itself. So, instead of having '' we would have (empty).

@fatadel

fatadel commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

@canova Thanks for the review! I've addressed your other comments, however, I am not sure what to do with the increased vocabulary complexity...

@fatadel
fatadel requested a review from canova September 10, 2026 15:41
@canova

canova commented Sep 10, 2026

Copy link
Copy Markdown
Member

Thanks for thinking it through!

Re the optional segmenting in labels using ``[[ ... ]]: I'm a bit unsure about adding more and more label templating features to the marker labels. It feels like it can get out of hand quickly and not that easy to get it right. Pinging and @mstange and @fqueze in case they feel strongly about it. One issue that I can see is ternaries and the optional segment conflicts right now. For example [[{marker.data.canceled ? 'cancelled' : 'ok'}]]` never prints `ok` if I understand correctly.
On the other hand, I believe this current behavior of FileIO marker can be implemented using ternaries already, right? I assume it'll be longer, but it saves us from adding more complexity here. What do you think?

Your example does print ok when marker.data.canceled is false, optional segments are omitted only for missing, null, or empty-string values. But I agree that we are adding excessive complexity to the vocabulary.

Yeah I wasn't fully correct on "never" prints ok part. It prints ok on false but doesn't print ok when it's null, which I expect it to. Because I first expect the inner ternary to be evaluated and then the optional one. Here's an example profile

I have two markers, with canceled: null. And one marker schema has [[{marker.data.canceled ? 'cancelled' : 'ok'}]] and the other {marker.data.canceled ? 'cancelled' : 'ok'}. And I expect them both to show ok, but only the bare ternary one shows ok and not the null one.

We cannot have the same behavior with just the ternaries though. The current hardcoded FileIO code omits that entire section when source is empty. Existing ternaries cannot conditionally include the interpolation itself. So, instead of having '' we would have (empty).

You are right on that, but this sounds like a bug to me. We show (empty) while printing the tooltip to make it clear for the users, but it shouldn't be used while we are testing the condition inside the ternary or on the label. Note this isn't about the ternary condition, which already reads the raw payload value and treats '' as false. It's the plain {marker.data.x} interpolation that formats '' into (empty). I would prefer to fix that instead of working around it.

For example I think this if check should include checking empty strings too:

if (value === undefined || value === null) {
// This would return "undefined" or "null" otherwise.
return '';

Once that's fixed the ternary version of this FileIO marker could be this:

{marker.data.source ? '(' : ''}{marker.data.source}{marker.data.source ? ') ' : ''}{marker.data.operation}{marker.data.filename ? ' — ' : ''}{marker.data.filename}

Not nice looking but good enough.

Marker labels pass empty strings to the shared value formatter, which
renders them as `(empty)` for tooltip fields. Skip empty strings before
formatting label parts so labels can omit them without changing tooltip
formatting.
Replace the hardcoded `data.type` branch in the generic label fallback
with a template on the FileIO schema.
@fatadel

fatadel commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for thinking it through!

Re the optional segmenting in labels using ``[[ ... ]]: I'm a bit unsure about adding more and more label templating features to the marker labels. It feels like it can get out of hand quickly and not that easy to get it right. Pinging and @mstange and @fqueze in case they feel strongly about it. One issue that I can see is ternaries and the optional segment conflicts right now. For example [[{marker.data.canceled ? 'cancelled' : 'ok'}]]` never prints `ok` if I understand correctly.
On the other hand, I believe this current behavior of FileIO marker can be implemented using ternaries already, right? I assume it'll be longer, but it saves us from adding more complexity here. What do you think?

Your example does print ok when marker.data.canceled is false, optional segments are omitted only for missing, null, or empty-string values. But I agree that we are adding excessive complexity to the vocabulary.

Yeah I wasn't fully correct on "never" prints ok part. It prints ok on false but doesn't print ok when it's null, which I expect it to. Because I first expect the inner ternary to be evaluated and then the optional one. Here's an example profile

I have two markers, with canceled: null. And one marker schema has [[{marker.data.canceled ? 'cancelled' : 'ok'}]] and the other {marker.data.canceled ? 'cancelled' : 'ok'}. And I expect them both to show ok, but only the bare ternary one shows ok and not the null one.

We cannot have the same behavior with just the ternaries though. The current hardcoded FileIO code omits that entire section when source is empty. Existing ternaries cannot conditionally include the interpolation itself. So, instead of having '' we would have (empty).

You are right on that, but this sounds like a bug to me. We show (empty) while printing the tooltip to make it clear for the users, but it shouldn't be used while we are testing the condition inside the ternary or on the label. Note this isn't about the ternary condition, which already reads the raw payload value and treats '' as false. It's the plain {marker.data.x} interpolation that formats '' into (empty). I would prefer to fix that instead of working around it.

For example I think this if check should include checking empty strings too:

if (value === undefined || value === null) {
// This would return "undefined" or "null" otherwise.
return '';

Once that's fixed the ternary version of this FileIO marker could be this:

{marker.data.source ? '(' : ''}{marker.data.source}{marker.data.source ? ') ' : ''}{marker.data.operation}{marker.data.filename ? ' — ' : ''}{marker.data.filename}

Not nice looking but good enough.

Thanks for your response, @canova! That should indeed work. Implemented now.

@canova canova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

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.

Drive FileIO table labels from marker schemas

2 participants