-
Notifications
You must be signed in to change notification settings - Fork 1
feat(rust): Add uniform problem report type #140
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
Conversation
apskhem
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.
LGTM
|
I think that for such changes it is beneficial to see an actual usage to better judge the ergonomics of the API. Currently for me it isn't clear how to use it in typical scenarios. Also I'm not sure if the interior mutability is really needed here. I think that if we want to use it in a concurrent environment then it would be better to have some kind of merge functionality for reports instead of thread/tasks adding entries in an arbitrary order. |
|
This is the use case, expressed as a user story: "As a user, I want to see every single problem related to any on-chain transaction that I make, or any document that I try and submit to a decentralized system. I do not want to be forced to make multiple attempts to correct all my problems because I can only correct problems one at a time. I also want to know what is correct about the document/transactions i submit even if parts of them are problematic in some way." |
|
Here is how it will look like when implemented I think it look much more structure, the only downside is a bit time consume getting each field right |
|
The point about interior mutability is just so that we do not need to manually manage mutability across call boundaries, we can pass a report as a context, and it is always able to be updated. The point about concurrency, is so that the type is inherently Send and we have no issues passing around Reports after they are created, nor do we have issues with copies of the reports consuming large memory resources, because copies are shallow and cheap. It is not intended in this use case that they be updated concurrently, even though the chosen type does support it. Further, the order of the reports is not sensitive at all, so there would be no problem with using a parallel iterator (if required) and adding reports in an arbitrary order based on the paralelism. Although, again, there is no current requirement to do that, doing so would not cause any issues. |
|
The application in the code is to return these errors in endpoints, we already have such responses for CIP36 endpoints, although the new type will allow those responses to be more comprehensive and detailed than currently specified. |
* feat: initial commit * ci: register crate * feat(rust): Add uniform problem report type (#140) * feat(rust): Add uniform problem report type * fix(docs): spelling * fix(rust): catalyst-types ci build * fix(rust): doc tests * feat: hash and coversion * feat: uuid * refactor: rename * chore: fmtfix * chore: fmtfix again * test: integration * fix: uuid type * feat(rust/catalyst-types): Add duplicate data error report (#141) * feat(catalyst-types): add duplicate data error report Signed-off-by: bkioshn <bkioshn@gmail.com> * fix(catalyst-types): format Signed-off-by: bkioshn <bkioshn@gmail.com> * fix(catalyst-types): add duplicate field description and change name Signed-off-by: bkioshn <bkioshn@gmail.com> * Update rust/catalyst-types/src/problem_report.rs --------- Signed-off-by: bkioshn <bkioshn@gmail.com> Co-authored-by: Steven Johnson <stevenj@users.noreply.github.com> * chore: fmtfix * chore: rename module fixing lint * fix: module name * chore: lintfix rename * feat: kid * chore: fmtfix * feat: improve type errors * chore: fmtfix * fix: cspell * fix: error coverage * fix: lint * fix: test * fix: minor * feat: lintfix * fix: comment * fix: comment * chore: fmtfix * Update rust/catalyst-types/src/conversion.rs Co-authored-by: bkioshn <35752733+bkioshn@users.noreply.github.com> * docs: update * chore: kiduri * chore: displaydoc * fix: add displaydoc to .dic --------- Signed-off-by: bkioshn <bkioshn@gmail.com> Co-authored-by: Steven Johnson <stevenj@users.noreply.github.com> Co-authored-by: Steven Johnson <sakurainds@gmail.com> Co-authored-by: bkioshn <35752733+bkioshn@users.noreply.github.com>
Description
This adds a uniform type to hold comprehensive problem reports that can occur when processing certain data.
These are distinct from hard errors, and are intended to report comprehensive reports to the user about problems
detected while processing their data.
This is intended to replace the current mutable vec of strings used for such purposes.
As the intention of such report is primarily to report to end users over API's, the report can serialize to json for easy inclusion in HTTP API responses.
Please confirm the following checks