Files
ECC/skills/taste-application/tests/test_offline_fixture.py
T
928c1dea72 feat(tasteforge): package reusable workflows and preserve native edits (#3033)
* feat: bundle standalone taste distillation and application workflows

* docs: fix imported taste skill markdown lint

* docs: align Turkish agent catalog with taste skills

* refactor: make ECC the canonical reusable video engine

* fix: preserve video duration when applying image overlays

* fix: preserve background colors in image compositing

* fix: report best-effort duration targets and shortfalls

* feat: ship verified Fusion presets with compatibility provenance

* feat(tasteforge): preserve native edits in application bundles

* feat(tasteforge): compile local preservation without hosted input

* fix: update js-yaml to patched 4.3.2

* test: report bounded Stop wrapper failure diagnostics

* fix(tasteforge): fail closed on unsafe output names, missing overlays and cadence

- cli: default report and spec paths are derived from pack name and profile
  genre; require the manifest's name pattern before using either as a
  filename part so a traversal string cannot write outside cwd/out.
- apply_local: a pack without cadence.json, or with no measured shots and
  no explicit mean_shot, raises instead of silently planning 1.0s shots and
  reporting a measured cadence.
- legacy apply: a missing overlay aborts before any paid upload; forge()
  would have rejected it after every take was generated.
- requirements-live: pin fal-client>=0.13.0, the first release whose
  subscribe() accepts client_timeout.

Addresses the five P1 findings from the independent review of #3033.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015fxHRsydPqEcYngGbqkgt1

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 15:31:36 +01:00

66 lines
2.6 KiB
Python

"""Failing-first tests: offline fixture path + documented provenance."""
from __future__ import annotations
import json
import sys
import unittest
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1] / "scripts"
sys.path.insert(0, str(REPO_ROOT))
FIXTURE = Path(__import__("tasteforge").__file__).resolve().parent / "fixtures" / "flashethereal"
PROVENANCE_MD = REPO_ROOT.parent / "SOURCE.md"
class OfflineFixtureTests(unittest.TestCase):
def test_fixture_contains_recovered_metadata_only(self):
names = {p.name for p in FIXTURE.iterdir()}
self.assertIn("pack.json", names)
self.assertIn("grade.json", names)
self.assertIn("cadence.json", names)
self.assertIn("spec.json", names)
self.assertIn("grounding.txt", names)
# Deliberately excluded heavy/binary recovered artifacts.
self.assertNotIn("look.cube", names)
self.assertFalse(any(n.endswith(".glb") for n in names))
self.assertFalse(any(n.endswith(".png") for n in names))
self.assertNotIn(".DS_Store", names)
def test_cadence_statistics_are_self_consistent(self):
cad = json.loads((FIXTURE / "cadence.json").read_text())
durs = [s["duration"] for s in cad["shots"]]
self.assertEqual(cad["n_shots"], len(durs))
self.assertAlmostEqual(cad["mean_shot"], sum(durs) / len(durs), places=2)
self.assertGreater(cad["cuts_per_min"], 50)
def test_grade_has_zone_structure(self):
grade = json.loads((FIXTURE / "grade.json").read_text())
self.assertEqual(len(grade["zones"]), 5)
self.assertEqual(len(grade["palette"][0]), 2)
self.assertEqual(len(grade["l_cdf"]), 256)
def test_pack_manifest_matches_recovered_values(self):
manifest = json.loads((FIXTURE / "pack.json").read_text())
self.assertEqual(manifest["name"], "flashethereal")
self.assertEqual(len(manifest["refs"]), 3)
self.assertEqual(manifest["mint"]["lut_size"], 33)
self.assertTrue(manifest["distill"]["dry_run"])
class ProvenanceDocTests(unittest.TestCase):
def test_provenance_md_documents_lineage_and_exclusions(self):
text = PROVENANCE_MD.read_text()
self.assertIn("5e0dc440df4dcf6b2082a7dd59e1d6e9cc11d10166d4e1a19dc6c96478f4d2c8", text)
self.assertIn("Raw media", text)
def test_readme_documents_operator_workflow(self):
readme = (Path(__import__("tasteforge").__file__).resolve().parent / "README.md").read_text()
for cmd in ("inspect", "validate", "interview", "distill", "apply", "export"):
self.assertIn(cmd, readme)
if __name__ == "__main__":
unittest.main()