Skip to content
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

[DPP-701] Maybe missed error code conversions #11510

Conversation

pbatko-da
Copy link
Contributor

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description
  • If you mean to change the status of a component, please make sure you keep the Component Status page up to date.

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

@pbatko-da pbatko-da self-assigned this Nov 2, 2021
@@ -72,6 +72,7 @@ object ScenarioServiceMain extends App {

object ScenarioService {
private def notFoundContextError(id: Long): StatusRuntimeException =
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Language team

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Here and other places helpfully annotated with "Language team" by Tudor)

@remyhaemmerle-da We spotted these places that could need adapting to self service error codes (aka V2). Are you aware of these in the Language team (if there're legitimate)?

Copy link
Collaborator

@remyhaemmerle-da remyhaemmerle-da Nov 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scenarios will die completely in Daml 2.0, safe to ignore.

@@ -292,8 +293,10 @@ class ScenarioService(implicit

} catch {
case e: archive.Error =>
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Language team

Copy link
Collaborator

@remyhaemmerle-da remyhaemmerle-da Nov 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

respObs.onError(Status.INVALID_ARGUMENT.withDescription(e.msg).asRuntimeException())
case NonFatal(e) =>
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Language team

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

@@ -439,6 +439,7 @@ class JsonLedgerClient(
// TODO (MK) Using a grpc exception here doesn’t make that much sense.
// We should refactor this to provide something more general.
Future.successful(
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Language or runtime team?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefanobaghino-da @remyhaemmerle-da We spotted this place that could need adapting to self service error codes (aka V2). Are you aware of this in the Language or Runtime team (if it's legitimate)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Language or runtime team?

Language is responsible from this part of the script. @stefanobaghino-da you can ignore this one.

Copy link
Collaborator

@remyhaemmerle-da remyhaemmerle-da Nov 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can ignore this one.
cc @cocreature

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that’s fine, just keep it

@@ -191,6 +191,7 @@ class RejectionGenerators(conformanceMode: Boolean) {
// TODO error codes: This converter is deprecated and should be removed
// Instead of using this, construct proper validation errors in callers of this method
// and only convert to StatusRuntimeExceptions when dispatched (e.g. in ApiSubmissionService)
@deprecated("not used in daml sdk")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -78,6 +78,7 @@ class BatchedValidatingCommitter[LogResult](
Future.successful(SubmissionResult.Acknowledged)
case Failure(exception) =>
Future.successful(
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KV Committer team

@@ -121,13 +121,15 @@ case class DefaultBatchingQueue(
)
)
case f: QueueOfferResult.Failure =>
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KV committer team

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Here and other places helpfully annotated with "KV committer team" by Tudor)

@fabiotudone-da We spotted these places that could need adapting to self service error codes (aka V2). Are you aware of these in the Committer team (if there're legitimate)?

SubmissionResult.SynchronousError(
Status(
Code.INTERNAL.value,
f.toString,
)
)
case QueueOfferResult.QueueClosed =>
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KV committer team

@@ -65,13 +65,15 @@ class ValidatingCommitter[LogResult](
postCommit(value)
SubmissionResult.Acknowledged
case Left(MissingInputState(keys)) =>
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KV committer team

SubmissionResult.SynchronousError(
Status(
Code.INTERNAL.value,
s"Missing input state: ${keys.map(_.bytes.asScala.map("%02x".format(_)).mkString).mkString(", ")}",
)
)
case Left(ValidationError(reason)) =>
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KV committer team

@@ -44,6 +44,7 @@ class SandboxResetService(
serverCallHandler: ServerCallHandler[ReqT, RespT],
): Listener[ReqT] = {
if (resetInitialized.get) {
// TODO error codes: Adapt V2 ?
Copy link
Contributor

@tudor-da tudor-da Nov 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Participant team

@@ -71,6 +72,7 @@ class SandboxResetService(
logger.info("Initiating server reset.")

if (!resetInitialized.compareAndSet(false, true))
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Participant team

@@ -261,6 +261,7 @@ object ReadWriteServiceBridge {
)
case QueueOfferResult.Failure(throwable) =>
logger.error("Error enqueueing new submission.", throwable)
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Participant team

@@ -269,6 +270,7 @@ object ReadWriteServiceBridge {
)
case QueueOfferResult.QueueClosed =>
logger.error("Error enqueueing new submission: queue is closed.")
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Participant team

@@ -332,6 +332,7 @@ private[platform] object Conversions {
import RejectionReasonOps._

def toParticipantStateRejectionReason: state.Update.CommandRejected.RejectionReasonTemplate =
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Participant team: used in sandbox-classic

@@ -49,6 +49,7 @@ private[services] final class QueueBackedTracker(
_.left.map(completionFailure => QueueCompletionFailure(completionFailure))
)
case QueueOfferResult.Failure(t) =>
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Participant team.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

me

@@ -85,6 +85,7 @@ object CompletionResponse {
}

private[daml] def toException(response: TrackedCompletionFailure): StatusException =
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Participant team

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just like all command-tracker stuff, it is incorporated both into the ledger-api-server and the client code. As such we need to keep the runtime team in the loop.
@stefanobaghino-da FYI

@@ -115,6 +116,7 @@ object CompletionResponse {

private def buildException(metadata: Map[String, String], status: StatusJavaProto.Builder) = {
val details = mergeDetails(metadata, status)
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Participant team

@@ -28,6 +28,7 @@ object SubmissionResult {
override val description: String = s"Submission failed with error ${status.message}"

def exception: StatusRuntimeException =
// TODO error codes: Adapt V2 ?
Copy link
Contributor

@tudor-da tudor-da Nov 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we are already getting a Status, expecting that the WriteService is returning self-service error code formatted statuses. I'll look into it, thanks 👍

@@ -28,6 +28,7 @@ object Rejection {
domain.RejectionReason.InvalidLedgerTime(description)

override lazy val toStateRejectionReason: state.Update.CommandRejected.RejectionReasonTemplate =
// TODO error codes: Adapt V2 ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Participant team

Copy link
Contributor Author

@pbatko-da pbatko-da left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabiotudone-da, @remyhaemmerle-da, @stefanobaghino-da - Could you have a look? I mentioned you in the relevant comments.

@@ -121,13 +121,15 @@ case class DefaultBatchingQueue(
)
)
case f: QueueOfferResult.Failure =>
// TODO error codes: Adapt V2 ?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Here and other places helpfully annotated with "KV committer team" by Tudor)

@fabiotudone-da We spotted these places that could need adapting to self service error codes (aka V2). Are you aware of these in the Committer team (if there're legitimate)?

@@ -72,6 +72,7 @@ object ScenarioServiceMain extends App {

object ScenarioService {
private def notFoundContextError(id: Long): StatusRuntimeException =
// TODO error codes: Adapt V2 ?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Here and other places helpfully annotated with "Language team" by Tudor)

@remyhaemmerle-da We spotted these places that could need adapting to self service error codes (aka V2). Are you aware of these in the Language team (if there're legitimate)?

@@ -439,6 +439,7 @@ class JsonLedgerClient(
// TODO (MK) Using a grpc exception here doesn’t make that much sense.
// We should refactor this to provide something more general.
Future.successful(
// TODO error codes: Adapt V2 ?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefanobaghino-da @remyhaemmerle-da We spotted this place that could need adapting to self service error codes (aka V2). Are you aware of this in the Language or Runtime team (if it's legitimate)?

@fabiotudone-da
Copy link
Contributor

@pbatko-da We've decided not to port batching-related errors to V2 as now we only use pre-execution. CC @miklos-da

@pbatko-da
Copy link
Contributor Author

Thanks for the comments. To sum up:

  1. Language sites are good to ignore (~going away in Daml 2.0)
  2. Committer sites are good to ignore (as they batching-related which is not used)
  3. Runtime site: [DPP-701] Maybe missed error code conversions #11510 (comment) waiting for @stefanobaghino-da
  4. Other sites are Participant

(FYI @remyhaemmerle-da @stefanobaghino-da @fabiotudone-da)

@pbatko-da pbatko-da closed this Nov 26, 2021
@pbatko-da pbatko-da deleted the pbatko/error-codes/dpp-701-potentially-missed-error-code-conversions branch November 26, 2021 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants