Commit graph

212 commits

Author SHA1 Message Date
e057255f4f fix(24): address code-review findings — PATCH identity guard, empty-array tombstone, health-check timeout, record-key normalization
Two critical issues from the post-phase code review:

- PATCH /api/route53/zones/[zoneId]/records/[recordId] never verified the
  request body's name/type/setIdentifier matched the record identified by
  the URL. A mismatch would silently UPSERT a brand-new AWS recordset
  (leaving the original live and untouched) while corrupting the mirror's
  record_key invariant. Now rejects with 400 if any of those three fields
  differ from the existing record — renaming/retyping is delete-plus-create,
  not an update.

- route53-sync-service.ts's syncZones()/syncRecords() tombstone queries used
  "id <> ALL(seenIds)" style queries with no empty-array guard — a
  successful-but-empty AWS response would soft-delete every previously
  synced zone/record in one shot. Same bug class already fixed in
  pax8-sync-service.ts; now guarded the same way here.

Two smaller fixes:

- checkRoute53()'s AWS auth probe had no timeout, unlike every other
  integration's liveCheck() (8s AbortController). Added the same bound via
  the SDK's abortSignal option.
- buildRecordKey() relied on every caller to pre-normalize name/type case
  before calling it. Now normalizes internally (lowercase name, uppercase
  type) so the record_key invariant holds regardless of caller discipline.

Full REVIEW.md findings in 24-REVIEW.md. Two remaining Warnings (alias
records un-editable/undeletable, no admin-UI surface for route53_audit_log)
deliberately left as backlog items for a follow-up phase — out of scope for
a post-execution fix pass.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-05 23:15:27 -04:00
4da5664184 fix(24-05): quote TXT record values per RFC 1035 character-string format
AWS Route 53 rejects an unquoted TXT Value with:
'InvalidCharacterString (Value should be enclosed in quotation marks)'
— discovered during plan 24-07's live checkpoint (step 2, create) against
a real hosted zone. buildChangeBatch now wraps TXT values in escaped
double quotes, splitting into 255-character segments per RFC 1035's
character-string limit. A/AAAA/CNAME/MX/SRV values pass through
unchanged (only TXT uses the quoted-string wire format).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-05 21:08:51 -04:00
c47de2a91c chore: merge executor worktree (worktree-agent-a8fd5f9961335cf8d) — plan 24-05 2026-08-05 20:38:35 -04:00
f4e151dedd feat(24-05): implement route53-change-submit (ChangeBatch, retry, bounded poll)
- buildChangeBatch: CREATE/UPSERT/DELETE, SetIdentifier omission, NS/SOA guard (D-01 defence in depth)
- isRetryableAwsError: classifies ThrottlingException/Throttling/PriorRequestNotComplete/ServiceUnavailable
- submitRecordChange: sends ChangeResourceRecordSetsCommand with bounded 2-retry backoff (750ms/1500ms)
- pollChangeStatus: bounded 15s/2s GetChange poll, no 30-minute SDK waiter
- 20/20 tests passing, tsc clean
2026-08-05 20:31:43 -04:00
fee1f9962b feat(24-06): wire route53-incremental/route53-full into sync scheduler
- Add route53-incremental and route53-full to the sync_type union
- Seed both schedules disabled (*/15 * * * * incremental, 0 1 * * * full)
- Dispatch branches gate on isRoute53Configured() only (D-10 — no
  integration_settings check, unlike the pax8-daily exception)
- Both branches use dynamic import to keep the AWS SDK out of the
  scheduler's eager module graph
