Skip to content

Bug 1994757 - Store the client ID in an additional plaintext file and report on regeneration#3292

Merged
badboy merged 5 commits intomainfrom
push-lnryykzvpyqt
Nov 3, 2025
Merged

Bug 1994757 - Store the client ID in an additional plaintext file and report on regeneration#3292
badboy merged 5 commits intomainfrom
push-lnryykzvpyqt

Conversation

@badboy
Copy link
Copy Markdown
Member

@badboy badboy commented Oct 21, 2025

This is a first approach at putting this state diagram into code.

This is not yet pretty. or organized. or ready to be looked at.
But it's not not wrong and I will expand upon that.

@badboy badboy force-pushed the push-lnryykzvpyqt branch 8 times, most recently from 333e836 to 8e10346 Compare October 28, 2025 14:17
@badboy badboy added the needs:data-review PR is awaiting a data review label Oct 28, 2025
@badboy badboy force-pushed the push-lnryykzvpyqt branch from 8e10346 to e2931ad Compare October 28, 2025 14:19
@badboy badboy marked this pull request as ready for review October 28, 2025 14:19
@badboy badboy requested a review from a team as a code owner October 28, 2025 14:19
@badboy badboy requested review from chutten and travis79 and removed request for a team October 28, 2025 14:19
Copy link
Copy Markdown
Member

@travis79 travis79 left a comment

Choose a reason for hiding this comment

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

Nothing concerning here, r+ from me pending data-review

Comment thread glean-core/src/core/mod.rs
Comment thread glean-core/src/core/mod.rs Outdated
Copy link
Copy Markdown
Contributor

@chutten chutten left a comment

Choose a reason for hiding this comment

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

Also needs CHANGELOG

Comment thread glean-core/rlb/tests/health_ping_file_overwrite.rs Outdated
Comment thread glean-core/rlb/tests/health_ping_file_overwrite.rs Outdated
Comment thread glean-core/src/core/mod.rs
Comment thread glean-core/src/core/mod.rs Outdated
Comment thread glean-core/src/database/mod.rs
Comment thread glean-core/src/core/mod.rs Outdated
Comment thread glean-core/src/core/mod.rs Outdated
Comment thread glean-core/metrics.yaml
Comment thread glean-core/tests/clientid_textfile.rs
Comment thread glean-core/tests/clientid_textfile.rs
@chutten
Copy link
Copy Markdown
Contributor

chutten commented Oct 28, 2025

Oh, and also needs docs

@badboy badboy force-pushed the push-lnryykzvpyqt branch 4 times, most recently from c39f7ea to 7405896 Compare October 31, 2025 12:38
@badboy badboy requested review from chutten and travis79 October 31, 2025 13:49
Comment thread docs/dev/core/internal/client_id_recovery.md Outdated
Comment thread docs/dev/core/internal/index.md
Comment thread glean-core/rlb/tests/health_ping_file_overwrite.rs Outdated
Comment thread docs/dev/core/internal/client_id_recovery.md Outdated
Comment thread glean-core/src/core/mod.rs
Comment thread glean-core/src/core/mod.rs
Comment thread glean-core/src/core/mod.rs
Comment thread glean-core/src/core/mod.rs Outdated
Comment on lines +378 to +381
glean
.core_metrics
.client_id
.set_from_uuid_sync(&glean, stored_client_id);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would this be considered a "mitigation" that we should avoid until later?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So I guess technically?
But let's think through it:

  1. We assume a client right now can contain a c0ffee ID
  2. We also assume no client_id.txt exists.
  3. Glean inits, writes the client ID (c0ffee) from the DB into the file.
  4. Glean initializes core metrics. Detects c0ffee in the database. Generates a new UUID. Stores that into the database and the file.

If for whatever reason (4) doesn't happen, the file will also include the c0ffee ID.
So "restoring" means we don't change anything.
If (4) happens, both the database and the file should have the same, valid ID (except if it happens to crash right in between these two operations, which I guess ... at our scale could happen?). So maybe we should check that stored_client_id is not the c0ffee ID either? It's a tiny edge case, but I had enough with our edge cases 🙈

Comment thread glean-core/tests/clientid_textfile.rs
Comment thread glean-core/metrics.yaml Outdated
@badboy badboy removed the needs:data-review PR is awaiting a data review label Nov 3, 2025
Copy link
Copy Markdown
Contributor

@chutten chutten left a comment

Choose a reason for hiding this comment

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

I can't think of any way to make this better, well done

@badboy badboy force-pushed the push-lnryykzvpyqt branch from 33c0f20 to 2ff3401 Compare November 3, 2025 15:05
@badboy badboy enabled auto-merge (rebase) November 3, 2025 15:06
@badboy badboy merged commit 26b1e9a into main Nov 3, 2025
27 of 28 checks passed
@badboy badboy deleted the push-lnryykzvpyqt branch November 3, 2025 15:26
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.

3 participants