Skip to content

Commit 428dd6f

Browse files
authored
test(langfuse): structural guard for setup_hook + hook file coexistence (#1052)
Add TestLangfuseManifestHook to dashboard-api/tests/test_hooks.py. Two narrow assertions guarantee that langfuse's manifest declares service.setup_hook = "hooks/post_install.sh" AND that the referenced hook file exists on disk. If either drifts (file renamed, manifest field removed, hook deleted), _validate_hook_path returns None and _handle_install silently skips the hook — langfuse silently regresses to the broken Linux postgres uid mismatch behaviour with no CI signal. The test catches that. Uses defensive manifest.get("service", {}).get("setup_hook") so a future regression that deletes the entire service: block produces a clean assertion failure instead of a less-actionable KeyError. Assertion messages reference the langfuse postgres uid 70 install fix conceptually rather than a transient PR number, so the wording remains accurate after rebase.
1 parent 34e0efa commit 428dd6f

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

  • dream-server/extensions/services/dashboard-api/tests

dream-server/extensions/services/dashboard-api/tests/test_hooks.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,37 @@ def test_hook_env_does_not_leak(self):
229229
assert "DREAM_VERSION" in source
230230
assert "GPU_BACKEND" in source
231231
assert "HOOK_NAME" in source
232+
233+
234+
# --- Langfuse manifest setup_hook structural guard ---
235+
236+
237+
class TestLangfuseManifestHook:
238+
"""Structural guard — langfuse manifest setup_hook + hook file must coexist.
239+
240+
The langfuse postgres uid 70 install fix ships service.setup_hook +
241+
hooks/post_install.sh. If either drifts (file renamed, manifest field
242+
removed, hook deleted), _validate_hook_path returns None and
243+
_handle_install silently skips the hook — langfuse silently regresses
244+
to the broken Linux postgres uid mismatch behavior with no CI signal.
245+
This test catches that.
246+
"""
247+
248+
def test_langfuse_manifest_declares_post_install_hook(self):
249+
ext_dir = Path(__file__).resolve().parents[2] / "langfuse"
250+
manifest = yaml.safe_load((ext_dir / "manifest.yaml").read_text())
251+
setup_hook = manifest.get("service", {}).get("setup_hook")
252+
assert setup_hook == "hooks/post_install.sh", (
253+
"langfuse manifest must declare service.setup_hook = 'hooks/post_install.sh' "
254+
"(part of the langfuse postgres uid 70 install fix). "
255+
"If this field changed, update the hook file path or this test."
256+
)
257+
258+
def test_langfuse_post_install_hook_file_exists(self):
259+
ext_dir = Path(__file__).resolve().parents[2] / "langfuse"
260+
hook_path = ext_dir / "hooks" / "post_install.sh"
261+
assert hook_path.is_file(), (
262+
f"langfuse hook file missing at {hook_path}. "
263+
"The langfuse postgres uid 70 install fix ships this file; "
264+
"if removed, langfuse silently regresses to broken Linux behavior."
265+
)

0 commit comments

Comments
 (0)