2026-08-05 20:30:52 -04:00
9a9e691cd4 test(24-05): add failing test for route53-change-submit
- ChangeBatch construction (CREATE/UPSERT/DELETE, SetIdentifier omission, NS/SOA guard)
- isRetryableAwsError classification
- submitRecordChange retry-with-backoff behavior
- pollChangeStatus bounded polling (INSYNC / timeout / per-attempt error swallow)
2026-08-05 20:29:57 -04:00
e727ddca77 refactor(24): consolidate duplicate sanitizeAwsError into single source
Plan 24-04's isolated worktree didn't have plan 24-03's
route53-record-validation.ts available (parallel wave, no direct
dependency), so it carried a local copy of the identical AWS error
redaction logic — flagged in its own SUMMARY for consolidation once
24-03 merged. Both plans are now merged; importing the shared
implementation instead of keeping two copies in sync.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-05 20:27:01 -04:00
d00c47ecb1 chore: merge executor worktree (worktree-agent-a30d26dba3410e0da) — plan 24-04 2026-08-05 20:26:13 -04:00
2dbb1e13e2 chore: merge executor worktree (worktree-agent-ab77d007f6dbb3578) — plan 24-03 2026-08-05 20:26:13 -04:00
ea04672e5b feat(24-04): register checkRoute53() in the integration health aggregator
- checkRoute53(): config gate + ListHostedZonesCommand auth probe, mirrors
  checkDattoRmm()'s custom-body shape (key: 'route53', category: 'network')
- Auth-probe errors classified via isAwsAuthError (InvalidClientTokenId,
  SignatureDoesNotMatch, AccessDenied, UnrecognizedClientException, 401/403)
  and redacted through a local sanitizeAwsError before reaching IntegrationHealth.error
- D-12: queries route53_zones (is_deleted=false, capped at 50 by name),
  feeds checkAllZoneDelegations(); mismatches downgrade status to a new
  'degraded' HealthStatus member; lookup failures reported separately via
  nsDelegationErrors, never counted as mismatches
- Whole delegation step wrapped in try/catch so a Postgres failure or
  blocked resolver can never abort checkIntegrationHealth()'s Promise.all (T-24-16)
- summarize() updated so 'degraded' counts toward failed/hasIssues instead
  of falling through uncounted (Rule 1 fix)
- No changes to applyDisableOverlay() — route53 covered by the existing
  generic by-key overlay (D-10)
2026-08-05 20:24:36 -04:00
0acf1fa24f test(24-02): cover buildDriftHistoryRows update/delete/create/no-change cases
- 6 unit tests exercising the pure drift-classification wiring in Route53SyncService
- Confirms whole-recordset before/after payloads, not per-field deltas
- Confirms CRUD-originated changes still get tagged sync_detected_drift (sync cannot distinguish actor)
- Full suite green aside from 2 pre-existing itglue-search.test.ts failures logged in deferred-items.md (unrelated to this plan)
2026-08-05 20:23:16 -04:00
d8c0912f4b feat(24-02): add Route53SyncService — zones and records mirror sync
- fullSync/incrementalSync + getRoute53SyncService() singleton
- Paginated ListHostedZonesCommand + GetHostedZoneCommand (delegation set for D-12)
- Paginated ListResourceRecordSetsCommand per live zone
- Soft-delete reconciliation for zones and records (never hard-delete)
- sync_history bookkeeping with entity_type='route53', literal full/incremental sync_type
- Drift detection wired via buildDriftHistoryRows, writing sync_detected_drift history rows
- No integration_settings gating anywhere (D-10)
2026-08-05 20:22:34 -04:00
8b5e926bb1 feat(24-03): add Route 53 audit lifecycle and pulse_crud history persistence
- createPendingAuditLog/markAuditCommitted/markAuditFailed implement the pending -> committed/failed lifecycle (D-07, SC-3); markAuditFailed always sanitizes via sanitizeAwsError
- insertPulseCrudHistory writes 'pulse_crud' history rows, documented as callable only after a committed write
- upsertMirrorRecord/softDeleteMirrorRecord/loadMirrorRecord manage the route53_records mirror; mirror writes are best-effort and soft-delete only (D-08), audit/history writes are not best-effort
- log same pre-existing itglue-search.test.ts failures (unrelated, out of scope) in deferred-items.md
2026-08-05 20:22:24 -04:00
06ebae5a5c feat(24-04): implement NS normalization and delegation-comparison module
- normalizeNsList: lowercase, strip trailing dot, dedupe, sort, [] for non-arrays
- compareNsDelegation: set-diff mismatch with unjudgeable-empty-authoritative guard
- resolveLiveNs: dedicated dns.Resolver() pinned to 1.1.1.1/8.8.8.8, never touches
  the process-global resolver (D-12, T-24-13)
- checkAllZoneDelegations: bounded-concurrency batch check, lookup errors reported
  separately from mismatches (T-24-14)
2026-08-05 20:21:30 -04:00
c18271dda9 test(24-02): add Route 53 record-key, normalization, and drift-classification helpers
- buildRecordKey, normalizeRecordSet, recordSetsEqual, classifyDrift, toHistoryPayload
- Pure, dependency-free module (no pg, no AWS client construction)
- 16 unit tests covering every behavior bullet from the plan
2026-08-05 20:21:05 -04:00
4be4a191a5 feat(24-03): add D-01 record-write validator and AWS error sanitizer
- validateRecordWrite enforces closed allowlist (A/AAAA/CNAME/MX/TXT/SRV), rejects NS/SOA case-insensitively with a delegation-specific reason
- sanitizeAwsError redacts AWS access key ids, ARNs, and 12-digit account ids, truncates to 500 chars (T-24-03)
- no AWS SDK or Postgres dependency; fully unit-tested (23 assertions)
2026-08-05 20:20:46 -04:00
7396f07f2e test(24-04): add failing test for NS normalization and delegation comparison
- normalizeNsList: lowercase, strip trailing dot, dedupe, sort, [] for non-arrays
- compareNsDelegation: set-diff mismatch detection with unjudgeable-empty-authoritative guard
2026-08-05 20:20:41 -04:00
210f84d343 feat(24-01): implement Route 53 credential factory
- lib/services/route53-factory.ts: isRoute53Configured() / getRoute53Client()
  / resetRoute53Client(), following the veeam-factory.ts singleton shape
- No explicit credentials option passed to Route53Client — relies on the AWS
  SDK's default credential chain reading AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY
  from process.env, exactly how BWS injects them at the container entrypoint
- CLAUDE.md: document the AWS_* env-prefix exception in the integration table
- All 7 route53-factory.test.ts assertions pass; npx tsc --noEmit clean
2026-08-05 19:25:36 -04:00
4dd9d5dab8 test(24-01): add failing test for Route 53 credential factory
- lib/types/route53.ts: camelCase interfaces for zones/records/history/audit-log/sync-result
- lib/services/route53-factory.test.ts: isRoute53Configured() + getRoute53Client() behavior
  cases — fails RED, factory module does not exist yet
2026-08-05 19:24:28 -04:00
5f308f836f fix(phishing-recipient-seubert): scope campaign grouping Tier 3 to company, not reporting contact
Tier 3 is the only tier automatic (webhook-triggered) grouping ever
reaches, since grouping runs before message parsing. It was scoped to
reports.requester_contact_id, so the same campaign reported by
different employees at the same company never consolidated into one
campaign — each report's evidence/blast-radius view silently
under-reported the campaign's true recipients.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-22 12:34:33 -04:00
9f12cd610a test(260721-n49): cover tenant-scoped vs global-fallback getBlastRadius branches
- Add mimecast_tenants routing branch to stageQueries and company_id to
  report fixtures
- New test: enabled mimecast_tenants row -> getBlastRadius called with
  { client, cacheScope: companyId } and the tenant SQL is issued
- New parameterized test: null companyId and companyId-with-no-enabled-row
  -> getBlastRadius called with no second argument (global fallback)
2026-07-21 16:45:44 -04:00
9f75f2160c fix(260721-n49): resolve per-company Mimecast tenant in gatherCampaignEvidence
- Thread company_id through reports query and CampaignReportSummary
- Mirror the route's Bug 2 (D-05) tenant-resolution block: query
  mimecast_tenants for an enabled row, build a tenant-scoped client via
  getMimecastClientForTenant, and pass { client, cacheScope } to
  getBlastRadius() when one exists
- Preserve global env fallback unchanged when no companyId or no
  enabled tenant row is present
2026-07-21 16:44:44 -04:00
534eda3c40 test(260721-mmf): assert tenant-wide fan-out and multi-recipient blast radius
- Updated the getHeldMessages window test to assert no `recipient` key and
  added an explicit no-`to` assertion for searchDeliveredMessages
- Added a new test driving searchDeliveredMessages with 3 distinct `to`
  addresses, asserting all appear in perRecipient and count toward
  matched/delivered
2026-07-21 16:25:39 -04:00
58202e0dee fix(260721-mmf): broaden Mimecast blast-radius fan-out to whole tenant
- searchDeliveredMessages now called with from+subject+start+end only
  (no `to`) so it returns every delivered/rejected message matching the
  campaign across all recipients, not just the reporter's mailbox
- getHeldMessages now called with start+end only (no `recipient`) —
  domainsMatch() post-filter is the sole scoping mechanism for held rows
- Updated inline comments to document the tenant-wide fan-out and the
  per-recipient merge behavior it now produces
2026-07-21 16:25:08 -04:00
9311f1044b fix(quick-260721-fy8): add mimecast-sync and qbo dispatch branches to scheduler
- Extend ScheduleConfig.sync_type union with 'mimecast-sync'
- Add mimecast-sync branch calling runMimecastIncrementalSync() behind
  isMimecastConfigured(), mirroring the engagement/zoom configured-gate pattern
- Add qbo branch calling getQboSyncService().incrementalSync('scheduled')
  behind an integration_settings disabled check, mirroring the pax8-daily
  disable-check pattern
- Both branches previously fell through to the generic Autotask fullSync()
  catch-all, which also contended for the SyncService singleton mutex
2026-07-21 11:36:16 -04:00
672f17b7f9 chore: check in pending work — queue preferences, QBO AR diagnostics, mobile engagement fixes, ops scripts
Bundles several in-progress efforts that were sitting uncommitted:
- User queue-preferences (migration 087, API route, popover component)
- QBO invoice soft-delete (migration 088) and AR diagnostics route
- Dashboard/mobile engagement route and page adjustments
- Docker Compose log-rotation config
- One-off ticket/RMM investigation scripts (scripts/)
- Planning docs: phase verification/pattern notes, mobile shell design spec
- .gitignore: exclude local scratch financial/inventory data and Claude Code
  worktree/local-settings runtime state (never meant for version control)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6RuWdiUiXrPK6FLBHjtpY
2026-07-18 06:34:57 -04:00
67ee680105 test(quick-260718-7v8): cover held-message date-scoping and sender-relevance guard
- blast-radius: getHeldMessages called with same start/end window as
  searchDeliveredMessages
- blast-radius: unrelated-sender held row excluded from held/matched and
  perRecipient; matching-sender held row still counts and overrides
- client: getHeldMessages threads start/end into POST body data[0] when
  provided, omits them when not
2026-07-18 05:46:22 -04:00
94f7dad29c fix(quick-260718-7v8): date-scope held-message lookup + sender-relevance guard
- getHeldMessages() accepts optional start/end, threaded into data[0] as
  siblings of admin/searchBy (backward compatible when omitted; 403
  fallback body inherits them automatically via the existing spread)
- getBlastRadius() passes the same startStr/endStr window already
  computed for searchDeliveredMessages into getHeldMessages()
