Skip to content

Conversation

@hansl
Copy link
Contributor

@hansl hansl commented Sep 23, 2019

This is diff based onto PR #41, so commit 8f9b127 does not need to be reviewed.


feat: add public_spec library and Request Id serializer …
The public_spec library would be ideal to separate the CLI with parts that
can be reused if interacting with the public spec. Its also a good way to
formalize the public spec in Rust for us.

The serializer is a simple Serde serializer that errors for everything
except messages of supported types and forms (no recursive structures, etc).


refactor: use the public_spec exported types in api_client


TODO after this:

  • Move more things to the public spec (SDK-446) (not an AI for this PR)
  • Use the Request ID for request-status messages.
  • Manual testing that calls are made and requested status matches, once we can actually install canisters WASM that doesn't break.
  • Add nix support for lib/public_spec for at least running CI on it.

@hansl hansl requested a review from paulyoung September 23, 2019 04:35
@hansl hansl mentioned this pull request Sep 23, 2019
5 tasks
@hansl
Copy link
Contributor Author

hansl commented Sep 23, 2019

@paulyoung Let's sync tomorrow for solving the Nix issues. I think those should be fixed in my other PR then rebased here.

@nomeata
Copy link
Contributor

nomeata commented Sep 23, 2019

The public_spec library would be ideal to separate the CLI with parts that
can be reused if interacting with the public spec. Its also a good way to
formalize the public spec in Rust for us.

Nice idea. But I think “public_spec” is a bad name (are people starting to use “public spec” as a name, rather than a description). Maybe “ic-http-api”?

@hansl
Copy link
Contributor Author

hansl commented Sep 23, 2019

@nomeata What do you think about a more direct ic-http-client?

@paulyoung
Copy link
Contributor

Nice idea. But I think “public_spec” is a bad name (are people starting to use “public spec” as a name, rather than a description). Maybe “ic-http-api”?

I think renaming the document would help me to know how to refer to it

@paulyoung
Copy link
Contributor

@hansl said this is still WIP so I'm going to hold off on reviewing this for now

@nomeata
Copy link
Contributor

nomeata commented Sep 24, 2019

ic-http-client is great

Copy link
Contributor

@paulyoung paulyoung left a comment

Choose a reason for hiding this comment

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

I still recognize that this is WIP. Commenting so that the Pull Reminders bot will leave me alone :)

@hansl hansl force-pushed the hansl/message-id branch 3 times, most recently from 7b0de34 to 30e5960 Compare September 27, 2019 16:25
@hansl hansl requested a review from a team as a code owner September 29, 2019 05:30
@hansl
Copy link
Contributor Author

hansl commented Sep 30, 2019

I'm getting real close to a reviewable PR.

It was committed by mistake.
@hansl hansl force-pushed the hansl/message-id branch 2 times, most recently from 3c88565 to a10ea84 Compare October 1, 2019 01:41
@hansl
Copy link
Contributor Author

hansl commented Oct 1, 2019

@paulyoung Please review this PR. This is ready.

@hansl hansl requested a review from paulyoung October 1, 2019 01:42
@hansl
Copy link
Contributor Author

hansl commented Oct 1, 2019

@paulyoung This PR can be reviewed without the OSX build passing. I'm investigating it but the Linux one is, so the code is valid, it might just be Nix acting differently.

Copy link
Contributor

@matthewhammer matthewhammer left a comment

Choose a reason for hiding this comment

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

I am trying to help unblock @hansl

So, I am giving an approval here without high confidence or a deep review.

/// code samples (including this library). For now, we newtype it to abstract its usage
/// from a number, and will change its internal type when time comes.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CanisterId(Blob);
Copy link
Contributor

Choose a reason for hiding this comment

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

"Using Rust at DFINITY" mentions this crate: https://docs.rs/newtype_derive/0.1.6/newtype_derive/

It seems useful in general but not sure if it's worth adding in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't seem used anymore. Can't find any mention of custom_derive in the rust folder.

name = "${oldAttrs.name}-debug";
});
rust-workspace-doc = rust-workspace-debug.doc;
e2e-tests = super.callPackage ../e2e-tests.nix {};
Copy link
Contributor

Choose a reason for hiding this comment

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

These e2e tests are specific to dfx so I think they should be named that way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The goal here is to have global e2e tests, including frontend ones. So I'd say it's not scoped to dfx. Right now they are.

Copy link
Contributor

Choose a reason for hiding this comment

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

My point is that if I want to add end-to-end tests for the JS user library, I don't think they belong in this file

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 disagree in the sense that dfinity-sdk.packages.e2e-tests should cover all e2e tests.

I'm also not 100% sure what you mean here. Are you saying that nix/overlays/dfinity-sdk.nix should not have JavaScript things in it? I was working with the impression all packages should be defined here, and those used by whatever layers should be referenced from their directory, here. Essentially you would have a default.nix in the userlib/js/ folder (or wherever) that points to dfinity-sdk.packages.userlib.js. That's what I thought was the plan.

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 not saying that the SDK overlay shouldn't have JavaScript things in it. I'm saying that I anticipate end-to-end tests for dfx to be quite different to end-to-end tests for other parts of the SDK.

I think this is influenced by older ideas about what would be in the SDK (e.g. a "Try ActorScript in a browser" type tool I was working on) so happy to leave this as-is for now.

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 see. Yes, that makes a lot of sense. When it happens I'd split e2e-tests into multiple subpackages, and have e2e-tests be a set of those.

@hansl hansl force-pushed the hansl/message-id branch from 4f1444f to abf94f4 Compare October 1, 2019 22:58
@hansl
Copy link
Contributor Author

hansl commented Oct 1, 2019

@paulyoung Thanks a lot for the valuable feedback. Please take another look, I think I answered all your comments (sorry if I missed one).

@hansl hansl requested a review from paulyoung October 1, 2019 23:01
@hansl
Copy link
Contributor Author

hansl commented Oct 2, 2019

Does this mean we can drop the dev dependency?

Which dev dependency?

@paulyoung
Copy link
Contributor

Does this mean we can drop the dev dependency?

Which dev dependency?

I thought at one point rand was only added as a dev dependency but it must be used elsewhere too.

@hansl
Copy link
Contributor Author

hansl commented Oct 2, 2019

rand

It's used when generating a nonce.

@hansl
Copy link
Contributor Author

hansl commented Oct 2, 2019

@paulyoung Am I missing anything left on this PR?

@hansl hansl requested a review from paulyoung October 2, 2019 16:37
hansl added 6 commits October 2, 2019 10:44
It creates the types for RequestId (and serializes it), CanisterId
and Blob. Allows for serde serialization of all.
Also move every usage of RequestId, CanisterId and Blob to
ic-http-agent.
It handles request ID and other improvements.
With a few starter tests.
We should keep arguments (at least deps) sorted to facilitate
merges.

Also we should not depend on the -debug build of DFINITY. We should use
-debug for debug build, otherwise release build.
@hansl hansl force-pushed the hansl/message-id branch from 9c0b8e6 to f39b5e2 Compare October 2, 2019 17:46
@hansl
Copy link
Contributor Author

hansl commented Oct 2, 2019

Just rebased everything, forced push, waiting for CI then merging.

@hansl hansl merged commit dd01186 into master Oct 2, 2019
@hansl hansl deleted the hansl/message-id branch October 2, 2019 18:02
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.

4 participants