Skip to content

Conversation

@VinayGuthal
Copy link
Contributor

@VinayGuthal VinayGuthal commented Jan 22, 2026

This PR does the following

  • Adds field experimentIdsEncryptedList to EventContext
  • Adds field experimentIdsEncryptedList to EventInternal
  • Updates Sqlite schema to include the above mentioned field
  • Updates the ExperimentIds class to have setEncryptedBlob as a list (base 64 encoded of the byte array)
  • Updates test proto to match the prod proto

@gemini-code-assist
Copy link
Contributor

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 22, 2026

📝 PRs merging into main branch

Our main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released.

@VinayGuthal VinayGuthal force-pushed the support_experimental_ids branch from 7b60d7c to 86fa294 Compare January 27, 2026 15:52
@VinayGuthal VinayGuthal requested a review from rlazo January 27, 2026 15:58
while (buffer.hasRemaining()) {
int length = buffer.getInt(); // Read the "Header" first
byte[] row = new byte[length];
buffer.get(row); // Read exactly that many bytes
Copy link
Collaborator

Choose a reason for hiding this comment

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

Am I missing something? The docs say that get(int) will get you 1 byte at a given index https://developer.android.com/reference/java/nio/ByteBuffer#get(int)


while (buffer.hasRemaining()) {
int length = buffer.getInt(); // Read the "Header" first
byte[] row = new byte[length];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Check that the buffer has enough bytes left to read

}
}

private List<byte[]> deFlattenBlob(byte[] flatBlob) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We haven't being doing it consistently, but could you make this @NonNull ?

return rows;
}

private byte[] flattenListBlob(List<byte[]> blob) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We haven't being doing it consistently, but could you make this @NonNull ?

if (blob == null) return null;

byte[][] input = blob.toArray(new byte[0][]);
int metadataSize = input.length * 4;
Copy link
Collaborator

Choose a reason for hiding this comment

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

add a comment describing that this is for the "integer" header

@SuppressWarnings("mutable")
@Nullable
public abstract byte[] getEncryptedBlob();
public abstract List<String> getEncryptedBlob();
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this breaking?

Comment on lines +320 to +330
if (eventInternal.getExperimentIdsEncryptedList() != null) {
List<String> encodedListByteData =
encodeListByteData(eventInternal.getExperimentIdsEncryptedList());
if (eventInternal.getExperimentIdsEncrypted() != null) {
encodedListByteData.add(
Base64.encodeToString(eventInternal.getExperimentIdsEncrypted(), Base64.NO_WRAP));
}
builder.setEncryptedBlob(encodedListByteData);
} else if (eventInternal.getExperimentIdsEncrypted() != null) {
builder.setEncryptedBlob(
encodeListByteData(List.of(eventInternal.getExperimentIdsEncrypted())));
Copy link
Collaborator

Choose a reason for hiding this comment

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

While this is correct, I'm thinking if there's a way to make it less complex to read. What about something like (pseudo-code)

List<encryptedExperimentId> experiments = new List<>()
if (encryptedList != null) experiments.addAll(encryptedList)
if (encrypted !=null) experiments.add(encrypted)
if (!experiments.empty()) builder.setEncryptedBlob(...)

ExperimentIds.builder()
.setClearBlob("blob".getBytes(StandardCharsets.UTF_8))
.setEncryptedBlob("encrypted blob".getBytes(StandardCharsets.UTF_8))
.setEncryptedBlob(
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we have tests that don't use the list? for backward compatibility ?

.setPseudonymousId(PSEUDONYMOUS_ID)
.setExperimentIdsClear(EXPERIMENT_IDS_CLEAR.toByteArray())
.setExperimentIdsEncrypted(EXPERIMENT_IDS_ENCRYPTED.toByteArray())
.setExperimentIdsEncryptedList(
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we have one without the list? for backwards compatibility ?

new EncodedPayload(JSON_ENCODING, "Hello".getBytes(Charset.defaultCharset())))
.addMetadata("key1", "value1")
.addMetadata("key2", "value2")
.setExperimentIdsEncryptedList(List.of("encrypted blob".getBytes(StandardCharsets.UTF_8)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we have one with a single element?

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