- Added domainsMatch() sender-relevance guard: held rows whose sender
  domain doesn't match input.sender (exact-or-proper-subdomain) are
  filtered out before counting/merging, so unrelated same-window holds
  never inflate held/matched or override a delivered recipient
2026-07-18 05:44:56 -04:00
0d6cd25008 test(260717-v6c): mirror test coverage for accidental-report service functions
- remediation-service.test.ts: D-04 guard rejection, successful status flip
  + audit event, note-post-failure-still-commits path for
  markCampaignAccidentalReport
- triage-note-service.test.ts: noteType 18/publish 1 posting, per-ticket
  isolation, zero-reports path for generateAndPostAccidentalReportNote
2026-07-17 22:35:04 -04:00
aea4fd2f0c feat(260717-v6c): add markCampaignAccidentalReport + generateAndPostAccidentalReportNote
- generateAndPostAccidentalReportNote mirrors generateAndPostAcknowledgment:
  fixed customer-visible template (noteType 18/publish 1), per-ticket
  try/catch isolation, zero evidence interpolation (T-23-01)
- markCampaignAccidentalReport mirrors markCampaignFalsePositive's D-04
  guard/transaction shape, then posts the note post-commit outside the
  FOR UPDATE lock; note-post failure never propagates
2026-07-17 22:32:45 -04:00
cff57a414e fix: update USER_AWARENESS acknowledgment note copy 2026-07-17 10:51:12 -04:00
cf04f07c58 feat(quick-260717-a19): add idempotency guard + retry-parse on ticket.update
- parseAndStoreMessage (Defect 3): short-circuit with
  { stored: false, reason: 'already-parsed' } when a messages row already
  exists for the report, before any Autotask attachment fetch
- webhook-service (Defect 2): new retryPhishingParseOnUpdate wired into
  ticket.update fire-and-forget path; retries the missing-EML parse for a
  flagged, unparsed, auto_parse-gated report — no new cron/polling, reuses
  existing update traffic, safe to fire repeatedly thanks to the new
  idempotency guard
- Adjust eml-service test mock default so the new leading existence-check
  query doesn't short-circuit existing happy-path tests; add new test for
  the already-parsed short-circuit
2026-07-17 07:20:48 -04:00
204276c88a feat(quick-260717-a19): add 3 confirmed KnowBe4 domains to sim allowlist
- Extend knowbe4 vendor entry with customer-portal.info,
  cloud-service-care.com, bankonlinesupport.com (confirmed via shared
  URL fingerprint across Seubert tickets 699419/699421/699422/699433/
  699435/699456 on 2026-07-16/17)
- domainMatchesAllowlist and isKnownSimulationSender untouched
- Add tests for exact match, subdomain match, and suffix-spoof rejection
2026-07-17 07:19:18 -04:00
6e8c78b8d2 fix(23-06): capture actionId in auto-post audit payload, guard manual re-approval of acknowledge_user
23-06-REVIEW.md found two real defects in the just-merged idempotency fix:
- CR-01: autoPostAcknowledgment's audit payload omitted actionId, which the
  campaign-detail API requires to derive completedAt — every auto-posted
  acknowledge_user row rendered a null completion date in the Action Area UI.
- CR-02: the manual approve/remediate path had no server-side guard against
  re-approving acknowledge_user for a campaign that already got auto-posted —
  only a client-side UI check prevented the exact duplicate-note bug 23-06
  was chartered to close, reachable via a direct API call.

