Files
buzz/benchmarks/harbor-buzz-orchestra/tests/test_manifest.py
Kalvin C 1e307e178a chore(compose): remove stale typesense env vars (#3332)
Search migrated to Postgres FTS (commit f8bbe6efc). 

The Typesense container was removed from compose.yml and the Helm chart,
but the cleanup missed two template/config files:

- `deploy/compose/.env.example`: `TYPESENSE_API_KEY` and
`TYPESENSE_PORT` are dead — no typesense service exists in compose.yml
and the relay binary no longer reads `TYPESENSE_API_KEY`. The
`CHANGE_ME_RANDOM_API_KEY` placeholder was never consumed, so removing
it also unbreaks the sed loop in the blog draft (one fewer no-op secret
to generate).
- `benchmarks/harbor-buzz-orchestra/scripts/benchmark.py`: generates a
typesense_api_key in state and writes `TYPESENSE_API_KEY` to the .env
file it creates.
- *Editing this file caused the
https://github.com/block/buzz/blob/main/.github/workflows/benchmark-harbor.yml
linter ci checks to run, which seemingly haven't run before, so I needed
fix the lint issues to pass this.*

---------

Signed-off-by: Kalvin Chau <kalvin@block.xyz>
Co-authored-by: npub1c4alndp82zyt9veaklm5d965quss79vlhk9awv7qu5erwhmf42qqlvc25c <c57bf9b4275088b2b33db7f746975407210f159fbd8bd733c0e532375f69aa80@buzz.block.builderlab.xyz>
2026-07-28 12:31:24 -07:00

50 lines
1.7 KiB
Python

import copy
import pytest
import yaml
from harbor_buzz_orchestra import ExperimentManifest, ManifestError
def test_hash_is_independent_of_mapping_and_yaml_key_order(tmp_path, manifest_data):
first = ExperimentManifest.load(manifest_data)
path = tmp_path / "manifest.yaml"
path.write_text(
yaml.safe_dump(
dict(reversed(list(copy.deepcopy(manifest_data).items()))), sort_keys=False
)
)
second = ExperimentManifest.load(path)
assert first.canonical_bytes() == second.canonical_bytes()
assert first.sha256 == second.sha256
assert len(first.sha256) == 64
def test_hash_changes_when_staffing_changes(manifest_data):
first = ExperimentManifest.load(manifest_data)
changed = copy.deepcopy(manifest_data)
changed["roster"][1]["count"] = 3
assert ExperimentManifest.load(changed).sha256 != first.sha256
@pytest.mark.parametrize(
("mutation", "match"),
[
(lambda data: data.update({"unknown": True}), "Extra inputs"),
(lambda data: data["roster"].pop(0), "exactly one orchestrator"),
(lambda data: data["prices"].pop("databricks/qwen"), "prices missing"),
(lambda data: data["roster"][1].update({"concurrency": 5}), "concurrency"),
],
)
def test_invalid_manifest_is_rejected(manifest_data, mutation, match):
mutation(manifest_data)
with pytest.raises(ManifestError, match=match):
ExperimentManifest.load(manifest_data)
def test_non_mapping_document_is_rejected(tmp_path):
path = tmp_path / "manifest.yaml"
path.write_text("- not\n- a\n- mapping\n")
with pytest.raises(ManifestError, match="root must be a mapping"):
ExperimentManifest.load(path)