Skip to content

Comments

feat(schema-migrations): upgrade hardcoded frontend queries in place#34063

Merged
thmsobrmlr merged 5 commits intomasterfrom
revert-34045-revert-33650-schema-migration-hardcoded-frontend-queries
Jun 24, 2025
Merged

feat(schema-migrations): upgrade hardcoded frontend queries in place#34063
thmsobrmlr merged 5 commits intomasterfrom
revert-34045-revert-33650-schema-migration-hardcoded-frontend-queries

Conversation

@thmsobrmlr
Copy link
Collaborator

Reverts the revert #34045

#33650

@github-actions
Copy link
Contributor

github-actions bot commented Jun 23, 2025

Size Change: +3.1 kB (+0.12%)

Total Size: 2.58 MB

Filename Size Change
frontend/dist/toolbar.js 2.58 MB +3.1 kB (+0.12%)

compressed-size-action

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR reintroduces the schema migration system for frontend queries by implementing version control through the setLatestVersionsOnQuery utility, ensuring consistent schema versioning across the application.

  • Added version control to Monaco editor components in frontend/src/lib/monaco/codeEditorLogic.tsx and hogQLAutocompleteProvider.ts to ensure proper schema versioning during query editing and autocompletion
  • Refactored getFreshQuery to setLatestVersionsOnQuery in frontend/src/queries/utils.ts with new recursion control feature for fine-grained version management
  • Applied versioning across critical query components (experiments, funnels, retention) with explicit recursion control to prevent deep recursion issues
  • Enhanced HogQL query handling in frontend/src/lib/api.ts to ensure version consistency before backend transmission
  • Added comprehensive test coverage in frontend/src/queries/utils.setLatestVersionsOnQuery.test.ts for both recursive and non-recursive version setting

23 files reviewed, 1 comment
Edit PR Review Bot Settings | Greptile

Comment on lines +41 to +47
? setLatestVersionsOnQuery(
{
kind: NodeKind.HogQLASTQuery,
query: queryInput,
},
{ recursion: false }
)
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider moving the common options object { recursion: false } to a constant since it's used twice

@thmsobrmlr thmsobrmlr requested review from a team, andehen and jurajmajerik June 23, 2025 21:51
Copy link
Contributor

@andehen andehen left a comment

Choose a reason for hiding this comment

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

Tested the branch locally, and experiment queries are working fine ✅

Is wrapping the input to performQuery with setLatestVersionsOnQuery something temporary, or something we need to care about in the future?

@thmsobrmlr
Copy link
Collaborator Author

Tested the branch locally, and experiment queries are working fine ✅

Is wrapping the input to performQuery with setLatestVersionsOnQuery something temporary, or something we need to care about in the future?

This is part of a schema migrations system that will allow us to evolve the query schema e.g. changing a boolean property to an enum. The system makes the assumption that nodes without an explicit version are version 1. As such we need to set the latest version on each node that we know to be in the current schema i.e. for all hardcoded parts of queries.

@thmsobrmlr thmsobrmlr merged commit a69a29b into master Jun 24, 2025
124 checks passed
@thmsobrmlr thmsobrmlr deleted the revert-34045-revert-33650-schema-migration-hardcoded-frontend-queries branch June 24, 2025 09:06
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