#!/usr/bin/env bash
# Security-lake playbook, step 12: recompute the report yourself.
#
# Replays the appendix of the document step 11 wrote against this project:
# every fingerprint must re-hash byte for byte and every number must come back
# exactly (Playbooks, "Recompute this yourself").
set -euo pipefail

: "${TESSERA_API_BASE:?e.g. https://api.staging.tessera.zone/v1}"
: "${TESSERA_API_KEY:?the tsk_ key of this project}"
: "${TESSERA_REPO_ROOT:?a checkout of the Tessera repository (for the schemas)}"
: "${TESSERA_STATE_DIR:?set by the runner; ids are handed between steps}"

tessera-doctest recompute \
  --document "$TESSERA_STATE_DIR/security-lake-published-results.json" \
  --repo-root "$TESSERA_REPO_ROOT"
