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

Introduce PureModelContextCollection type and use it in WorkspaceSDLCLoader #2641

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

abhishoya-gs
Copy link
Contributor

@abhishoya-gs abhishoya-gs commented Feb 20, 2024

What type of PR is this?

Improvement

What does this PR do / why is it needed ?

As of today, WorkspaceSDLCLoader calls ModelLoader for each dependency. This introduces as many numbers of HTTP requests and doesn't account for dependency override.

Solution

  • Introduce PureModelContextCollection type
  • Modify WorkspaceSDLCLoader to call ModelLoader with a PureModelContextCollection
  • Support fetching PureModelContextCollection using AlloySDLCLoader

Additionally, PureModelContextCollection can be used further to send smaller payloads from clients like Studio.

Which issue(s) this PR fixes:

Fixes #

Other notes for reviewers:

For testing, I rely on change in test setup and manual testing.

Does this PR introduce a user-facing change?

No

Copy link

github-actions bot commented Feb 20, 2024

Test Results

     761 files  ±0       761 suites  ±0   1h 6m 29s ⏱️ + 1m 25s
12 552 tests ±0  12 319 ✔️ ±0  233 💤 ±0  0 ±0 
15 663 runs  ±0  15 412 ✔️ ±0  251 💤 ±0  0 ±0 

Results for commit f68b9ae. ± Comparison against base commit 6a0065a.

♻️ This comment has been updated with latest results.

@abhishoya-gs abhishoya-gs force-pushed the sdlcloader-fix branch 2 times, most recently from e2292c6 to a1c241c Compare March 12, 2024 14:56
@MauricioUyaguari
Copy link
Member

@abhishoya-gs
can we not change the model loader and add another type of PureModelContext.
I think @rafaelbey started something. see : #2446

@abhishoya-gs
Copy link
Contributor Author

@abhishoya-gs can we not change the model loader and add another type of PureModelContext. I think @rafaelbey started something. see : #2446

Okay sure, seems like a better approach

@abhishoya-gs abhishoya-gs changed the title Sdlc loader handle dependency override Introduce PureModelContextCollection type and use it in WorkspaceSDLCLoader Mar 13, 2024
{
return this.alloyLoader.getCacheKey(context);
PureModelContextCollection pureModelContextCollection = (PureModelContextCollection) context;
Assert.assertTrue(pureModelContextCollection.getContexts().stream().allMatch(pureModelContext -> pureModelContext instanceof PureModelContextPointer), () -> "Invalid type of PureModelContext in PureModelContextCollection for cacheKey");
Copy link
Contributor

Choose a reason for hiding this comment

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

This constrains defeats one of the main purposes of the collection I wanted to introduce - improve studio flow. For example - studio can manage a collection, where an entry is a PMCD of the current project, and the other entries are pointer to the project dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will remove this constraint so it will help improve studio flow. I will also change the constraint added on shouldCache but since we cache compiled model only for PureModelContextPointer, we won't gain much there in case of studio.

Also, I have placed another check in SDLCFetcher see here. It's required as my implementation only uses alloy loaders and thus only AlloySDLC. If there's a use case to support sourcing from multiple loaders the logic would have to be changed accordingly.

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.

None yet

3 participants