Goose 00036 is a renumbered copy of the vault tables. Degraded read stays off by default and only runs after authorization; tombstones and unpublished artifacts fail closed. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
767 B
Go
31 lines
767 B
Go
package artifactvault
|
|
|
|
import "fmt"
|
|
|
|
func CoveragePASS(c Coverage) bool {
|
|
if c.Required <= 0 {
|
|
return false
|
|
}
|
|
return c.Verified == c.Required && c.Quarantine == 0
|
|
}
|
|
|
|
func CanPurge(legalHold bool, activeRefs int) error {
|
|
if legalHold {
|
|
return fmt.Errorf("artifactvault: legal hold")
|
|
}
|
|
if activeRefs > 0 {
|
|
return fmt.Errorf("artifactvault: remaining references")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func PreflightDestroy(c Coverage, backupOK, corpusOK, vaultReady bool) error {
|
|
if !vaultReady || !CoveragePASS(c) {
|
|
return fmt.Errorf("artifactvault: coverage gate failed required=%d verified=%d quarantine=%d", c.Required, c.Verified, c.Quarantine)
|
|
}
|
|
if !backupOK || !corpusOK {
|
|
return fmt.Errorf("artifactvault: complementary backup/corpus not PASS")
|
|
}
|
|
return nil
|
|
}
|