Skip to content

fix: PassthroughEnricher no longer mutates shared namespace dicts#563

Merged
Muizzkolapo merged 1 commit into
integration/batch-online-unificationfrom
fix/f11-passthrough-mutation
May 19, 2026
Merged

fix: PassthroughEnricher no longer mutates shared namespace dicts#563
Muizzkolapo merged 1 commit into
integration/batch-online-unificationfrom
fix/f11-passthrough-mutation

Conversation

@Muizzkolapo
Copy link
Copy Markdown
Owner

Summary

  • Root cause: PassthroughEnricher.enrich() called ns.update(result.passthrough_fields) which mutates the namespace dict in-place. When multiple records share the same dict object through shallow copies (e.g., RecordEnvelope.build_skipped), passthrough fields from one record leak into another.
  • Fix: Replace ns.update(...) with content[action_name] = {**ns, **result.passthrough_fields} — creates a new dict per record, eliminating cross-record contamination.
  • 1 line changed in enrichment.py, 2 regression tests added.

Verification

  • 2 new tests: shared namespace isolation (cross-result and within-result)
  • All 16 enrichment namespace tests pass
  • Full suite: 6845 passed (same as baseline + 2 new tests)
  • ruff check and ruff format --check clean

@Muizzkolapo Muizzkolapo force-pushed the fix/f11-passthrough-mutation branch from d5516a8 to 75e1e3a Compare May 19, 2026 16:45
Replace ns.update() with dict spread to create a new dict per record.
Prevents cross-record data contamination when multiple records share
the same namespace dict object through shallow copies.

Two regression tests verify isolation between records sharing a
namespace dict, both across separate results and within the same result.
@Muizzkolapo Muizzkolapo force-pushed the fix/f11-passthrough-mutation branch from 75e1e3a to 994baa7 Compare May 19, 2026 16:49
@Muizzkolapo Muizzkolapo changed the base branch from main to integration/batch-online-unification May 19, 2026 16:49
@Muizzkolapo Muizzkolapo merged commit fc8b456 into integration/batch-online-unification May 19, 2026
4 of 5 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant