feat: add audited task review and linked manual retries

This commit is contained in:
2026-09-17 21:57:53 +08:00
parent 571107f96d
commit a50d5faac7
43 changed files with 2096 additions and 57 deletions

View File

@@ -29,6 +29,14 @@ type historyCursor struct {
}
func decodeHistoryCursor(value string, ns, task, attempt core.ID) (historyCursor, error) {
kind := "attempts"
if attempt != "" {
kind = "evidence"
}
return decodeHistoryCursorKind(value, ns, task, attempt, kind)
}
func decodeHistoryCursorKind(value string, ns, task, attempt core.ID, kind string) (historyCursor, error) {
var c historyCursor
raw, err := base64.RawURLEncoding.Strict().DecodeString(value)
if err != nil || len(raw) > 768 {
@@ -53,12 +61,12 @@ func decodeHistoryCursor(value string, ns, task, attempt core.ID) (historyCursor
if d.Decode(&c) != nil || c.Version != 1 || c.Namespace != ns || c.Task != task || c.Attempt != attempt {
return c, fault.Invalid("cursor does not match this history query")
}
if attempt == "" {
if kind == "attempts" {
if c.Kind != "attempts" || c.Epoch == 0 || c.ID != "" || c.Created != nil {
return c, fault.Invalid("invalid attempts cursor")
}
} else {
if c.Kind != "evidence" || c.Epoch != 0 || c.ID.Validate() != nil || c.Created == nil || c.Created.Year() < 2000 || c.Created.Year() > 9998 || c.Created.Nanosecond()%1000 != 0 {
if c.Kind != kind || c.Epoch != 0 || c.ID.Validate() != nil || c.Created == nil || c.Created.Year() < 2000 || c.Created.Year() > 9998 || c.Created.Nanosecond()%1000 != 0 {
return c, fault.Invalid("invalid evidence cursor")
}
}