-
Notifications
You must be signed in to change notification settings - Fork 4
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
Allow vault efs
resource acquisition to operate on multiple vaults in parallel
#847
Conversation
The tasks in this PR have been completed except for deciding upon a proper fix for the RPC wrapper type. For now, I have written a custom type which adds metadata field while allowing for better type narrowing. (see #847 (comment)). However, this is a temporary fix and not final. I will need to have a discussion if there are any obvious caveats or things I am missing. Once that is no longer an issue, either the type update can be made local to Polykey (not recommended), or made available globally to |
If the RPC type problem is just a usage problem for now then just deal with it using the |
I believe we discussed why this issue can't be resolved by usage of the |
I ran a bunch of tests to see if there was a difference between the new type and the old type. // Original type currently in RPC
type ParamsTypeA<
T extends JSONObject = JSONObject,
M extends JSONObject = JSONObject,
> = {
metadata?: JSONObject &
RPCMetadata &
Omit<T["metadata"] & M, keyof RPCMetadata>;
} & Omit<T, "metadata">;
// My type updated type which works on complex types
type ParamsTypeB<
T extends JSONObject = JSONObject,
M extends JSONObject = JSONObject,
> = T & {
metadata?: RPCMetadata &
M &
(T extends { metadata: infer U } ? U : JSONObject);
};
// Types being tested
type NoMetadata = {
text1: string;
text2: number;
};
type NonConflictingMetadata = {
text1: boolean;
metadata: {
available: boolean;
};
};
type ConflictingMetadataDifferentType = {
text1: number;
metadata: {
authorization: number;
};
};
type ConflictingMetadataSameType = {
text1: number;
metadata: {
authorization: string;
};
};
type TA = {
type: true;
field: string;
};
type TB = {
type: false;
value: number;
};
type CombinedType = TA | TB;
// Actual tests
// UsingTypeA is old type currently in RPC
// UsingTypeB is new type I'm working on for this PR
let a1: UsingTypeA<NoMetadata> = { text1: "123", text2: 456 };
let a2: UsingTypeB<NoMetadata> = { text1: "123", text2: 456 };
let b1: UsingTypeA<NonConflictingMetadata> = {
text1: true,
metadata: { available: true },
};
let b2: UsingTypeB<NonConflictingMetadata> = {
text1: true,
metadata: { available: true },
};
let c1: UsingTypeA<ConflictingMetadataDifferentType> = {
text1: 1,
metadata: { authorization: "bearer" }, // Type string is not assignable to never
};
let c2: UsingTypeB<ConflictingMetadataDifferentType> = {
text1: 1,
metadata: { authorization: "bearer" }, // Type string is not assignable to never
};
let d1: UsingTypeA<ConflictingMetadataSameType> = {
text1: 1,
metadata: { authorization: "bearer" },
};
let d2: UsingTypeB<ConflictingMetadataSameType> = {
text1: 1,
metadata: { authorization: "bearer" },
};
let e11: UsingTypeA<CombinedType> = { type: true, field: "123" }; // Fails because type narrowing fails
let e12: UsingTypeA<CombinedType> = { type: false, value: 123 }; // Fails because type narrowing fails
let e21: UsingTypeB<CombinedType> = { type: true, field: "123" };
let e22: UsingTypeB<CombinedType> = { type: false, value: 123 }; The results of all the tests are the same (ie, This is the full test file for reference |
I ran a local update on Side note, however, is that Brian's IDE doesn't use the simple TS compiler for warnings/errors. As such, some errors are able to fall through. These errors also don't block the building, so the package is built and run just fine, but the errors does exist.
When I open the relevant files, I do see the errors just fine. This can be replicated on both Neovim and VS Code. We might need another step in our development scripts which runs |
8a1a50c
to
bece592
Compare
Oh shoot, I completely forgot |
Why doesn't it? Get it sorted! |
The CI isn't working properly yet, as some tests were failing, so they were commented out. This needs to be resolved on high priority. Moreover, the CI isn't automatically publishing a release. This needs to be investigated, @brynblack. |
a7a16d2
to
2f0c2be
Compare
chore: removed local update to JSONRPCResponseResult
2f0c2be
to
1a8f920
Compare
fix: expand header message out of the function fix: input can be a AsyncIterableIterator
1a8f920
to
6e322ce
Compare
Status of this? If @brynblack is not available, see if you can do the work to get it published. |
Well, the |
Description
For handlers like
VaultsSecretsCopy
andVaultsSecretsMove
, we need to acquire a transaction across multiple vaults. This allows for all the given operations to be completed in a single transaction, avoiding polluting the commit space.This PR creates such pattern, to acquire the resources from a vault dynamically in a way which works across multiple vaults at the same time.
Issues Fixed
VaultsSecretsRemove
incorrectly reorders directories to be removed #837 (FIX ENG-450)Tasks
VaultInternal.acquireRead
VaultInternal.acquireWrite
VaultsSecretsRemove
to use this instead of grouping paths by vault name.Final checklist