Fixes both: capture RETURNING id from the insert and include it in the audit
payload; add an existence check in approveRemediationActions that rejects
acknowledge_user when already posted for the campaign.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6RuWdiUiXrPK6FLBHjtpY
2026-07-16 23:29:11 -04:00
13bf851ab5 fix(23-06): wire auto_report webhook branch to autoPostAcknowledgment
Replace the unguarded generateAndPostAcknowledgment(campaignId) direct
call in runGatedPhishingStages' auto_report branch with the idempotent
autoPostAcknowledgment(campaignId, 'system:auto_report'). Closes CR-01
(23-REVIEW.md) / Truth #18 (23-VERIFICATION.md): a repeat ticket-create
webhook joining an already-acknowledged USER_AWARENESS campaign now
finds the persisted remediation_actions row and skips the re-post
instead of re-sending the customer-visible thank-you note on every
additional report.
2026-07-16 23:18:47 -04:00
c79af9b448 feat(23-06): add idempotent autoPostAcknowledgment to remediation-service
- New autoPostAcknowledgment(campaignId, actor) mirrors the VERIFIED
  remediateApprovedActions shape: campaign row lock, idempotency check
  against an existing acknowledge_user remediation_actions row, insert +
  audit inside one transaction, note post after commit (non-fatal on
  failure)
- Closes CR-01/WR-01: gives the auto_report webhook path a persisted
  record so a repeat ticket-create webhook joining an already-acked
  campaign does not re-insert/re-audit/re-post
- Adds Test A/B/C in remediation-service.test.ts covering first-pass
  insert, idempotent skip, and non-fatal note-post failure
2026-07-16 23:17:28 -04:00
e1193bf476 feat(23-05): wire gated parse->classify->acknowledge chain into webhook
- triggerPhishingDetection now captures groupReportIntoCampaign's result and,
  when a campaignId exists, calls new runGatedPhishingStages
- runGatedPhishingStages reads the per-company automation gate and
  conditionally runs parseAndStoreMessage, classifyCampaign, and (only for
  USER_AWARENESS verdicts) generateAndPostAcknowledgment
- each stage isolated in its own try/catch (T-23-09); detection + grouping
  remain unconditional (D-07); auto_report never posts any other action
  (D-04, T-23-08)
2026-07-16 19:46:15 -04:00
e0f22f27c9 feat(23-05): implement getCompanyAutomationGate reader
- COALESCE(..., false) query keyed on company_id; absent row/null/NaN -> all-false
- never throws; type-check and vitest suite pass
2026-07-16 19:45:41 -04:00
0d7974cdd9 test(23-05): add failing tests for getCompanyAutomationGate reader
- covers absent-row, present-row mapping, null/NaN companyId short-circuit
2026-07-16 19:45:04 -04:00
6224e44219 feat(23-01): wire acknowledge_user manual-path real note post into remediateApprovedActions
- remediateApprovedActions now captures the transaction's RemediateResult,
  then post-commit checks whether an approved acknowledge_user row was
  transitioned this pass (alreadyCompleted === false) and, if so, calls
  generateAndPostAcknowledgment(campaignId) exactly once
- Call happens outside the DB transaction (network I/O hazard) and is
  wrapped in its own try/catch that logs and swallows failures -- the DB
  transition has already committed
- Every other action type (block_sender, purge_message, warn_user,
  reset_password, isolate_endpoint, disable_forwarding_rule, quarantine)
  remains a simulated status-only transition, unchanged
- Updated top-of-file D-01 doc comment to record the narrow D-04 carve-out
- Tests: acknowledge_user IS posted once when remediated, NOT called for
  block_sender/warn_user-only remediation, NOT called on idempotent re-run
  of an already-completed acknowledge_user row, and a post rejection does
  not propagate out of remediateApprovedActions
2026-07-16 19:39:13 -04:00
50e241592c feat(23-01): add generateAndPostAcknowledgment customer-visible note writer
- New generateAndPostAcknowledgment(campaignId) posts a short, appreciative
  thank-you note to every ticket linked to a campaign, using noteType 18
  (Client Portal Note, verified live against tenant's TicketNotes field
  metadata) so the note is customer-visible; publish stays 1 unchanged
- Body is a fixed template with zero evidence/URL/classification
  interpolation (T-23-01) -- not the evidence-dump formatTriageNote() template
- Mirrors generateAndPostTriageNote's per-ticket try/catch-in-loop error
  isolation and { noteText, tickets } return shape
- Tests: noteType 18 + publish 1 payload assertion, per-ticket failure
  isolation, and zero-linked-reports case
2026-07-16 19:37:56 -04:00
14ed8ca248 feat(23-01): add USER_AWARENESS verdict + acknowledge_user action mapping
- Add USER_AWARENESS to the Verdict union in campaign-classifier.ts
- mapVerdictToActions('USER_AWARENESS') returns ['acknowledge_user']; not added to DESTRUCTIVE_ACTIONS so requires_approval computes false
- classifyCampaign's simulation branch now assigns verdict = 'USER_AWARENESS' directly instead of falling through to evaluateSpamVsUnwanted
- deriveDefaultParams('acknowledge_user') returns {} (no operator-editable params)
- Widen TriageNoteEvidence.verdict to admit 'USER_AWARENESS' (pure type widen, no formatting change)
- Tests: classifier simulation fixtures now assert USER_AWARENESS/acknowledge_user/requiresApproval=false; new mapVerdictToActions/computeRequiresApproval/deriveDefaultParams cases
2026-07-16 19:36:53 -04:00
12250c1e1d test(260716-n46): add coverage for getMimecastClientForTenant
Covers the already-implemented per-tenant factory: returns a MimecastClient
instance, builds a new independent instance per call (never the cached
global), doesn't affect getMimecastClient()'s singleton, and defaults
base_url when omitted. Uses fake credentials only.
2026-07-16 16:44:54 -04:00
7c724cc489 feat(260716-n46): support per-tenant client injection + surface swallowed delivered-search errors
- getBlastRadius(input, options?) accepts an optional injected MimecastClient
  and cacheScope; an injected client bypasses the global isMimecastConfigured()
  gate since it carries its own credentials
- cache key namespaced by cacheScope to prevent cross-tenant collisions
- deliveredResult.error (previously swallowed) now rethrown so the outer
  catch converts it to status: unavailable / reason: lookup_failed --
  defense-in-depth against Bug 1 (future end-date rejected by Mimecast)
- test mock hygiene: getMimecastClientMock now cleared in beforeEach
2026-07-16 16:44:23 -04:00
4d54abacae test(260716-n46): add failing tests for tenant client injection + swallowed-error surfacing
- Fake tenant client via options.client bypasses getMimecastClient
- Injected tenant client runs fan-out even when global env unconfigured
- searchDeliveredMessages error field now expected to degrade to unavailable/lookup_failed
2026-07-16 16:43:37 -04:00
d30a49f644 feat(22-01): implement mergeTimeline for reports/classifications/audit merge
- Discriminated union TimelineEntry with report/classification/audit variants
- Ascending sort by createdAt with stable report<classification<audit tie-break
2026-07-16 14:28:27 -04:00
37f6657839 test(22-01): add failing test for mergeTimeline
- Covers ascending chronological sort across reports/classifications/audit
- Asserts discriminant kind + source fields per variant, plus stable tie-break order
2026-07-16 14:27:59 -04:00
86cffc45b8 feat(22-01): implement deriveDefaultParams for the 7 remediation action types
- Pure switch over no_action/warn_user/block_sender/purge_message/
  reset_password/isolate_endpoint/disable_forwarding_rule
- Unknown/future action types fall through to {} rather than throwing
2026-07-16 14:27:33 -04:00
c64a90572d test(22-01): add failing test for deriveDefaultParams
- Covers all 7 known action types plus unknown-type fallback
- Asserts null-evidence empty-string fallback behavior
2026-07-16 14:27:13 -04:00
e619321b4b feat(22-01): implement resolveTicketToCampaign resolver service
- Pure lookup: reports row for a ticket id -> found/reportId/campaignId/ticketNumber
- Parameterized query only (WHERE ticket_id = $1), no requirePermission/NextResponse
2026-07-16 14:26:32 -04:00