-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add new endpoint to runtime-rest-clime: Get Status Endpoint #150
Conversation
WalkthroughThe codebase has been updated to improve the handling of nullable values, with a shift towards using Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit's AI:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 2
Configuration used: CodeRabbit UI
Files selected for processing (6)
- packages/adapter/src/io-ts.ts (2 hunks)
- packages/runtime/client/rest/src/contract/details.ts (3 hunks)
- packages/runtime/client/rest/src/contract/endpoints/singleton.ts (2 hunks)
- packages/runtime/client/rest/src/index.ts (2 hunks)
- packages/runtime/client/rest/test/endpoints/contracts.spec.e2e.ts (2 hunks)
- packages/runtime/client/rest/test/endpoints/payouts.spec.e2e.ts (1 hunks)
Files skipped from review due to trivial changes (1)
- packages/runtime/client/rest/test/endpoints/payouts.spec.e2e.ts
Additional comments: 5
packages/runtime/client/rest/test/endpoints/contracts.spec.e2e.ts (1)
- 13-14: The updated test description is more accurate and reflects the test's intent.
packages/adapter/src/io-ts.ts (1)
- 64-77: The
convertNullableToUndefined
function is a well-designed utility that enhances the handling of nullable values in codecs.packages/runtime/client/rest/src/contract/details.ts (1)
- 99-105: The changes to
ContractDetailsGuard
useconvertNullableToUndefined
to handle nullable fields. Ensure that these changes have been tested, or consider updating existing tests to cover the new logic.packages/runtime/client/rest/src/index.ts (2)
286-290: The refactoring of
getContractById
to use the newContract.getContractById
method is consistent with the PR objectives and the AI-generated summary. This change should streamline the process of getting contract details by ID and improve error handling with the new method's implementation.587-590: The update to the
contracts.contract.get
method in themkFPTSRestClient
function to useTE.fromTask
and the newContract.getContractById
method is a good change. It aligns with the PR objectives to handle nullable fields and improve deserialization. This change also encapsulates the asynchronous nature of the operation, which is more idiomatic in functional programming withfp-ts
.
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.
Review Status
Actionable comments generated: 6
Configuration used: CodeRabbit UI
Files ignored due to filter (1)
- packages/runtime/client/rest/typedoc.json
Files selected for processing (12)
- changelog.d/20240103_085440_nicolas.henin_runtimeStatus.md (1 hunks)
- packages/adapter/src/http.ts (1 hunks)
- packages/adapter/src/index.ts (1 hunks)
- packages/runtime/client/rest/src/guards.ts (1 hunks)
- packages/runtime/client/rest/src/index.ts (5 hunks)
- packages/runtime/client/rest/src/runtime/index.ts (1 hunks)
- packages/runtime/client/rest/src/runtime/status.ts (1 hunks)
- packages/runtime/client/rest/test/endpoints/runtime.spec.e2e.ts (1 hunks)
- packages/runtime/core/src/index.ts (1 hunks)
- packages/runtime/core/src/network.ts (1 hunks)
- packages/runtime/lifecycle/test/context.ts (1 hunks)
- packages/wallet/src/nodejs/index.ts (4 hunks)
Files skipped from review due to trivial changes (3)
- packages/adapter/src/index.ts
- packages/runtime/client/rest/src/guards.ts
- packages/runtime/client/rest/src/runtime/index.ts
Additional comments: 7
changelog.d/20240103_085440_nicolas.henin_runtimeStatus.md (1)
- 1-3: The changelog correctly documents the addition of the
GetRuntimeStatus
endpoint. Ensure that the format aligns with the project's changelog standards.packages/runtime/core/src/index.ts (1)
- 12-12: The export statement for "network.js" is added correctly. Verify that there are no naming conflicts or issues with the exported entities from "network.js".
packages/runtime/client/rest/src/index.ts (5)
43-43: Added import for
RuntimeStatus
andgetRuntimeStatus
function.67-70: Added
getRuntimeStatus
method to theRestClient
interface.279-280: Implemented
getRuntimeStatus
in themkRestClient
function.296-296: Modified implementation of
getContractById
method.596-598: Refactored
contracts.contract.get
method inmkFPTSRestClient
to use a new implementation.
packages/runtime/client/rest/test/endpoints/runtime.spec.e2e.ts
Outdated
Show resolved
Hide resolved
t.partial({ | ||
currentContract: convertNullableToUndefined(G.Contract), | ||
state: convertNullableToUndefined(G.MarloweState), | ||
}), | ||
t.partial({ utxo: convertNullableToUndefined(TxOutRef) }), | ||
t.partial({ block: convertNullableToUndefined(BlockHeaderGuard) }), | ||
t.partial({ txBody: convertNullableToUndefined(TextEnvelopeGuard) }), |
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.
The guard was failing because it expected an undefined value when the data wasn't present, but the runtime is responding with null instead. This doesn't change the type of the response, it just makes sure that the guard works with the previous type.
@@ -0,0 +1,3 @@ | |||
### @marlowe.io/runtime-rest-client | |||
|
|||
- Added a new endpoint `GetRuntimeStatus` that retrieves informations about the Runtime (version deployed, Network Id of the Node and tips) |
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.
Please add this as part of healthcheck response instead of creating a new endpoint
As part of resolving issue #145 , the following 2 items were addressed
getContractById
was badly typed.