-
Notifications
You must be signed in to change notification settings - Fork 116
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
Addng WriteInstance into LocalInstance inheritance hierarchy #3325
Addng WriteInstance into LocalInstance inheritance hierarchy #3325
Conversation
Some side notes (not necessarily need be addressed in this PR):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AMAZING! This is one of the most exciting contributions from a casual contributor that I've seen. Just a few minor comments and updated test plan recommendation:
on second thought, the new storage methods are experimental and we can rigorously test them later. The really important manual testing to do is regression testing for local instance. Here are the steps:
- Clone sourcecred/cred and checkout the gh-pages branch.
- yarn build in sourcecred/sourcecred
- scdev credrank in sourcecred/cred and verify no errors
if you haven't set up the scdev alias, it represents node /Users/thena/workspace/sourcecred/packages/sourcecred/bin/sourcecred.js
Co-authored-by: Thena Seer <seerthena@gmail.com>
@@ -14,6 +14,12 @@ const api: any = {...cloneDeep(base)}; | |||
import {LocalInstance} from "../../api/instance/localInstance"; | |||
api.instance.LocalInstance = LocalInstance; | |||
|
|||
import {getOriginWriteInstance} from "../../api/instance/writeInstance"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added factory methods here because when I tried to register writeInstance module in packages/sourcecred/src/api/lib/base.js
, the build was failing with
sourcecred: [webpack-cli] ModuleNotFoundError: Module not found: Error: Can't resolve 'fs' in '/storage/projects/sourcecred/sourcecred-sources/node_modules/better-sqlite3/lib'
sourcecred: at /storage/projects/sourcecred/sourcecred-sources/node_modules/webpack/lib/Compilation.js:925:10
sourcecred: at /storage/projects/sourcecred/sourcecred-sources/node_modules/webpack/lib/NormalModuleFactory.js:401:22
sourcecred: at /storage/projects/sourcecred/sourcecred-sources/node_modules/webpack/lib/NormalModuleFactory.js:130:21
sourcecred: at /storage/projects/sourcecred/sourcecred-sources/node_modules/webpack/lib/NormalModuleFactory.js:224:22
sourcecred: at /storage/projects/sourcecred/sourcecred-sources/node_modules/neo-async/async.js:2830:7
sourcecred: at /storage/projects/sourcecred/sourcecred-sources/node_modules/neo-async/async.js:6877:13
sourcecred: at /storage/projects/sourcecred/sourcecred-sources/node_modules/webpack/lib/NormalModuleFactory.js:214:25
sourcecred: at /storage/projects/sourcecred/sourcecred-sources/node_modules/enhanced-resolve/lib/Resolver.js:213:14
sourcecred: at /storage/projects/sourcecred/sourcecred-sources/node_modules/enhanced-resolve/lib/Resolver.js:285:5
sourcecred: at eval (eval at create (/storage/projects/sourcecred/sourcecred-sources/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
sourcecred: at /storage/projects/sourcecred/sourcecred-sources/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
sourcecred: at /storage/projects/sourcecred/sourcecred-sources/node_modules/enhanced-resolve/lib/Resolver.js:285:5
sourcecred: at eval (eval at create (/storage/projects/sourcecred/sourcecred-sources/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
sourcecred: at /storage/projects/sourcecred/sourcecred-sources/node_modules/enhanced-resolve/lib/Resolver.js:285:5
sourcecred: at eval (eval at create (/storage/projects/sourcecred/sourcecred-sources/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
sourcecred: at /storage/projects/sourcecred/sourcecred-sources/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
sourcecred: resolve 'fs' in '/storage/projects/sourcecred/sourcecred-sources/node_modules/better-sqlite3/lib'
sourcecred: Parsed request is a module
sourcecred: using description file: /storage/projects/sourcecred/sourcecred-sources/node_modules/better-sqlite3/package.json (relative path: ./lib)
sourcecred: Field 'browser' doesn't contain a valid alias configuration
sourcecred: resolve as module
sourcecred: /storage/projects/sourcecred/sourcecred-sources/node_modules/better-sqlite3/lib/node_modules doesn't exist or is not a directory
sourcecred: /storage/projects/sourcecred/sourcecred-sources/node_modules/node_modules doesn't exist or is not a directory
sourcecred: /storage/projects/sourcecred/node_modules doesn't exist or is not a directory
sourcecred: /storage/projects/node_modules doesn't exist or is not a directory
sourcecred: /storage/node_modules doesn't exist or is not a directory
sourcecred: /node_modules doesn't exist or is not a directory
...
presumably because of specificity in the webpack.config.api.js
configuration for base.js
. Unsure if that is right or wrong, just noting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see other comment for solution. it is important that write instance is imported into base.js
The manual testing is done, the output of the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I wrote these comments and then forget to hit send!
// Private Functions | ||
////////////////////////////// | ||
|
||
async readInstanceConfig(): Promise<InstanceConfig> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the method blocking this file from being used in lib/base.js and here is the solution:
- move readInstanceConfig and imports from "../instanceConfig" to LocalInstance
- move the implementations of readContributionsInput and readGraphInput to the LocalInstance
- stub readContributionsInput and readGraphInput in WriteInstance with
throw new Error("not implemented")
@@ -14,6 +14,12 @@ const api: any = {...cloneDeep(base)}; | |||
import {LocalInstance} from "../../api/instance/localInstance"; | |||
api.instance.LocalInstance = LocalInstance; | |||
|
|||
import {getOriginWriteInstance} from "../../api/instance/writeInstance"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see other comment for solution. it is important that write instance is imported into base.js
…Instance-extends-readInstance
This reverts commit a244396.
Applied solution, just one question:
Do we need this step given that |
Ah good point! No, they wouldn't need stubbed again then. |
@blueridger is anything else needed to be done here? |
Great work, this is so exciting! |
Description
This PR implements #2991.
Test Plan