feat(classifier): add deterministic wealth management & advisory shield for 02_Finance_Legal

DO
30m ago
+155-0

Summary

  • Wealth Management & Investment Advisory Shield: Adds deterministic classification for financial wealth management platforms (Empower, Fidelity, Vanguard, Schwab, Pershing, Morgan Stanley, Merrill) when communicating about donor-advised funds (DAF), appreciated stock gifts, backdoor Roth IRAs, brokerage statements, unrealized gain/loss reports, and investment strategies.
  • 02_Finance_Legal Routing: Accurately routes to 02_Finance_Legal (Finance/Charitable-Donations for DAF/stock gifts, Finance/Banking for IRAs/statements) with Primary/keep (1.0 confidence) to protect 1:1 human advisor correspondence in Primary Inbox while ensuring Drive attachment persistence targets 02_Finance_Legal/Taxes and 02_Finance_Legal/Banking.
  • Filters Broadcasts: Excludes generic marketing webinars and weekly market recap newsletters.
  • Parity & Tests: Maintained 100% exact parity between code.gs and src/index.js. All 23 test suites (1,136 tests) passing; strict No-PII scan passing.

Test plan

  • Unit tests added in src/gmail-ai-classifier/tests/code.test.js covering stock gifts to DAF, backdoor Roth advisory, and market recap fall-through.
  • Verified npm test (1,136 passing) and npm run check:pii (787 files passing).

Problem

See the linked issue.

Risk

Low — 3 file(s) changed; no CI- or runtime-critical paths touched.

Test plan

Tests added/updated: src/gmail-ai-classifier/tests/code.test.js. Verification: bash scripts/dev-lead-lint.sh (shellcheck --severity=warning) ran pre-commit; the bats suite runs in CI.

Rollback

Revert this PR. No non-revertible side effects (no tags, migrations, or external state).

Monitoring

This PR's CI checks (Lint + bats) are the success/regression signal.

Summary by CodeRabbit

  • New Features
    • Wealth-management and investment-advisory emails are recognized and kept in Primary under Finance/Legal.
    • Charitable-giving and donor-gift messages receive the Charitable Donations label; other matching advisory messages receive the Banking label.
    • Market recaps, newsletters, webinars, and similar broadcasts are excluded from this classification.