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

Beejones/updating npm packages #38

Merged
merged 45 commits into from
Jul 25, 2024
Merged

Conversation

beejones
Copy link
Contributor

@beejones beejones commented Jul 19, 2024

Update package.json packages. We want to fix the versions to we don't get surprises in case of updates.
Improve container image and streamline devcontainer and the ci dockerfile.
Fix pip install versions and fix the wheel error we we having
Merge beejones/cleanup3 into this PR which is about improving the code by leveraging strict typescript
Support arrays for JWT validation policies

Copy link
Contributor

@takuro-sato takuro-sato left a comment

Choose a reason for hiding this comment

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

Can you put more context please? There are lot of changes that the reason is unclear to me.
I put some example questions.

src/endpoints/keyEndpoint.ts Show resolved Hide resolved
tsconfig.json Outdated
@@ -11,6 +11,7 @@
"sourceMap": false,
"resolveJsonModule": true,
"types": ["@types/node"],
"strict": false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can't we use strict:true ?

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 am currently running the CI with strict: true. I did this experiment because of failing CI's in ACI. After this last run we can merge this version and we can remove the install of rollup from privacy-sandbox-dev

Copy link
Contributor

@takuro-sato takuro-sato Jul 23, 2024

Choose a reason for hiding this comment

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

What is the reason that we have two devcontainer.json?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

one for CI and one for the devcontainer. Are you saying we can have one for both?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. I just didn't know about devcontainers/[email protected].

Are you saying we can have one for both?

I guess it's preferable, but what's your view on that? At least I don't think we need to address it within this PR.

package.json Outdated Show resolved Hide resolved
// committed_tcb
// committed_tcbx`
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this change for?

Copy link
Contributor Author

@beejones beejones Jul 24, 2024

Choose a reason for hiding this comment

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

no idea how this happened. Will fix this

Comment on lines 14 to 15
pip install wheel
pip install -U -r ./requirements.txt
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can't we install wheel in requirements.txt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good question. I used to only have it in requirements and it generated an error. This solves the error.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why does it solve the problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting. After fixing the versions of the packages, the error is gone and there is no more need to install wheel first. This must have been a conflict between installed packages

@@ -45,7 +45,7 @@ export class LastestItemStore<K extends number, T> {
}

public receipt(id: K) {
const version = this.store.getVersionOfPreviousWrite(id);
const version = this.store.getVersionOfPreviousWrite(id) || 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it really OK to set version=0?
I feel like we should return "not found" instead, but not sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a test for undefined

let caller: ccfapp.AuthnIdentityCommon;
): [
ccfapp.AuthnIdentityCommon | undefined,
ServiceResult<string> | undefined,
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we always return ServiceResult<string>? I think we want validator.validate(request) without ? after confirming validator is not null/undefined.

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 added a failed result so undefined is never returned.

src/endpoints/KeyWrapper.ts Show resolved Hide resolved
const policy = JwtValidationPolicyMap.read(issuer);
const policy = JwtValidationPolicyMap.read(issuer) || {};
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we return "issuer is not registered" error rather than using empty policy?
I guess I'm missing something, but I feel like there would be no check if issuer doesn't exist in JwtValidationPolicyMap?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good suggestion

@takuro-sato
Copy link
Contributor

Why do we need 2fe6bdf within this PR?

@beejones
Copy link
Contributor Author

Why do we need 2fe6bdf within this PR?

I believed we needed it because I saw JWT failures in the container log. That's why I added it. We need this change anyway so lets keep it

Copy link
Contributor

@takuro-sato takuro-sato left a comment

Choose a reason for hiding this comment

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

We have a TODO #40, but the code looks good to me.

@beejones beejones merged commit 4754907 into main Jul 25, 2024
5 checks passed
@beejones beejones deleted the beejones/updating-npm-packages branch July 25, 2024 13:34
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