"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(live): correct the impact wording and complete Trigger.market introspection
ImSevenstarscca5cab17563
diff --git a/agent/src/live/runtime/triggers.py b/agent/src/live/runtime/triggers.pyindex 5ffc70ecb..8582a9fb7 100644--- a/agent/src/live/runtime/triggers.py+++ b/agent/src/live/runtime/triggers.py@@ -216,7 +216,9 @@ class Trigger:# INTERVAL/EVENT trigger carried the bound method in ``market``. That is# invisible to :func:`due_now`, which reads ``market`` only for MARKET# triggers, but it is wrong in ``repr`` and fatal to ``dataclasses.asdict`` and-# JSON — the shape run cards and live audit artifacts serialise.+# JSON. No production path serialises a ``Trigger`` today — jobs persist a+# plain kind string, not the descriptor — so this is a latent footgun rather+# than an active break.## Binding the factory under its public name here, once the decorator has# already recorded the field, keeps both halves of the contract: the field@@ -229,9 +231,10 @@ class Trigger:# ``field(default=None)`` is overwritten the same way.Trigger.market = Trigger._market # type: ignore[assignment]del Trigger._market-# Docs and ``help()`` read the function's own qualname, which would otherwise-# still say ``Trigger._market``.+# Introspection must not leak the private placeholder: ``help()`` and ``repr``+# read ``__qualname__``, while ``str()`` and logging read ``__name__``.Trigger.market.__func__.__qualname__ = "Trigger.market"+Trigger.market.__func__.__name__ = "market"# --------------------------------------------------------------------------- #diff --git a/agent/tests/test_runtime_triggers.py b/agent/tests/test_runtime_triggers.pyindex b5704d127..39d2f6308 100644--- a/agent/tests/test_runtime_triggers.py+++ b/agent/tests/test_runtime_triggers.py@@ -145,9 +145,11 @@ def test_non_market_triggers_leave_market_unset() -> None:def test_interval_trigger_serialises_to_json() -> None:"""An INTERVAL trigger must survive ``dataclasses.asdict`` + ``json.dumps``.- Run cards and live audit artifacts serialise the descriptors they carry.- ``market`` held a bound method before the field default was restored, which- made that raise ``TypeError``.+ No production path serialises a ``Trigger`` today — jobs persist a plain+ kind string, not the descriptor — but the first caller that does must not+ trip over a bound method in ``market``. Before the field default was+ restored, this raised ``TypeError``. Pinning the contract makes that latent+ hazard explicit.EVENT triggers are deliberately out of scope: their ``predicate`` is acallable by design, so they are not a serialisable shape in the first place.@@ -172,6 +174,7 @@ def test_market_field_default_and_factory_are_both_intact() -> None:assert Trigger.market("us_equity").market == "us_equity"assert callable(Trigger.market)assert Trigger.market.__qualname__ == "Trigger.market"+ assert Trigger.market.__name__ == "market"# The factory is bound after the class body; the private placeholder must# not survive as a second public way to build a MARKET trigger.assert not hasattr(Trigger, "_market")