Skip to content

feat(preference): add support for objects and arrays #8142

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

grandwizard28
Copy link
Collaborator

@grandwizard28 grandwizard28 commented Jun 3, 2025

📄 Summary

Better readbility and support for objects and arrays


Important

Enhances preference handling by adding support for objects and arrays, refactoring preference management, and updating API endpoints.

  • Behavior:
    • Adds support for object and array preference values in pkg/types/preferencetypes/value.go.
    • Refactors preference handling to use name instead of key in frontend/src/container/Home/Home.tsx and frontend/src/container/OnboardingQuestionaire/index.tsx.
    • Updates API endpoints in pkg/query-service/app/http_handler.go to use new preference methods.
  • Modules:
    • Refactors implpreference/module.go to handle preferences by name and support new value types.
    • Updates implpreference/store.go to support new preference storage methods.
    • Modifies preference.go to define new interfaces for preference operations.
  • Types:
    • Introduces Name, Scope, and ValueType in pkg/types/preferencetypes/name.go, scope.go, and value.go.
    • Adds NewAvailablePreference and NewPreference functions in pkg/types/preferencetypes/preference.go.
    • Updates pkg/types/preferencetypes/preference_test.go and value_test.go with tests for new functionality.
  • Misc:
    • Removes deprecated preference API files in frontend/src/api/preferences/.
    • Updates pkg/signoz/module.go to initialize new preference module.

This description was created by Ellipsis for 9b9faee. You can customize this summary. It will automatically update as commits are pushed.

@github-actions github-actions bot added the enhancement New feature or request label Jun 3, 2025
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed everything up to a7d0ae2 in 2 minutes and 3 seconds. Click for details.
  • Reviewed 1386 lines of code in 10 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. pkg/modules/preference/implpreference/store.go:72
  • Draft comment:
    Typographical note: There appears to be a duplicated 'store.' chain before the call to BunDB(). Please verify if this is intentional or if one of the 'store.' calls should be removed.
  • Reason this comment was not posted:
    Comment was on unchanged code.
2. pkg/types/preferencetypes/value.go:37
  • Draft comment:
    Typo: There's an extra space before the comma in the error message. Consider changing "min: %d , max: %d" to "min: %d, max: %d" for consistency.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While this is a valid observation about code style, it's an extremely minor formatting issue that doesn't affect functionality. The error message will work the same either way. The rules say not to make comments that are obvious or unimportant. This seems to fall into that category - it's a trivial change that could be considered nitpicking. The extra space in error messages could be seen as inconsistent with the rest of the codebase's style. Having consistent error message formatting might make logs easier to read. While consistency is good, this is too minor of an issue to warrant a PR comment. It doesn't affect functionality or significantly impact readability. The comment should be deleted as it addresses an extremely minor formatting issue that doesn't meaningfully impact the code.

Workflow ID: wflow_M1AoGtiCRFl1LE76

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@grandwizard28
Copy link
Collaborator Author

@grandwizard28 grandwizard28 requested review from YounixM and a team as code owners June 4, 2025 20:09
@grandwizard28 grandwizard28 force-pushed the platform-pod/issues/861 branch from c66b137 to 92f7c4b Compare June 4, 2025 20:09
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed c66b137 in 1 minute and 29 seconds. Click for details.
  • Reviewed 38 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. frontend/src/api/preferences/updateOrgPreference.ts:16
  • Draft comment:
    Changed payload key from 'preference_value' to 'value'. Ensure that the backend and API docs are updated to expect this new field, especially for object/array values.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The comment violates several rules: 1) It asks to "ensure" something, which is explicitly forbidden 2) It's asking about backend compatibility which requires context we don't have 3) It's asking about documentation which is outside the scope of this file 4) It's speculative about potential issues with object/array values. Maybe the API change could cause serious runtime errors if not properly coordinated with the backend. Maybe this warning could prevent a production issue. While API compatibility is important, the rules explicitly state not to make speculative comments or ask for verification. We must assume the author has properly tested their changes. The comment should be deleted as it violates multiple review rules by being speculative and asking for verification of backend compatibility.
2. frontend/src/api/preferences/updateUserPreference.ts:16
  • Draft comment:
    Payload key updated to 'value'. Verify consistency with backend changes and update any relevant documentation regarding support for objects and arrays.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to verify consistency with backend changes and update documentation. This falls under the rule of not asking the author to ensure behavior is intended or to update documentation.
3. pkg/modules/preference/implpreference/module.go:9
  • Draft comment:
    Removed outdated internal comment. Confirm that any needed guidance about using a better Organization module is documented elsewhere so that future developers aren’t left in the dark.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None

Workflow ID: wflow_Wps7CCreNJlHtECE

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed c63f8cf in 1 minute and 21 seconds. Click for details.
  • Reviewed 1362 lines of code in 32 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. pkg/types/preferencetypes/value.go:84
  • Draft comment:
    Consider using a canonical JSON encoder for objects to produce deterministic stringValue output.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. pkg/types/preferencetypes/value_test.go:52
  • Draft comment:
    Use assert.JSONEq or compare unmarshaled values to avoid flakiness due to non-deterministic map key order.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_XRJJLnDloAjg9kfV

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@grandwizard28 grandwizard28 force-pushed the platform-pod/issues/861 branch from c63f8cf to ca25943 Compare June 6, 2025 09:20
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed c0bba17 in 1 minute and 5 seconds. Click for details.
  • Reviewed 18 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. pkg/types/preferencetypes/value.go:127
  • Draft comment:
    When returning the error for an invalid allowed value, consider using the type-asserted variable (goStringValue) instead of value.stringValue. This maintains consistency since the check uses goStringValue.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_axUXJ9rzxWHTBT45

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 8706e6e in 43 seconds. Click for details.
  • Reviewed 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. pkg/types/preferencetypes/value.go:131
  • Draft comment:
    Error message now displays allowedValues; consider using %q to quote the provided value (goStringValue) for clarity, ensuring it matches expected string formatting.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_XGWqjXxU0eApULqL

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@grandwizard28 grandwizard28 added safe-to-integrate Run integration tests staging:next-ewe staging (pandey) and removed safe-to-integrate Run integration tests staging:next-ewe staging (pandey) labels Jun 6, 2025
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 9b9faee in 38 seconds. Click for details.
  • Reviewed 16 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. pkg/types/preferencetypes/value.go:21
  • Draft comment:
    Removed unused Range struct. Ensure no parts of the system still depend on it.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to ensure that no parts of the system depend on the removed Range struct. This violates the rule against asking the author to confirm or ensure things. The comment does not provide a specific suggestion or point out a specific issue.

Workflow ID: wflow_7VBm1tXnt4yRQ5VT

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request safe-to-integrate Run integration tests staging:next-ewe staging (pandey)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants