-
Notifications
You must be signed in to change notification settings - Fork 9
fix: temporarily make logger optional and move into createStorageCont… #267
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
fix: temporarily make logger optional and move into createStorageCont… #267
Conversation
SgtPooki
left a comment
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.
@entuziaz I don't think we need to go this far with preventing breaking changes at this point since we're still in alpha. Let's go ahead and migrate it fully and ensure that anywhere we call it is up to date.
|
@SgtPooki Okay, I understand. Thank you. |
|
@SgtPooki I got failures in validate-ipni-advertisement tests that seem unrelated to the createStorageContext change (e.g. lastActualMultiaddrs.intersection is not a function). Should I look into the failing tests and see if I could fix them, or should I keep this PR focused on the logger-options issue at hand? |
|
@entuziaz |
This is interesting! Yeah, I had downgraded to Node.js v20 just a day ago when I pulled upstream updates, and my |
|
@entuziaz it looks like the code in |
Yeah, I didn't catch it from running |
SgtPooki
left a comment
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.
a few minor changes still required.. thanks for your patience here
|
@SgtPooki, kindly check the updates. |
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.
Pull request overview
This PR refactors the createStorageContext function to make the logger parameter optional by moving it from a required positional argument to an optional property within the CreateStorageContextOptions object. This change improves API flexibility and consistency.
Key Changes:
- Moved logger from second positional parameter to optional field in options object
- Updated all function calls throughout the codebase to use the new signature
- Added optional chaining for all logger method calls to handle undefined logger gracefully
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/core/synapse/index.ts | Updated CreateStorageContextOptions interface to include optional logger field; modified createStorageContext function signature and implementation to use optional chaining for logger calls |
| src/import/import.ts | Updated createStorageContext call to pass logger as part of options object; changed type annotation from Parameters<typeof createStorageContext>[2] to CreateStorageContextOptions |
| src/add/add.ts | Updated createStorageContext call to pass logger as part of options object; changed type annotation to use CreateStorageContextOptions |
| upload-action/src/filecoin.js | Updated createStorageContext call to include logger in the options object |
| src/test/unit/import.test.ts | Updated test expectations to verify logger is passed as part of options object rather than as separate parameter |
| src/test/unit/add.test.ts | Updated test expectations to match new function signature with logger in options |
| src/test/unit/dataset-management.test.ts | Updated all test calls to createStorageContext to pass logger as part of options object |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Fixes #252
This PR updates createStorageContext so logger is no longer a required positional argument and is now an optional field on CreateStorageContextOptions. This implementation still supports the previous structure internally to avoid breaking changes.
Formerly:
Updated:
On Breaking Change: Internal callers and tests have been updated accordingly.