Resilience of the `buildTarget/*` requests
See original GitHub issueThe requests of the form buildTarget/*
take a sequence of build target identifiers as paramater and expect a sequence of result items as response, each item corresponding to one of the build target identifier.
For example, the buildTarget/source
params are
export interface SourcesParams {
targets: BuildTargetIdentifier[];
}
and result is:
export interface SourcesResult {
items: SourcesItem[];
}
But what if the request fails on a single build target:
- should the server fails the entire request and returns an error response?
- should it returns an incomplete result and ignore the failed build target?
sbt does 1 which is probably not a good idea because we don’t want the entire build import to fail if one build target fails. Bloop does 2 but that’s not fully satisfying either because the build client doesn’t really know why some build targets are missing.
So I propose to augment every buildTarget/*
response with a new failedTargets
field which must contain the build target failures.
export interface FailedBuildTarget {
target: BuildTargetIdentifier;
code: integer;
message: string;
data?: string | number | boolean | array | object | null;
}
export interface SourcesResult {
items: SourcesItem[];
failedTargets: FailedBuildTarget[];
}
Do you think this is the correct approach for this problem?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (6 by maintainers)
Top GitHub Comments
Yes of course. I am just saying that
code
is probably useless but message should be mandatory and we can also have an optionaldata
.It’s up to them.
Also I agree with @ckipp01 that it’s not a good idea to swallow a failure. In general I think if one of the
buildTarget/scalacOptions
,buildTarget/dependencySources
,buildTarget/sources
fails the client should clearly states that the import of some build targets failed.In Metals, the build target error messages could be displayed in the
doctor
section.Either that or do you think it’d be useful to also have space for an error or message? Something like:
😆 I someone totally missed that you had an even more robust version up above. Just ignore me, I need to learn how to read fully.