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

Hide power role for v3 apps #14813

Merged
merged 11 commits into from
Oct 17, 2024
Merged

Conversation

adrinr
Copy link
Collaborator

@adrinr adrinr commented Oct 17, 2024

Description

Don't show POWER role for apps >= 3.x. This required adding a createdVersion entry in the appmetadata, and to be able to run/test fine locally, we are updating the way we infer the current running version on dev, getting the value from lerna.json (until now everything was set as 0.0.0)

Launchcontrol

Do not show POWER role for apps >= 3.x

Copy link

linear bot commented Oct 17, 2024

Copy link

qa-wolf bot commented Oct 17, 2024

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

@adrinr adrinr changed the title Budi 8755 hide power role for v3 apps Hide power role for v3 apps Oct 17, 2024
@github-actions github-actions bot added firestorm Data/Infra/Revenue Team size/m labels Oct 17, 2024
@adrinr adrinr marked this pull request as ready for review October 17, 2024 11:30
@adrinr adrinr requested a review from a team as a code owner October 17, 2024 11:30
@adrinr adrinr requested review from mike12345567 and aptkingston and removed request for a team and mike12345567 October 17, 2024 11:30
Copy link
Member

@aptkingston aptkingston left a comment

Choose a reason for hiding this comment

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

LGTM!

Just curious, what was the motivation for the new creationVersion concept rather than adding a new flag? Was it so that we don't have to keep adding new flags going forward, since we can just reference version for everything? It's a nice change 👌

* @deprecated the plan is to get everything using `tryGet` instead, then rename
* `tryGet` to `get`.
*/
export async function get() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is an application layer to the SDK - would it not be better to add this there?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure if that is exactly the same. I was actually doubting where to put that. I understood that the current application is for the crud of the apps itself, but this is for the app metadata specific. Do you think it's best to merge both?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it probably makes sense to have metadata functions under the application, the CRUD of the application does fall under that part of the SDK, but the metadata is pretty much the only application document there is and I would default to looking for it under that part of the SDK.

@adrinr
Copy link
Collaborator Author

adrinr commented Oct 17, 2024

LGTM!

Just curious, what was the motivation for the new creationVersion concept rather than adding a new flag? Was it so that we don't have to keep adding new flags going forward, since we can just reference version for everything? It's a nice change 👌

Exactly. Having this new "creationVersion" will give us more flexibility. For example, it can be used in the future for certain migrations or similar, as we know when the app was created and what we don't need to support/migrate for that specific app

@@ -366,6 +383,18 @@ export async function getAllRoles(appId?: string): Promise<RoleDoc[]> {
}
}

async function shouldIncludePowerRole(db: Database) {
const app = await db.tryGet<App>(DocumentType.APP_METADATA)
const creationVersion = app?.creationVersion
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd be tempted to actually put this on the root Document type and call it _creationVersion, anticipating that we will likely introduce this idea onto other documents going forward.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, then in DatabaseImpl.post we know when a doc is new because it has no ID, we could slap _creationVersion onto it there. Though it is a wide-reaching change that likely has risk.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm unsure about this - I don't think we need this on every document, since every DB will have an app_metadata (it won't load without this/is corrupt) - in theory noting it here is enough since its a static document that is always easy to retrieve.

}
)

it.each(["2.9.0", "1.0.0"])(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd recommending including some of the other version strings we use, e.g. 0.0.0 (feature branches) and 2.32.17_2146.b125a7c (qa)

Copy link
Collaborator

@mike12345567 mike12345567 left a comment

Choose a reason for hiding this comment

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

LGTM - just giving pre-approval, I think it would be good to move the metadata SDK into the existing application, but that's just a preference, thing, I've went to that a couple times looking for it in the past!

@adrinr adrinr enabled auto-merge October 17, 2024 14:51
@adrinr adrinr merged commit d6d95c7 into master Oct 17, 2024
11 of 12 checks passed
@adrinr adrinr deleted the budi-8755-hide-power-role-for-v3-apps branch October 17, 2024 15:05
@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
firestorm Data/Infra/Revenue Team size/m
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants