Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(flags): Add flags context #4458

Merged
merged 16 commits into from
Jan 21, 2025
Merged

Conversation

cmanallen
Copy link
Member

Adds a new feature context. The goal is to normalize contexts with the key "flags" and the body:

{
    "flags": {
        "values": [
            {"flag": "abc", "result": true}
        ]
    }
}

Where result is any valid JSON value.

@cmanallen cmanallen marked this pull request as ready for review January 21, 2025 15:42
@cmanallen cmanallen requested a review from a team as a code owner January 21, 2025 15:43
@cmanallen cmanallen changed the title feat(flags): Add feature context feat(flags): Add flags context Jan 21, 2025
@cmanallen cmanallen requested a review from Dav1dde January 21, 2025 16:30
Copy link
Member

@Dav1dde Dav1dde left a comment

Choose a reason for hiding this comment

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

Please add documentation for all types and fields. This is not just internal but also used to generate our official event schema, having these fields documented doesn't just help Relay development but also SDK developers.

@cmanallen
Copy link
Member Author

@Dav1dde Added documentation and integration test coverage.

@cmanallen
Copy link
Member Author

@Dav1dde While writing the coverage for a malformed flags context I noticed relay doesn't reject the envelope but instead forwards the flags context as an empty object (aside from the type key). Is this intentional behavior so we reject fewer envelopes?

@Dav1dde
Copy link
Member

Dav1dde commented Jan 21, 2025

So relay should just forward all contexts it does not know untouched but PII scrubbed.

This variant of the enum is supposed to ensure this:

    /// Additional arbitrary fields for forwards compatibility.
    #[metastructure(fallback_variant)]
    Other(#[metastructure(pii = "true")] Object<Value>),

If that is not the case (turned into an empty object) and you have a testcase to repro, please open a new issue/bug and we'll have to fix that. That should definitely not be the case.


If you mean in the flags context, I think you'd have to explicitly add an other field, like there is e.g. in the GpuContext:

    /// Additional arbitrary fields for forwards compatibility.
    #[metastructure(additional_properties, retain = true, pii = "maybe")]
    pub other: Object<Value>,

Good catch, I missed that, we probably should have that on every struct in the context (well up to you, it's forward compatibility).

@Dav1dde
Copy link
Member

Dav1dde commented Jan 21, 2025

@Dav1dde Added documentation and integration test coverage.

Nice thanks, that stuff is really helpful not just for testing but also potential regressions.

@cmanallen cmanallen merged commit 28a3e01 into master Jan 21, 2025
25 checks passed
@cmanallen cmanallen deleted the cmanallen/flags-add-deserializer branch January 21, 2025 19:17
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