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

Update InstallAppRequest type to new format #298

Merged
merged 6 commits into from
Nov 28, 2024
Merged

Conversation

matthme
Copy link
Contributor

@matthme matthme commented Nov 25, 2024

This PR contains the type changes required in order to adhere to holochain/holochain#4416 and its follow-up PR holochain/holochain#4488

@matthme matthme requested a review from a team November 25, 2024 15:13
Copy link
Contributor

@jost-s jost-s left a comment

Choose a reason for hiding this comment

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

Please add a test or modify an existing one that uses roles_settings.

@matthme
Copy link
Contributor Author

matthme commented Nov 25, 2024

I'm confused - why do the tests even pass? Are the tests not actually ran in CI?

@jost-s
Copy link
Contributor

jost-s commented Nov 25, 2024

The tests pass because memproofs is just ignored and roles_settings is optional.

@matthme
Copy link
Contributor Author

matthme commented Nov 26, 2024

Test added.

@matthme matthme requested a review from jost-s November 26, 2024 15:14
@matthme
Copy link
Contributor Author

matthme commented Nov 26, 2024

Hmm...actually the problem that Uint8Arrays don't deserialize to YamlProperties is a problem. This means that you can't even pass in agent public keys there unless you base64 encode them or conver them to an Array<number>.

membrane_proof: new Uint8Array(6),
modifiers: {
network_seed: "hello",
properties: yaml.dump({ progenitor: progenitorKey }),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the test now to use a yaml string.
cc @ThetaSinner

@matthme
Copy link
Contributor Author

matthme commented Nov 26, 2024

Okay never mind. I think this is totally appropriate and the app developer can be expected to take care of any required conversion for example using js-yaml (we just need to make sure that the js-client actually returns a useful error which is not currently the case #299).

Copy link
Contributor

@jost-s jost-s left a comment

Choose a reason for hiding this comment

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

LGTM
a suggestion for the yaml properties type and some cleanup

package.json Outdated
@@ -48,13 +48,15 @@
"isomorphic-ws": "^5.0.0",
"js-base64": "^3.7.5",
"js-sha512": "^0.9.0",
"js-yaml": "4.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be a dev dependency too.

* @public
* Any value that is serializable to a Yaml value
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this needed here? It should only produce a warning.
Actually unknown would be the idiomatic type.

@@ -117,7 +117,7 @@ export const installAppAndDna = async (
installed_app_id,
agent_key: agent,
path,
membrane_proofs: {},
roles_settings: {},
Copy link
Contributor

@jost-s jost-s Nov 26, 2024

Choose a reason for hiding this comment

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

roles_settings is optional

Suggested change
roles_settings: {},

Copy link
Contributor

Choose a reason for hiding this comment

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

Delete me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@@ -159,7 +159,7 @@ export const createAppWsAndInstallApp = async (
installed_app_id,
agent_key: agent,
path,
membrane_proofs: {},
roles_settings: {},
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
roles_settings: {},

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still here =)

Copy link
Contributor

Choose a reason for hiding this comment

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

And still here

@@ -85,7 +87,7 @@ test(
installed_app_id,
agent_key,
path: `${FIXTURE_PATH}/test.happ`,
membrane_proofs: {},
roles_settings: {},
Copy link
Contributor

Choose a reason for hiding this comment

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

and so on further down

Suggested change
roles_settings: {},

@@ -1046,7 +1119,7 @@ test(

const tag = "test_tag";
const link: Link = await client.callZome({
cap_secret: null,
cap_secret: undefined,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
cap_secret: undefined,

…pubkey to Uint8Array to have deepEqual work properly
@matthme
Copy link
Contributor Author

matthme commented Nov 26, 2024

Thank you! Addressed all of these now.

@matthme matthme requested a review from jost-s November 26, 2024 22:40
Copy link
Contributor

@jost-s jost-s left a comment

Choose a reason for hiding this comment

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

Just a few more bits

Cargo.toml Outdated
@@ -7,4 +7,4 @@ resolver = "2"
opt-level = "z"

[workspace.dependencies]
hdk = "0.5.0-dev.0"
hdk = "0.5.0-dev.6"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is intentionally kept at .0 as long as there are no breaking changes in the HDK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright!

@@ -159,7 +159,7 @@ export const createAppWsAndInstallApp = async (
installed_app_id,
agent_key: agent,
path,
membrane_proofs: {},
roles_settings: {},
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still here =)

@matthme
Copy link
Contributor Author

matthme commented Nov 28, 2024

search and replace for the win.

@matthme matthme requested a review from jost-s November 28, 2024 17:06
@@ -159,7 +159,7 @@ export const createAppWsAndInstallApp = async (
installed_app_id,
agent_key: agent,
path,
membrane_proofs: {},
roles_settings: {},
Copy link
Contributor

Choose a reason for hiding this comment

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

And still here

@@ -117,7 +117,7 @@ export const installAppAndDna = async (
installed_app_id,
agent_key: agent,
path,
membrane_proofs: {},
roles_settings: {},
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete me

@matthme matthme merged commit 43d5e9e into main Nov 28, 2024
10 checks passed
@matthme matthme deleted the new-install-app-payload branch November 28, 2024 19:48
matthme added a commit that referenced this pull request Nov 28, 2024
* update InstallAppRequest type to new format

* add new YamlProperties type and test that installs app with roles_settings set

* use js-yaml in test

* remove unnecessary fields, remove js-yaml from dependencies, convert pubkey to Uint8Array to have deepEqual work properly

* more redundant membrane_proof fields, revert hdk bump

* removed unused roles_settings fields
matthme added a commit that referenced this pull request Nov 29, 2024
* Update InstallAppRequest type to new format (#298)

* update InstallAppRequest type to new format

* add new YamlProperties type and test that installs app with roles_settings set

* use js-yaml in test

* remove unnecessary fields, remove js-yaml from dependencies, convert pubkey to Uint8Array to have deepEqual work properly

* more redundant membrane_proof fields, revert hdk bump

* removed unused roles_settings fields

* rebuild docs

* removed .only to have all tests run

* bump hdk verison, fix hc sandbox args and log errors, update flake

* test: fix expected number of cells due to dpki being removed

* revert hdk bump

---------

Co-authored-by: Jost Schulte <jost-s@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants