fix(edge): classify artifact lineage mismatches
This commit is contained in:
parent
619a05e0d4
commit
70176afda6
1 changed files with 20 additions and 2 deletions
|
|
@ -672,8 +672,11 @@ func (s *artifactFrontierStore) matchRecordLocked(
|
|||
if record.principalRef != principalRef {
|
||||
return nil, true, errLogicalRequestPrincipal
|
||||
}
|
||||
if record.protocol != protocol || record.lineage != lineage.Prefix {
|
||||
return nil, true, errLogicalRequestLineage
|
||||
if record.protocol != protocol {
|
||||
return nil, true, fmt.Errorf("%w: protocol changed", errLogicalRequestLineage)
|
||||
}
|
||||
if record.lineage != lineage.Prefix {
|
||||
return nil, true, describeArtifactPrefixMismatch(record.lineage, lineage.Prefix)
|
||||
}
|
||||
return record, true, nil
|
||||
}
|
||||
|
|
@ -685,6 +688,21 @@ func (s *artifactFrontierStore) matchRecordLocked(
|
|||
return nil, true, errLogicalRequestLineage
|
||||
}
|
||||
|
||||
func describeArtifactPrefixMismatch(want, got logicalRequestLineage) error {
|
||||
switch {
|
||||
case want.Endpoint != got.Endpoint:
|
||||
return fmt.Errorf("%w: endpoint changed", errLogicalRequestLineage)
|
||||
case want.HistoryDigest != got.HistoryDigest && want.ToolsetDigest != got.ToolsetDigest:
|
||||
return fmt.Errorf("%w: request history and toolset changed", errLogicalRequestLineage)
|
||||
case want.HistoryDigest != got.HistoryDigest:
|
||||
return fmt.Errorf("%w: request history changed", errLogicalRequestLineage)
|
||||
case want.ToolsetDigest != got.ToolsetDigest:
|
||||
return fmt.Errorf("%w: toolset changed", errLogicalRequestLineage)
|
||||
default:
|
||||
return errLogicalRequestLineage
|
||||
}
|
||||
}
|
||||
|
||||
func artifactIDsIntersect(record *artifactFrontierRecord, ids []string) bool {
|
||||
for _, id := range ids {
|
||||
if record.pending[id] != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue