-
Notifications
You must be signed in to change notification settings - Fork 2
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: custom context #29
feat: custom context #29
Conversation
Apply Sweep Rules to your PR?
|
src/types/context.ts
Outdated
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.
Are you sure this is sufficient to solve the business problem? It doesn't look like it.
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.
Why not?
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 expected it to be a lot more involved with some type of array or object with getters and setters.
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 can change it a class with helper functions like getOctokit, getPayload, getEvent, getConfig but other than that I don't see what else could be added
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.
Its fine. Can you fix the build errors
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.
two build errors in processors.ts
are from your code so I'm not sure why it's not working and one error is from wallet.test.ts
because now it needs a mocked context but I don't think that test is even needed, should I just remove it?
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 think we should keep all the tests. It seems like a waste to write tests and then delete instead of fixing them when new code is introduced. Please address those and I'll merge it in.
Also please feel free to refer to my latest for fixes etc which currently is at https://github.com/pavlovcik/ubiquibot/tree/refactor/permit-generation
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 just realized that adapters will have to be moved into context aswell, because some tables like logs and wallet use the context, and having adapters in runtime will mean they will override on each request.
There are two choices:
- change adapters' functions to accept additional parameter
context
so they can stay as global runtime - move adapters to context
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.
@pavlovcik what do you think?
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.
Hard to say cause I dont think I understand the tradeoff well enough.
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.
There's some build errors and questions.
This implements custom context type which includes event context and bot config.
@pavlovcik