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

feat(agoric-cli): allow NPM-based agoric install to work with dapps #4236

Merged
merged 13 commits into from
Jan 6, 2022

Conversation

michaelfig
Copy link
Member

@michaelfig michaelfig commented Jan 2, 2022

closes: #3857 closes: #4169 closes: #4170

Description

With these changes, the agoric NPM package can function without the rest of the SDK installed.

Many thanks to @mhofman for enumerating several of the problems that the prior version had, and suggesting Verdaccio for integration-testing the results.

  • repurpose agoric start --docker-tag=XXX to turn on Docker mode instead of --no-sdk, which is different.
  • build @agoric/xsnap binaries before testing (with agoric start --rebuild), as they are not distributed on NPM
  • several fixes to package.json files to distribute necessary things
  • integration test uses Verdaccio to test installing from a local NPM registry
  • when upgrading a Dapp, ensure that the required agoric start packages (@agoric/cosmic-swingset, @agoric/solo) are listed in ./package.json

Security Considerations

Documentation Considerations

After we gain some confidence in this setup, we could recommend using npx agoric instead of having to install the full SDK just to test a dapp.

Testing Considerations

Integration test added using Verdaccio.

@michaelfig michaelfig self-assigned this Jan 2, 2022
@michaelfig michaelfig force-pushed the mfig-agoric-cli-fixes branch 9 times, most recently from c3e2b3b to 97eee8a Compare January 3, 2022 05:22
@michaelfig michaelfig changed the title feat(agoric-cli): allow non-SDK agoric-cli to install packages in dapps feat(agoric-cli): allow non-SDK agoric install to work with dapps Jan 3, 2022
@michaelfig michaelfig changed the title feat(agoric-cli): allow non-SDK agoric install to work with dapps feat(agoric-cli): allow NPM-based agoric install to work with dapps Jan 3, 2022
Copy link
Member

@mhofman mhofman left a comment

Choose a reason for hiding this comment

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

This looks great. I need to try this locally! Also wondering if I'd be able to run the loadgen with these changes without having the SDK installed locally, which would be neat.

I just have some small nits about child process exitCodes and a duplication of yarn workspace logic in the cli.

I think we'll need a follow-up to make the xsnap package more node-like (either building from embedded source, or pulling a binary from GitHub). Or maybe we can punt on that until xsnap moves under endo.

packages/agoric-cli/scripts/get-sdk-package-names.js Outdated Show resolved Hide resolved
packages/agoric-cli/scripts/get-sdk-package-names.js Outdated Show resolved Hide resolved
packages/agoric-cli/src/install.js Outdated Show resolved Hide resolved
packages/agoric-cli/src/install.js Show resolved Hide resolved
.github/workflows/integration.yml Show resolved Hide resolved
packages/agoric-cli/src/start.js Outdated Show resolved Hide resolved
packages/agoric-cli/src/start.js Outdated Show resolved Hide resolved
packages/agoric-cli/src/start.js Outdated Show resolved Hide resolved
packages/agoric-cli/src/start.js Outdated Show resolved Hide resolved
packages/xsnap/package.json Show resolved Hide resolved
@mhofman
Copy link
Member

mhofman commented Jan 4, 2022

Also, is the goal to still require agoric install for dapps, even when using a non local sdk?

If we removed the AGORIC_INSTALL preinstall check, I think it should even work from my reading of the code with a dapp which has agoric installed only as a dependency (no global install of the cli).

@michaelfig
Copy link
Member Author

Also wondering if I'd be able to run the loadgen with these changes without having the SDK installed locally, which would be neat.

That would be possible as one particular mode (like "run npx agoric install beta, then loadgen against it"), but as you know, only certain SDK revisions will actually support that. Hopefully, all of them going forward.

Is the goal to still require agoric install for dapps, even when using a non local SDK?

The goal is to allow dapps to get by just with yarn (for now, maybe eventually other package managers). agoric install is for when you want to test against different SDKs (possibly unpublished) or upgrade your dapp's SDK dependencies, and that should be all.

If we removed the AGORIC_INSTALL preinstall check, I think it should even work from my reading of the code with a dapp which has agoric installed only as a dependency (no global install of the cli).

Yes, the preinstall check was just temporary until we could sort this process out.

@michaelfig
Copy link
Member Author

I think we'll need a follow-up to make the xsnap package more node-like (either building from embedded source, or pulling a binary from GitHub). Or maybe we can punt on that until xsnap moves under endo.

Yeah, that's a bit of a can of worms, especially now that some package managers are moving away from implicit preinstall scripts. I agree that we can wait to improve this later.

Copy link
Member

@mhofman mhofman left a comment

Choose a reason for hiding this comment

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

Feedback on process: it was hard for me to figure out what had changed since my first review because the updates were squashed into the initial commits. Making it harder, the PR was rebased on the latest master.

While I agree it's cleaner to fixup commits addressing feedback before merging, it'd be easier for reviewing if that was done after final approval so that reviews can be incremental. In that case rebasing wouldn't matter as much (aka I'd trust the rebase didn't introduce changes to the already reviewed commits).

packages/agoric-cli/scripts/get-sdk-package-names.js Outdated Show resolved Hide resolved
packages/agoric-cli/src/install.js Show resolved Hide resolved
@michaelfig
Copy link
Member Author

Feedback on process: it was hard for me to figure out what had changed since my first review because the updates were squashed into the initial commits. Making it harder, the PR was rebased on the latest master.

I think we need to have an engg process discussion to decide how to navigate through the different requirements for PR reviewers. Ideally, that would result in a flowchart for how to publish changes to PRs, so I don't have to think as much. :)

Copy link
Member

@mhofman mhofman left a comment

Choose a reason for hiding this comment

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

As soon as this is merged, I'll give it a try straight from NPM :)

@michaelfig michaelfig added agoric-cli package: agoric-cli automerge:no-update (expert!) Automatically merge without updates labels Jan 6, 2022
@mergify mergify bot merged commit c89503e into master Jan 6, 2022
@mergify mergify bot deleted the mfig-agoric-cli-fixes branch January 6, 2022 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agoric-cli package: agoric-cli automerge:no-update (expert!) Automatically merge without updates
Projects
None yet
2 participants