feat(ttp): E.3.14 worker bootstrap (insert + ttp.tagged publish)

Inner loop drains a per-process asyncio.Queue populated by one pump
task per topic in _TOPICS, dispatches each event through
CompositeTagger, persists via repo.insert_tags(), and publishes
ttp.tagged + per-technique ttp.rule.fired.<id> only when the insert
returned a non-zero rowcount.

CompositeTagger seeded with all six lifters (Behavioral, Intel,
CanaryFingerprint, Email, Identity, Credential).

Loop-prevention invariant from TTP_TAGGING.md §"Bus topics" enforced:
N replays of the same upstream event publish exactly one ttp.tagged
event. test_worker_bus covers both the direct invocation path and
the idempotency replay path.

Intel catch-up via attacker.session.ended is intentionally deferred
to E.3.14b — needs a session→intel join the repo doesn't expose yet.
This commit is contained in:
2026-05-01 20:57:57 -04:00
parent 322fd44d72
commit 101127247e
5 changed files with 499 additions and 186 deletions

View File

@@ -94,14 +94,16 @@ def test_ttp_registered_in_known_workers():
assert "ttp" in KNOWN_WORKERS
# ── E.2.12 deferred bus-integration assertions ─────────────────────
# ── E.2.12 bus-integration smokes ───────────────────────────────────
# The behavioral assertions live in tests/ttp/test_worker_bus.py against
# a real FakeBus. Keep these as non-xfail markers pointing to the
# integration coverage so a future contributor doesn't re-introduce the
# xfail and lose the trail.
@pytest.mark.xfail(strict=True, reason="impl phase E.3 — fan-out invokes engine")
def test_e212_session_ended_invokes_rule_engine():
raise AssertionError("not yet implemented")
def test_e212_session_ended_invokes_rule_engine() -> None:
"""See ``test_worker_bus.test_session_ended_invokes_engine``."""
@pytest.mark.xfail(strict=True, reason="impl phase E.3 — loop-prevention invariant")
def test_e212_idempotent_re_evaluation_publishes_zero_events():
raise AssertionError("not yet implemented")
def test_e212_idempotent_re_evaluation_publishes_zero_events() -> None:
"""See ``test_worker_bus.test_loop_prevention_no_re_fire``."""