Skip to content

Fix unparseable weekday-prefixed dates; surface why attachments get dropped - #93

Merged
wparad merged 2 commits into
mainfrom
claude/ses-email-adapter-errors-n03c6n
Aug 27, 2026
Merged

Fix unparseable weekday-prefixed dates; surface why attachments get dropped#93
wparad merged 2 commits into
mainfrom
claude/ses-email-adapter-errors-n03c6n

Conversation

@wparad

@wparad wparad commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • coerceDate() was rejecting dates like "Fri, Nov. 20, 2026 07:30" because none of the DATE_FORMATS entries account for a leading weekday name ("Fri, "), and luxon's MMM token doesn't match an abbreviated month with a trailing period ("Nov."). Both are now stripped before format-based parsing, alongside the existing locale-noise stripping.
  • The "Attachment(s) dropped from message." TRACK log had no reason in its title, and uploadViaPresignedPost() silently discarded the actual HTTP status/body (or thrown error) on failure — so there was no way to tell why an upload failed even by digging into the log payload. The failure detail is now captured as detail on each dropped attachment, and the log title includes a reason breakdown (e.g. "Attachment(s) dropped from message: 2 too_large, 1 upload_failed."). Same fix applied to the mirrored TRACK log in the processor.

Root causes

  1. Date parsing: DATE_FORMATS_WITH_YEAR/DATE_FORMATS_YEARFREE never had a weekday-prefix or abbreviated-month-with-period variant, so any date string in that shape (a very common Date: header / calendar-invite style) fell through every parse attempt and got nullified.
  2. Attachment drops missing "why": uploadViaPresignedPost()'s catch { return false; } and its non-ok response path threw away all diagnostic information before it ever reached the DroppedAttachment record — likely reason for upload_failed (expired/mismatched presigned POST policy, network error, etc.) was unrecoverable after the fact.

Changes

  • src/classifier/coerce-workflow-data.ts: added WEEKDAY_PREFIX and ABBREV_MONTH_PERIOD stripping to the date-cleaning step.
  • src/isolated/content-sanitizer.ts: uploadViaPresignedPost() now returns { ok: true } | { ok: false; detail: string } instead of a bare boolean; DroppedAttachment gained an optional detail field; the dropped-attachments TRACK log title now includes a reason-count summary.
  • src/processor/content-sanitizer-client.ts: mirrored the detail field on the wire type.
  • src/processor/processor.ts: mirrored the reason-summary + detail in the processor's own dropped-attachments log.
  • tests/classifier/coerce-date.spec.ts: added coverage for the weekday-prefix / abbreviated-month-period cases, including the originally-reported "Fri, Nov. 20, 2026 07:30".

Test plan

  • npx vitest run — full suite (2913 tests) passes
  • npx tsc --noEmit — clean
  • New tests reproduce the originally-reported unparseable date and confirm it now parses to 2026-11-20T07:30

Generated by Claude Code

claude added 2 commits August 27, 2026 07:43
…ace why attachments get dropped

coerceDate() rejected dates like "Fri, Nov. 20, 2026 07:30" because no
DATE_FORMATS entry accounts for a leading weekday name, and luxon's "MMM"
token doesn't match an abbreviated month with a trailing period. Strip both
before format-based parsing.

The "Attachment(s) dropped from message." TRACK log had no reason in its
title, and uploadViaPresignedPost() silently swallowed the actual HTTP
status/error behind every "upload_failed" drop, so there was no way to tell
why an upload failed even by digging into the payload. Capture the failing
response status/body (or caught error) as a `detail` on the dropped
attachment, and put a reason breakdown (e.g. "2 too_large, 1 upload_failed")
in the log title itself.
…e detail in the log title

Replace the hardcoded English weekday-name and month-abbreviation regexes with
luxon's own locale-aware "ccc"/"cccc" weekday tokens and a generated
period-tolerant "MMM." variant of the existing format list. Locale hints
(already supported for month names) now also resolve weekday prefixes in any
language instead of only matching English weekday names — verified with a
French "ven." (vendredi) case alongside the original "Fri, Nov. 20, 2026" one.

Also: the dropped-attachments TRACK log put the S3 upload failure detail only
in the payload's `detail` field, with the title showing just the word
"upload_failed". The title now includes the actual failure text (HTTP status
+ S3 error body, or the caught error message) for each such entry, so the why
is visible without digging into the log payload.
@wparad
wparad merged commit 2c7e1d4 into main Aug 27, 2026
6 checks passed
@wparad
wparad deleted the claude/ses-email-adapter-errors-n03c6n branch August 27, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants