Fix unparseable weekday-prefixed dates; surface why attachments get dropped - #93
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
coerceDate()was rejecting dates like"Fri, Nov. 20, 2026 07:30"because none of theDATE_FORMATSentries account for a leading weekday name ("Fri, "), and luxon'sMMMtoken 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."Attachment(s) dropped from message."TRACK log had no reason in its title, anduploadViaPresignedPost()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 asdetailon 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
DATE_FORMATS_WITH_YEAR/DATE_FORMATS_YEARFREEnever had a weekday-prefix or abbreviated-month-with-period variant, so any date string in that shape (a very commonDate:header / calendar-invite style) fell through every parse attempt and got nullified.uploadViaPresignedPost()'scatch { return false; }and its non-okresponse path threw away all diagnostic information before it ever reached theDroppedAttachmentrecord — likely reason forupload_failed(expired/mismatched presigned POST policy, network error, etc.) was unrecoverable after the fact.Changes
src/classifier/coerce-workflow-data.ts: addedWEEKDAY_PREFIXandABBREV_MONTH_PERIODstripping to the date-cleaning step.src/isolated/content-sanitizer.ts:uploadViaPresignedPost()now returns{ ok: true } | { ok: false; detail: string }instead of a bare boolean;DroppedAttachmentgained an optionaldetailfield; the dropped-attachments TRACK log title now includes a reason-count summary.src/processor/content-sanitizer-client.ts: mirrored thedetailfield on the wire type.src/processor/processor.ts: mirrored the reason-summary +detailin 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) passesnpx tsc --noEmit— clean2026-11-20T07:30Generated by Claude Code