fix(bridge): ignore pre-start trigger comments
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
autonomic-bot
2026-06-13 00:27:22 +00:00
parent ddefc96eef
commit 23f1861b7a
4 changed files with 91 additions and 5 deletions

View File

@ -8,6 +8,7 @@ from __future__ import annotations
import os
import sys
from datetime import timedelta
# bridge.py reads HMAC/DRONE/GITEA secret FILES at import; point them at /dev/null (readable, empty)
# so the import works in a unit context — parse_trigger doesn't use any of them.
@ -93,3 +94,13 @@ def test_find_existing_comment_matches_marker(monkeypatch):
def test_find_existing_comment_none_when_absent(monkeypatch):
monkeypatch.setattr(bridge, "list_comments", lambda fn, n: [{"id": 1, "body": "hello"}])
assert bridge.find_existing_comment("org/repo", 5) is None
def test_preexisting_comment_from_before_bridge_start_is_ignored():
created = (bridge._PROCESS_STARTED_AT - timedelta(minutes=5)).isoformat().replace("+00:00", "Z")
assert bridge._is_preexisting_comment({"created_at": created}) is True
def test_comment_after_bridge_start_is_not_treated_as_preexisting():
created = (bridge._PROCESS_STARTED_AT + timedelta(minutes=5)).isoformat().replace("+00:00", "Z")
assert bridge._is_preexisting_comment({"created_at": created}) is False