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

Refactor codebase for robustness #947

Closed
9 of 43 tasks
0xGabi opened this issue Nov 21, 2019 · 2 comments
Closed
9 of 43 tasks

Refactor codebase for robustness #947

0xGabi opened this issue Nov 21, 2019 · 2 comments

Comments

@0xGabi
Copy link
Contributor

0xGabi commented Nov 21, 2019

🔮 Planning

  1. Follow @0x6431346e's proposal on how to add integration tests and aim for 50-60% of coverage by the end of the refactor. Focusing on the /lib folder, the logic.

  2. Implement common mocks and patterns (e.g. progressHandler).

  3. Move code logic away from the wrapper unless it’s absolutely necessary.

Preliminary tasks

Diagram with current progress: here

  • Blue: DONE
  • Yellow: TODO
  • Red: WIP

Review and merge

Finish WIP on

Refactor: second iteration

Pre-work discussions:

  • How to incorporate complex side effects into the /lib folder? These include:
    • installing, configuring and running binaries: ipfs, devchain
    • Usage of npm
    • File system manipulation
  • How to test these complex side effects?

Logic units that involved several commands

  • amp publish [ Dev: , Reviewers: ] WIP PR: Extracts logic from apm commands: publish command #906 (Includes plan for iteration 2)
  • run [ Dev: , Reviewers: ]
  • don't use process.exit [ Dev: , Reviewers: ] proposal issue Don't use process.exit() #948
  • dao commands utils [ Dev: , Reviewers: ]
  • execHandler [ Dev: , Reviewers: ]
  • Initialize utilities on middleware (ipfs, wrapper, apm and providers) and sanitize options [ Dev: , Reviewers: ]
  • extract shared logic from dao install / upgrade [ Dev: , Reviewers: ]

Add integration tests to the whole codebase

WIP integration tests #952

  • middlewares [ Dev: , Reviewers: ]
  • start [ Dev: @0xGabi, Reviewers: ? ]
  • apm [ Dev: , Reviewers: ]
  • deploy [ Dev: , Reviewers: ]
  • devchain [ Dev: , Reviewers: ]
  • ipfs [ Dev: , Reviewers: ]
  • dao [ Dev: , Reviewers: ]
  • token [ Dev: , Reviewers: ]
  • acl [ Dev: , Reviewers: ]
  • contracts [ Dev: , Reviewers: ]
  • extract-functions [ Dev: , Reviewers: ]

Conventions

  • global variables better than ctx
  • code in exports.task is merged into exports.handler to make it explicit that this task is not used by any other module
  • separate disk I/O, cli-specific errors and pure logic

Relevant team feedback

  • Write tests for acl.js
  • Write tests for solidity-extractor.js
  • Most of the apm refactors are similar, especially in how they begin, can something be abstracted from them?
  • Unify conversions from ens-registry to ensRegistryAddress in scripts and tests, or remove the need for the conversion altogether ) -> will be done on removing deprecated code PR
  • Improve how we handlelistrcontext variables: [issue]SDK: v7 aragonone/product#222 (comment)
  • Don’t mutate the Listr context to communicate data between commands. Use command-scoped variables or find a substitute for Listr
  • Tests have the same default values comment, they should all be /* Default values */

After refactoring

  • Move /lib to typescript. @dapplion have already been adding files that we can use first examples: here, here and here.
  • Add test on other parts of the codebase (e.g. utils)
  • Windows CI
  • CI for boilerplates, tutorials
  • Full logic code test coverage.
  • Implement analytics to know which commands are being used
  • Move to Mocha + Chai for a better test framework: (better parsing, error handling, diff display)
  • Flat commands and options objects (i.e. aragon dao token > aragon token, apm.ipfs > apm, ipfs)
  • Stop consuming Solidity code and instead consume compiled ASTs. Perhaps we can bake in the antlr parser from federicobond, but it was also a big topic in the past to move to truffle 5 because we could stop doing the parsing ourselves
  • Examples in CLI --help!
@0xGabi 0xGabi added the SDK v7 label Nov 21, 2019
@macor161
Copy link
Contributor

Great planning @0xGabi !

@0xGabi
Copy link
Contributor Author

0xGabi commented Jan 23, 2020

We can consider this completed with the efforts on v7 and #1169

@0xGabi 0xGabi closed this as completed Jan 23, 2020
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

No branches or pull requests

3 participants