From 553bf3c2a12584d44c168e75d34bdcdefd380d00 Mon Sep 17 00:00:00 2001 From: Oliver Le Date: Wed, 15 Apr 2026 11:18:59 -0700 Subject: [PATCH] fix: undo #88 duplicates that collided with #86/#87 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #88 landed at the same time as #86 and #87 shipping from a parallel session. The merges didn't conflict line-wise, but the diffs overlap: - brain.py:apply_brain_rules — #86 already wired `rules.injected` with a richer payload (id + category + confidence + state + scope) and try/except guard. #88 added a second thinner emit after the cache.put. Result: double-fire on fresh compute. Harmless in practice — SessionHistory dedups via a set — but clearly wrong. Removing #88's emit, keeping #86's. - .gitignore — #87 already added `/cloud/` and `/sdk/`. #88's re-adds are duplicates. Removing; keeping `/railway.toml` and `apollo-leads-*.csv` which are genuinely new from #88. The regression test in tests/test_session_history.py stays — it asserts the emit fires end-to-end from a real Brain + correct() loop, complementing #86's test_wiring_compound.py coverage of payload shape. Both pass. Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitignore | 7 ------- src/gradata/brain.py | 12 ------------ 2 files changed, 19 deletions(-) diff --git a/.gitignore b/.gitignore index 87880db7..8b416d85 100644 --- a/.gitignore +++ b/.gitignore @@ -203,13 +203,6 @@ docs/launch-post.md docs/public-launch-narrative.md docs/RELEASE-*-DRAFT.md -# Orphaned dirs from S105 splits — cloud/ moved to private -# Gradata/gradata-cloud in #76, sdk/ superseded by the flattened repo -# layout in #65. Left on disk as untracked copies that keep showing -# up in `git status` and sometimes get accidentally re-added. -/cloud/ -/sdk/ - # Railway config for the cloud API now lives in the private # gradata-cloud repo at cloud/railway.toml — the root-level copy # here is a stale leftover from before the split. diff --git a/src/gradata/brain.py b/src/gradata/brain.py index baf3e230..86e231d6 100644 --- a/src/gradata/brain.py +++ b/src/gradata/brain.py @@ -916,18 +916,6 @@ def apply_brain_rules( result = format_rules_for_prompt(applied) self._rule_cache.put(cache_key, result) - - # Fires the in-memory bus so SessionHistory (integrations/session_history.py) - # can track per-session rule effectiveness — it subscribes to rules.injected - # but the emitter was never wired, leaving compute_effectiveness() dormant. - # Cache hits above skip this intentionally: SessionHistory uses a set so - # replays are idempotent within a session, and the cache is per-scope - # so repeated injects in the same scope yield the same rule set. - if applied: - self.bus.emit("rules.injected", { - "rules": [{"id": a.rule_id} for a in applied], - "task": task, - }) return result def scoped_rules(