Skip to content

Generate separate file for generated type models in Ruby by default#3401

Merged
koesie10 merged 4 commits intomainfrom
koesie10/hide-generated-type-models
Feb 28, 2024
Merged

Generate separate file for generated type models in Ruby by default#3401
koesie10 merged 4 commits intomainfrom
koesie10/hide-generated-type-models

Conversation

@koesie10
Copy link
Copy Markdown
Member

@koesie10 koesie10 commented Feb 23, 2024

This will generate a separate file models/ruby.model.generated.yml when running the model editor for Ruby and type models are hidden (the default). This file is ignored by the model editor, but stores all type models generated by the query. This is part of hiding type models by default.

Screenshot 2024-02-23 at 15 55 38

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

@koesie10 koesie10 marked this pull request as ready for review February 23, 2024 14:56
@koesie10 koesie10 requested a review from a team as a code owner February 23, 2024 14:56
@koesie10
Copy link
Copy Markdown
Member Author

I'll change this to use the codeQL.model.showTypeModels setting instead of canary mode once #3399 is merged.

@koesie10 koesie10 changed the title Generate separate file for generated type models in Ruby in non-canary mode Generate separate file for generated type models in Ruby by default Feb 26, 2024
Copy link
Copy Markdown
Contributor

@shati-patel shati-patel left a comment

Choose a reason for hiding this comment

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

Looks mostly good, just a few questions! 📝


I also had a general comment from testing: When I run Generate from the model editor, there's a log entry saying

CLI command succeeded.
No predicate found for typeVariableModel

I don't think this "typeVariableModel" is necessarily related to your changes, but I also couldn't see exactly where it's coming from 😅 (This is on the nightly CLI version, and a recent main codeql submodule checkout—but I tried a few different versions too 🤔)

Comment thread extensions/ql-vscode/src/model-editor/model-editor-view.ts Outdated
Comment on lines -16 to -19
parseResults: (
queryPath: string,
results: DecodedBqrs,
) => ModeledMethod[] | Promise<ModeledMethod[]>;
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.

Why are we getting rid of the parseResults option? 🤔

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.

parseResults was very specific to producing ModeledMethod[], while that's not something we want to do for this type model generation (we can just put the rows as-is into a YAML file). The only thing that parseResults was used for was await onResults(await parseResults(queryPath, bqrs)), which can very easily be replaced by await onResults(queryPath, bqrs) with very minor changes on the consumer side.

Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com>
@koesie10
Copy link
Copy Markdown
Member Author

I don't think this "typeVariableModel" is necessarily related to your changes, but I also couldn't see exactly where it's coming from 😅 (This is on the nightly CLI version, and a recent main codeql submodule checkout—but I tried a few different versions too 🤔)

I believe this has been there since the beginning. The model editor doesn't support typeVariableModel, but it's a predicate that's produced from the generation query. We can ignore this log message.

Copy link
Copy Markdown
Contributor

@shati-patel shati-patel left a comment

Choose a reason for hiding this comment

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

Thanks for the explanations ✨ Looks good!

@koesie10 koesie10 merged commit 359ee76 into main Feb 28, 2024
@koesie10 koesie10 deleted the koesie10/hide-generated-type-models branch February 28, 2024 10:47
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