Add seeded environment data, provenance, statistics, and dataset card
Browse files- LICENSES.md +7 -0
- README.md +33 -0
- metadata/task-fixtures.json +339 -0
- preparation/build_enron_seed.py +616 -0
- preparation/generate_maildir.py +240 -0
- preparation/seed_roundcube.py +117 -0
- release-manifest.json +58 -0
- seed_assets/contacts.json +0 -0
- seed_assets/manifest.json +43 -0
- seed_assets/messages.jsonl.gz +3 -0
LICENSES.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Source licenses and attribution
|
| 2 |
+
|
| 3 |
+
The primary CMU/CALO source is publicly distributed for research, but no explicit open redistribution license was established from its primary documentation. This private release preserves source attribution and does not assert CC0 or assign a new blanket license to the corpus or synthetic task fixtures.
|
| 4 |
+
|
| 5 |
+
The direct source is the CMU/CALO Enron Email Dataset, sampled from the `shackleton-s` mailbox of Sara Shackleton. The source corpus derives from Enron email made public through the FERC investigation. This release uses the CMU/CALO edition, not the EDO/PST edition.
|
| 6 |
+
|
| 7 |
+
No blanket license is assigned to components whose reuse terms are undocumented. Source-specific declarations and per-item notices describe their respective content. Synthetic benchmark fixtures are identified separately from source-derived records.
|
README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: "Thunderbird Data"
|
| 3 |
+
tags:
|
| 4 |
+
- webarena-pro
|
| 5 |
+
- web-agents
|
| 6 |
+
- benchmark-environment
|
| 7 |
+
- text
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
**Thunderbird Data** provides email and address-book seed assets for WebArena-Pro’s Thunderbird environment, a locally hosted email application implemented with Roundcube, Dovecot, and a local SMTP simulator for evaluating web agents. It supports mailbox browsing, search, replies, folders, contacts, and message-state workflows.
|
| 11 |
+
|
| 12 |
+
The direct source is the CMU/CALO Enron Email Dataset, sampled from the `shackleton-s` mailbox of Sara Shackleton. The source corpus derives from Enron email made public through the FERC investigation. This release uses the CMU/CALO edition, not the EDO/PST edition.
|
| 13 |
+
|
| 14 |
+
We prepared the released content for local use in the environment:
|
| 15 |
+
|
| 16 |
+
- Selected a deterministic sample of 5,000 corpus messages.
|
| 17 |
+
- Mapped the primary mailbox to Alice Chen and generated local correspondent identities; normalized dates and retained thread relationships.
|
| 18 |
+
- Removed quoted reply history where specified by the preparation pipeline and combined corpus inputs with separate task-specific email fixtures.
|
| 19 |
+
|
| 20 |
+
| Statistic | Value |
|
| 21 |
+
|---|---:|
|
| 22 |
+
| Sampled corpus messages | 5000 |
|
| 23 |
+
| Generated corpus correspondents | 4510 |
|
| 24 |
+
| Threaded replies | 1525 |
|
| 25 |
+
| Messages with stripped reply history | 1311 |
|
| 26 |
+
| Local release files before documentation | 7 |
|
| 27 |
+
| Local payload size | 2,944,496 bytes (2.94 MB / 2.81 MiB) |
|
| 28 |
+
|
| 29 |
+
Compressed corpus messages, contacts, and the manifest are under `seed_assets/`; original task fixtures are under `metadata/`; preparation and import scripts are under `preparation/`. The source corpus itself is not redistributed in full.
|
| 30 |
+
|
| 31 |
+
The primary CMU/CALO source is publicly distributed for research, but no explicit open redistribution license was established from its primary documentation. This private release preserves source attribution and does not assert CC0 or assign a new blanket license to the corpus or synthetic task fixtures.
|
| 32 |
+
|
| 33 |
+
The application is maintained in the [WebArena-Pro repository](https://github.com/McGill-NLP/webarena-pro).
|
metadata/task-fixtures.json
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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+
"name": "Alice Chen",
|
| 7 |
+
"password": "User@Secure123",
|
| 8 |
+
"role": "Lead Developer"
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
"email": "bob@techcorp.local",
|
| 12 |
+
"name": "Bob Martin",
|
| 13 |
+
"password": "User@Secure123",
|
| 14 |
+
"role": "Project Manager"
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"email": "carol@techcorp.local",
|
| 18 |
+
"name": "Carol White",
|
| 19 |
+
"password": "User@Secure123",
|
| 20 |
+
"role": "UX Designer"
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"email": "david@techcorp.local",
|
| 24 |
+
"name": "David Kim",
|
| 25 |
+
"password": "User@Secure123",
|
| 26 |
+
"role": "QA Engineer"
|
| 27 |
+
}
|
| 28 |
+
],
|
| 29 |
+
"emails": [
|
| 30 |
+
{
|
| 31 |
+
"id": "msg-001",
|
| 32 |
+
"message_id": "<20260105-001@techcorp.local>",
|
| 33 |
+
"from": "alice@techcorp.local",
|
| 34 |
+
"to": ["david@techcorp.local"],
|
| 35 |
+
"subject": "Welcome to the Team!",
|
| 36 |
+
"date": "2026-01-05T09:00:00",
|
| 37 |
+
"body": "Hi David,\n\nWelcome to TechCorp! We're thrilled to have you on board as our new QA Engineer.\n\nYour first week will include:\n- Monday: HR onboarding and office tour\n- Tuesday: Meet the engineering team\n- Wednesday: Set up your dev environment (I'll pair with you)\n- Thursday: First look at our test suite\n- Friday: Sprint planning meeting\n\nFeel free to reach out anytime if you have questions. My desk is right next to the coffee machine — come say hi!\n\nLooking forward to working with you,\nAlice",
|
| 38 |
+
"delivery": {
|
| 39 |
+
"alice@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 40 |
+
"david@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen"]}
|
| 41 |
+
}
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"id": "msg-002",
|
| 45 |
+
"message_id": "<20260115-001@techcorp.local>",
|
| 46 |
+
"from": "bob@techcorp.local",
|
| 47 |
+
"to": ["alice@techcorp.local", "carol@techcorp.local", "david@techcorp.local"],
|
| 48 |
+
"subject": "Q1 2026 Planning Meeting - Action Items",
|
| 49 |
+
"date": "2026-01-15T14:30:00",
|
| 50 |
+
"body": "Hi team,\n\nGreat discussion today! Here's a summary of action items from the Q1 planning meeting:\n\n1. Alice: Finalize the API refactor by Jan 31\n2. Carol: Deliver updated design system components by Feb 5\n3. David: Set up automated regression test suite by Jan 28\n4. All: Review and comment on the Q1 roadmap doc (link in Notion)\n\nKey milestones:\n- Feb 1: Internal beta of new dashboard\n- Mar 1: Public beta release\n- Mar 31: GA launch\n\nLet's sync again next Monday at 10am. Calendar invite to follow.\n\nThanks,\nBob",
|
| 51 |
+
"delivery": {
|
| 52 |
+
"bob@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 53 |
+
"alice@techcorp.local": {"folder": "Work", "flags": ["\\Seen"]},
|
| 54 |
+
"carol@techcorp.local": {"folder": "Archive", "flags": ["\\Seen"]},
|
| 55 |
+
"david@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen"]}
|
| 56 |
+
}
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"id": "msg-003",
|
| 60 |
+
"message_id": "<20260116-001@techcorp.local>",
|
| 61 |
+
"from": "alice@techcorp.local",
|
| 62 |
+
"to": ["bob@techcorp.local"],
|
| 63 |
+
"subject": "Re: Q1 2026 Planning Meeting - Action Items",
|
| 64 |
+
"date": "2026-01-16T09:15:00",
|
| 65 |
+
"in_reply_to": "<20260115-001@techcorp.local>",
|
| 66 |
+
"references": ["<20260115-001@techcorp.local>"],
|
| 67 |
+
"body": "Hi Bob,\n\nThanks for the summary! The API refactor timeline looks achievable.\n\nOne concern: the authentication module still has some tech debt that might slow things down. I'll schedule a 30-min review with you this week to walk through it — shouldn't be a blocker but good to have visibility.\n\nAlso, I'll need Carol's updated button components before I can finish the API integration layer. Can we sync on that dependency?\n\nCheers,\nAlice\n\n---\nOn Jan 15, Bob Martin wrote:\n> Hi team,\n> Great discussion today! Here's a summary of action items...",
|
| 68 |
+
"delivery": {
|
| 69 |
+
"alice@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 70 |
+
"bob@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen"]}
|
| 71 |
+
}
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"id": "msg-004",
|
| 75 |
+
"message_id": "<20260117-001@techcorp.local>",
|
| 76 |
+
"from": "david@techcorp.local",
|
| 77 |
+
"to": ["bob@techcorp.local"],
|
| 78 |
+
"subject": "Re: Q1 2026 Planning Meeting - Action Items",
|
| 79 |
+
"date": "2026-01-17T11:00:00",
|
| 80 |
+
"in_reply_to": "<20260115-001@techcorp.local>",
|
| 81 |
+
"references": ["<20260115-001@techcorp.local>"],
|
| 82 |
+
"body": "Hi Bob,\n\nJan 28 deadline for the regression suite works for me. I've already started outlining the test cases for the payment flow.\n\nQuestion: should I include end-to-end tests covering the new API endpoints Alice is refactoring? I want to make sure I'm not duplicating what the unit tests already cover.\n\nThanks,\nDavid\n\n---\nOn Jan 15, Bob Martin wrote:\n> Hi team,\n> Great discussion today!...",
|
| 83 |
+
"delivery": {
|
| 84 |
+
"david@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 85 |
+
"bob@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen"]}
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
{
|
| 89 |
+
"id": "msg-005",
|
| 90 |
+
"message_id": "<20260118-001@techcorp.local>",
|
| 91 |
+
"from": "bob@techcorp.local",
|
| 92 |
+
"to": ["david@techcorp.local", "alice@techcorp.local"],
|
| 93 |
+
"subject": "Re: Q1 2026 Planning Meeting - Action Items",
|
| 94 |
+
"date": "2026-01-18T15:45:00",
|
| 95 |
+
"in_reply_to": "<20260117-001@techcorp.local>",
|
| 96 |
+
"references": ["<20260115-001@techcorp.local>", "<20260117-001@techcorp.local>"],
|
| 97 |
+
"body": "David,\n\nYes, please include E2E tests for Alice's new endpoints. Alice can share the Swagger spec once the refactor is 50% done.\n\nAlice — can you send David the API spec draft by Monday?\n\nThanks both,\nBob",
|
| 98 |
+
"delivery": {
|
| 99 |
+
"bob@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 100 |
+
"david@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen"]},
|
| 101 |
+
"alice@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen"]}
|
| 102 |
+
}
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"id": "msg-006",
|
| 106 |
+
"message_id": "<20260210-001@techcorp.local>",
|
| 107 |
+
"from": "carol@techcorp.local",
|
| 108 |
+
"to": ["alice@techcorp.local", "bob@techcorp.local"],
|
| 109 |
+
"subject": "Design Review: New Dashboard Mockups",
|
| 110 |
+
"date": "2026-02-10T10:00:00",
|
| 111 |
+
"body": "Hi Alice and Bob,\n\nI've finished the first round of mockups for the new dashboard. Key changes:\n\n1. Sidebar redesign — collapsible with icon-only mode\n2. Card-based layout for metrics (replaces the old table)\n3. New color palette (accessible AA compliant)\n4. Mobile-responsive breakpoints added\n\nFigma link: [View Mockups in Figma]\n\nI'd love feedback on the sidebar behavior before I start the hi-fi version. Specifically:\n- Should collapsed state persist across sessions?\n- Any objections to the card layout for the mobile view?\n\nLooking forward to your thoughts!\nCarol",
|
| 112 |
+
"delivery": {
|
| 113 |
+
"carol@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 114 |
+
"alice@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen"]},
|
| 115 |
+
"bob@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen"]}
|
| 116 |
+
}
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"id": "msg-007",
|
| 120 |
+
"message_id": "<20260211-001@techcorp.local>",
|
| 121 |
+
"from": "alice@techcorp.local",
|
| 122 |
+
"to": ["carol@techcorp.local"],
|
| 123 |
+
"subject": "Re: Design Review: New Dashboard Mockups",
|
| 124 |
+
"date": "2026-02-11T14:20:00",
|
| 125 |
+
"in_reply_to": "<20260210-001@techcorp.local>",
|
| 126 |
+
"references": ["<20260210-001@techcorp.local>"],
|
| 127 |
+
"body": "Hi Carol,\n\nLove the new direction! The card layout is a huge improvement.\n\nAnswers to your questions:\n1. Yes, sidebar state should definitely persist — I'll add it as a user preference in the API response.\n2. Card layout on mobile looks great. No objections.\n\nOne request: could you add an empty state design for the metrics cards? We'll need it for new users with no data yet.\n\nGreat work!\nAlice\n\n---\nOn Feb 10, Carol White wrote:\n> Hi Alice and Bob,\n> I've finished the first round of mockups...",
|
| 128 |
+
"delivery": {
|
| 129 |
+
"alice@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 130 |
+
"carol@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen"]}
|
| 131 |
+
}
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"id": "msg-008",
|
| 135 |
+
"message_id": "<20260220-001@techcorp.local>",
|
| 136 |
+
"from": "alice@techcorp.local",
|
| 137 |
+
"to": ["carol@techcorp.local"],
|
| 138 |
+
"subject": "Brand Guidelines Update - Action Required",
|
| 139 |
+
"date": "2026-02-20T11:30:00",
|
| 140 |
+
"body": "Hi Carol,\n\nThe brand team sent over the updated guidelines. A few things affect our product:\n\n1. New primary blue: #1A56DB (was #2563EB)\n2. Body font changed to Inter (was system-ui)\n3. Border-radius on buttons updated to 8px (was 6px)\n\nCan you update the component library before the Feb 28 code freeze? The changes are small but we want everything consistent for the beta.\n\nFull guidelines doc attached (PDF).\n\nThanks,\nAlice",
|
| 141 |
+
"delivery": {
|
| 142 |
+
"alice@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 143 |
+
"carol@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen"]}
|
| 144 |
+
}
|
| 145 |
+
},
|
| 146 |
+
{
|
| 147 |
+
"id": "msg-009",
|
| 148 |
+
"message_id": "<20260301-001@techcorp.local>",
|
| 149 |
+
"from": "alice@techcorp.local",
|
| 150 |
+
"to": ["bob@techcorp.local"],
|
| 151 |
+
"subject": "Sprint Planning Notes - Sprint 14",
|
| 152 |
+
"date": "2026-03-01T16:00:00",
|
| 153 |
+
"body": "Hi Bob,\n\nNotes from today's sprint planning:\n\nCommitted stories:\n- AUTH-234: OAuth2 token refresh (Alice, 5pts)\n- DASH-89: Export to CSV feature (Alice, 3pts)\n- UI-45: Notification badge component (Carol, 2pts)\n- QA-67: Smoke test automation (David, 8pts)\n\nDeferred to Sprint 15:\n- PERF-12: Redis caching layer (needs architecture review)\n\nVelocity: 18pts (team capacity is 20pts, leaving buffer for bugs)\n\nSprint 14 ends March 15. Demo on March 16 at 2pm.\n\nAlice",
|
| 154 |
+
"delivery": {
|
| 155 |
+
"alice@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 156 |
+
"bob@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen"]}
|
| 157 |
+
}
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"id": "msg-010",
|
| 161 |
+
"message_id": "<20260303-001@techcorp.local>",
|
| 162 |
+
"from": "david@techcorp.local",
|
| 163 |
+
"to": ["alice@techcorp.local"],
|
| 164 |
+
"subject": "Critical Bug: Payment Processing Failure on Checkout",
|
| 165 |
+
"date": "2026-03-03T08:45:00",
|
| 166 |
+
"body": "Hi Alice,\n\nFound a critical bug in staging — payment processing fails for orders over $999.99.\n\nSteps to reproduce:\n1. Add items totaling $1000+ to cart\n2. Proceed to checkout\n3. Enter any valid card details\n4. Click \"Pay Now\"\n\nExpected: Payment processes successfully\nActual: 500 error — \"Invalid amount format\"\n\nStack trace (truncated):\n PaymentService.processCharge(amount=1000.00) → TypeError: amount exceeds MAX_INT16\n\nRoot cause (my guess): amount field is int16 in the payment service. Should be int32 or decimal.\n\nThis will block the beta launch. Marking as P0.\n\nDavid",
|
| 167 |
+
"delivery": {
|
| 168 |
+
"david@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 169 |
+
"alice@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen", "\\Answered"]}
|
| 170 |
+
}
|
| 171 |
+
},
|
| 172 |
+
{
|
| 173 |
+
"id": "msg-011",
|
| 174 |
+
"message_id": "<20260303-002@techcorp.local>",
|
| 175 |
+
"from": "alice@techcorp.local",
|
| 176 |
+
"to": ["david@techcorp.local"],
|
| 177 |
+
"subject": "Re: Critical Bug: Payment Processing Failure on Checkout",
|
| 178 |
+
"date": "2026-03-03T09:30:00",
|
| 179 |
+
"in_reply_to": "<20260303-001@techcorp.local>",
|
| 180 |
+
"references": ["<20260303-001@techcorp.local>"],
|
| 181 |
+
"body": "David,\n\nGood catch — you're right. The amount field in PaymentService was declared as SMALLINT. Fixed in branch `fix/payment-amount-overflow`.\n\nChanges:\n- Migrated `amount` column from SMALLINT to NUMERIC(12,2)\n- Added server-side validation (max $999,999.99)\n- Added regression test in PaymentServiceTest.java\n\nPR: #412 — please review ASAP so we can get this merged today.\n\nAlice\n\n---\nOn Mar 3, David Kim wrote:\n> Found a critical bug in staging...",
|
| 182 |
+
"delivery": {
|
| 183 |
+
"alice@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 184 |
+
"david@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen", "\\Answered"]}
|
| 185 |
+
}
|
| 186 |
+
},
|
| 187 |
+
{
|
| 188 |
+
"id": "msg-012",
|
| 189 |
+
"message_id": "<20260304-001@techcorp.local>",
|
| 190 |
+
"from": "bob@techcorp.local",
|
| 191 |
+
"to": ["carol@techcorp.local"],
|
| 192 |
+
"subject": "Fwd: Critical Bug: Payment Processing Failure on Checkout",
|
| 193 |
+
"date": "2026-03-04T10:00:00",
|
| 194 |
+
"in_reply_to": "<20260303-001@techcorp.local>",
|
| 195 |
+
"references": ["<20260303-001@techcorp.local>"],
|
| 196 |
+
"body": "Carol,\n\nFYI — Alice is fixing this today. Just wanted you to be aware in case there are any UI-side error handling screens we should update.\n\nLet me know if the current error messages cover the payment failure case.\n\nBob\n\n-------- Forwarded Message --------\nFrom: David Kim <david@techcorp.local>\nDate: Mon, 03 Mar 2026 08:45:00\nSubject: Critical Bug: Payment Processing Failure on Checkout\nTo: alice@techcorp.local\n\nHi Alice,\n\nFound a critical bug in staging — payment processing fails for orders over $999.99...",
|
| 197 |
+
"delivery": {
|
| 198 |
+
"bob@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 199 |
+
"carol@techcorp.local": {"folder": "INBOX", "flags": []}
|
| 200 |
+
}
|
| 201 |
+
},
|
| 202 |
+
{
|
| 203 |
+
"id": "msg-013",
|
| 204 |
+
"message_id": "<20260307-001@techcorp.local>",
|
| 205 |
+
"from": "carol@techcorp.local",
|
| 206 |
+
"to": ["david@techcorp.local"],
|
| 207 |
+
"subject": "UI Testing Request: Dashboard Redesign",
|
| 208 |
+
"date": "2026-03-07T13:00:00",
|
| 209 |
+
"body": "Hi David,\n\nThe dashboard redesign components are ready for QA. Can you run through the test cases in TestRail under project \"Dashboard v2\"?\n\nPriority flows to test:\n1. Widget drag-and-drop (Chrome + Firefox)\n2. Date range picker (all browsers)\n3. CSV export button (verify download triggers)\n4. Mobile layout at 375px and 768px\n\nKnown issue to skip: The tooltip on the bar chart flickers in Safari — I have a ticket open for that.\n\nLet me know if anything's unclear!\nCarol",
|
| 210 |
+
"delivery": {
|
| 211 |
+
"carol@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 212 |
+
"david@techcorp.local": {"folder": "INBOX", "flags": []}
|
| 213 |
+
}
|
| 214 |
+
},
|
| 215 |
+
{
|
| 216 |
+
"id": "msg-014",
|
| 217 |
+
"message_id": "<20260308-001@techcorp.local>",
|
| 218 |
+
"from": "david@techcorp.local",
|
| 219 |
+
"to": ["carol@techcorp.local"],
|
| 220 |
+
"subject": "Re: UI Testing Request: Dashboard Redesign",
|
| 221 |
+
"date": "2026-03-08T16:45:00",
|
| 222 |
+
"in_reply_to": "<20260307-001@techcorp.local>",
|
| 223 |
+
"references": ["<20260307-001@techcorp.local>"],
|
| 224 |
+
"body": "Hi Carol,\n\nTest results for Dashboard v2:\n\nPASS:\n- Widget drag-and-drop: Chrome 122, Firefox 124 ✓\n- Date range picker: Chrome, Firefox, Edge ✓\n- CSV export: Chrome, Firefox ✓\n- Mobile 375px: ✓\n- Mobile 768px: ✓\n\nFAIL:\n- CSV export in Safari 17.3 — download doesn't trigger (new issue, separate from your tooltip bug)\n- Date range picker on Edge: loses focus after selecting start date (intermittent)\n\nI've opened tickets QA-78 and QA-79 for the failures. Let me know if you need screen recordings.\n\nDavid",
|
| 225 |
+
"delivery": {
|
| 226 |
+
"david@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 227 |
+
"carol@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen"]}
|
| 228 |
+
}
|
| 229 |
+
},
|
| 230 |
+
{
|
| 231 |
+
"id": "msg-015",
|
| 232 |
+
"message_id": "<20260310-001@techcorp.local>",
|
| 233 |
+
"from": "bob@techcorp.local",
|
| 234 |
+
"to": ["alice@techcorp.local"],
|
| 235 |
+
"subject": "Weekly Status Update - Week of March 10",
|
| 236 |
+
"date": "2026-03-10T08:00:00",
|
| 237 |
+
"body": "Hi Alice,\n\nWeekly status update for stakeholders. Please review and add your section before I send it at 5pm today.\n\n--- Engineering (please fill in) ---\n\nCompleted this week:\n- [Alice to fill in]\n\nIn progress:\n- [Alice to fill in]\n\nBlockers:\n- [Alice to fill in]\n\n--- PM section (Bob) ---\n\nCompleted:\n- Finalized scope for Sprint 15\n- Met with design to prioritize Q2 features\n\nIn progress:\n- Coordinating with marketing on beta launch plan\n\nThanks,\nBob",
|
| 238 |
+
"delivery": {
|
| 239 |
+
"bob@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 240 |
+
"alice@techcorp.local": {"folder": "INBOX", "flags": []}
|
| 241 |
+
}
|
| 242 |
+
},
|
| 243 |
+
{
|
| 244 |
+
"id": "msg-016",
|
| 245 |
+
"message_id": "<20260315-001@techcorp.local>",
|
| 246 |
+
"from": "carol@techcorp.local",
|
| 247 |
+
"to": ["alice@techcorp.local", "bob@techcorp.local", "david@techcorp.local"],
|
| 248 |
+
"subject": "Team Lunch Friday? 🍕",
|
| 249 |
+
"date": "2026-03-15T12:30:00",
|
| 250 |
+
"body": "Hey team,\n\nHow does everyone feel about a team lunch this Friday to celebrate hitting the internal beta milestone?\n\nWe agreed on pizza from Pizzeria Napoli on Main St — they do a great group lunch set. The menu name for our planning space should be Pizza.\n\nOptions:\n- 12:00pm\n- 12:30pm\n- 1:00pm\n\nReply with your preference and any dietary restrictions. I'll book once I hear from everyone!\n\nCarol",
|
| 251 |
+
"delivery": {
|
| 252 |
+
"carol@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 253 |
+
"alice@techcorp.local": {"folder": "INBOX", "flags": []},
|
| 254 |
+
"bob@techcorp.local": {"folder": "INBOX", "flags": []},
|
| 255 |
+
"david@techcorp.local": {"folder": "INBOX", "flags": []}
|
| 256 |
+
}
|
| 257 |
+
},
|
| 258 |
+
{
|
| 259 |
+
"id": "msg-017",
|
| 260 |
+
"message_id": "<20260318-001@techcorp.local>",
|
| 261 |
+
"from": "bob@techcorp.local",
|
| 262 |
+
"to": ["alice@techcorp.local", "carol@techcorp.local", "david@techcorp.local"],
|
| 263 |
+
"subject": "Sprint Review Tomorrow - 2pm",
|
| 264 |
+
"date": "2026-03-18T09:00:00",
|
| 265 |
+
"body": "Hi everyone,\n\nReminder: Sprint 14 Review is tomorrow (Wednesday) at 2pm in the Maple conference room.\n\nPresentation order:\n1. Alice: API refactor demo (10 min)\n2. Carol: Dashboard UI walkthrough (15 min)\n3. David: QA smoke test suite demo (10 min)\n4. Bob: Sprint metrics and Q2 preview (5 min)\n\nPlease make sure your demos are running in staging before the meeting. Zoom link for remote attendees in the calendar invite.\n\nSee you there!\nBob",
|
| 266 |
+
"delivery": {
|
| 267 |
+
"bob@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 268 |
+
"alice@techcorp.local": {"folder": "INBOX", "flags": []},
|
| 269 |
+
"carol@techcorp.local": {"folder": "INBOX", "flags": []},
|
| 270 |
+
"david@techcorp.local": {"folder": "INBOX", "flags": []}
|
| 271 |
+
}
|
| 272 |
+
},
|
| 273 |
+
{
|
| 274 |
+
"id": "msg-018",
|
| 275 |
+
"message_id": "<20260320-001@techcorp.local>",
|
| 276 |
+
"from": "david@techcorp.local",
|
| 277 |
+
"to": ["alice@techcorp.local"],
|
| 278 |
+
"subject": "Test Suite Results - Week 12",
|
| 279 |
+
"date": "2026-07-11T17:00:00",
|
| 280 |
+
"body": "Hi Alice,\n\nWeek 12 test suite results:\n\nTotal tests: 847\nPassed: 831 (98.1%)\nFailed: 12 (1.4%)\nSkipped: 4 (0.5%)\n\nNew failures this week (all in payment module):\n- PaymentServiceTest::testRefundAmountPrecision (flaky, investigating)\n- PaymentServiceTest::testCurrencyConversionRounding (fails on JDK 21 only)\n\nAll 12 failures are pre-existing from last week — nothing introduced by your latest commits.\n\nFull report attached.\n\nDavid",
|
| 281 |
+
"delivery": {
|
| 282 |
+
"david@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 283 |
+
"alice@techcorp.local": {"folder": "INBOX", "flags": []}
|
| 284 |
+
}
|
| 285 |
+
},
|
| 286 |
+
{
|
| 287 |
+
"id": "msg-019",
|
| 288 |
+
"message_id": "<20251220-001@techcorp.local>",
|
| 289 |
+
"from": "bob@techcorp.local",
|
| 290 |
+
"to": ["alice@techcorp.local"],
|
| 291 |
+
"subject": "Q4 2025 Budget Report",
|
| 292 |
+
"date": "2025-12-20T10:00:00",
|
| 293 |
+
"body": "Hi Alice,\n\nPlease find the Q4 budget report attached. No action needed — just keeping engineering leadership in the loop.\n\nHighlights:\n- Cloud infra spend: $24,300 (3% under budget)\n- Tooling licenses: $8,100 (on target)\n- Headcount: 0 variance\n\nFull report is in the Finance folder in Google Drive.\n\nBob",
|
| 294 |
+
"delivery": {
|
| 295 |
+
"bob@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 296 |
+
"alice@techcorp.local": {"folder": "Trash", "flags": ["\\Seen"]}
|
| 297 |
+
}
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"id": "msg-020",
|
| 301 |
+
"message_id": "<20260312-001@newsletter.example>",
|
| 302 |
+
"from": "noreply@newsletter.example",
|
| 303 |
+
"to": ["alice@techcorp.local"],
|
| 304 |
+
"subject": "TechCrunch Daily: AI dominates Q1 fundraising",
|
| 305 |
+
"date": "2026-03-12T06:00:00",
|
| 306 |
+
"body": "TechCrunch Daily Newsletter\n\nTop Stories:\n- AI dominates Q1 fundraising with $48B raised\n- Apple announces new iPad Pro lineup\n- GitHub Copilot adds voice coding support\n\nThis email was sent to alice@techcorp.local. To unsubscribe, click here.\nTechCrunch, 410 Townsend St, San Francisco, CA 94107",
|
| 307 |
+
"delivery": {
|
| 308 |
+
"alice@techcorp.local": {"folder": "Trash", "flags": []}
|
| 309 |
+
}
|
| 310 |
+
},
|
| 311 |
+
{
|
| 312 |
+
"id": "msg-021",
|
| 313 |
+
"message_id": "<20260305-001@techcorp.local>",
|
| 314 |
+
"from": "david@techcorp.local",
|
| 315 |
+
"to": ["alice@techcorp.local", "carol@techcorp.local"],
|
| 316 |
+
"subject": "Bug Report: Dashboard Widget Loading Spinner",
|
| 317 |
+
"date": "2026-03-05T14:30:00",
|
| 318 |
+
"body": "Hi Alice and Carol,\n\nMinor bug found in Dashboard v2 — the loading spinner for widgets doesn't disappear after data loads in certain edge cases.\n\nReproduction:\n1. Open dashboard with slow network throttling (Fast 3G in DevTools)\n2. Reload the page\n3. Wait for widgets to load\n\nExpected: Spinner disappears after data loads\nActual: Spinner stays visible over the loaded data (z-index issue?)\n\nScreenshot attached. Happy to dig deeper if helpful.\n\nDavid",
|
| 319 |
+
"delivery": {
|
| 320 |
+
"david@techcorp.local": {"folder": "Sent", "flags": ["\\Seen"]},
|
| 321 |
+
"alice@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen"]},
|
| 322 |
+
"carol@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen"]}
|
| 323 |
+
}
|
| 324 |
+
},
|
| 325 |
+
{
|
| 326 |
+
"id": "msg-022",
|
| 327 |
+
"message_id": "<20260301-002@techcorp.local>",
|
| 328 |
+
"from": "alice@techcorp.local",
|
| 329 |
+
"to": ["bob@techcorp.local"],
|
| 330 |
+
"subject": "Security Review: New Auth Endpoints",
|
| 331 |
+
"date": "2026-03-01T11:00:00",
|
| 332 |
+
"body": "Hi Bob,\n\nCompleted the security review for the new OAuth2 endpoints. Summary:\n\nPASS:\n- PKCE implementation correct\n- Token expiry enforced (15min access, 7day refresh)\n- Rate limiting on /auth/token (100 req/min per IP)\n\nACTION REQUIRED:\n- /auth/introspect endpoint returns full token payload — should only return active status and scopes per RFC 7662\n- Missing CORS header validation on /auth/callback\n\nI've opened security tickets SEC-44 and SEC-45. Both are medium severity and should be fixed before beta.\n\nAlice",
|
| 333 |
+
"delivery": {
|
| 334 |
+
"alice@techcorp.local": {"folder": "Work", "flags": ["\\Seen"]},
|
| 335 |
+
"bob@techcorp.local": {"folder": "INBOX", "flags": ["\\Seen"]}
|
| 336 |
+
}
|
| 337 |
+
}
|
| 338 |
+
]
|
| 339 |
+
}
|
preparation/build_enron_seed.py
ADDED
|
@@ -0,0 +1,616 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Build a deterministic, anonymized Thunderbird seed from one Enron mailbox.
|
| 3 |
+
|
| 4 |
+
The input is the extracted CMU CALO Maildir directory for ``shackleton-s``.
|
| 5 |
+
The output contains only the selected/anonymized sample, not the source corpus.
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
from __future__ import annotations
|
| 9 |
+
|
| 10 |
+
import argparse
|
| 11 |
+
import gzip
|
| 12 |
+
import hashlib
|
| 13 |
+
import json
|
| 14 |
+
import re
|
| 15 |
+
from collections import Counter, defaultdict
|
| 16 |
+
from dataclasses import dataclass
|
| 17 |
+
from datetime import datetime, timedelta, timezone
|
| 18 |
+
from email import policy
|
| 19 |
+
from email.message import Message
|
| 20 |
+
from email.parser import BytesParser
|
| 21 |
+
from email.utils import getaddresses, parsedate_to_datetime
|
| 22 |
+
from pathlib import Path
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
SAMPLE_SIZE = 5_000
|
| 26 |
+
RECENT_THROUGH = datetime(2026, 7, 10, 17, 0, tzinfo=timezone.utc)
|
| 27 |
+
PRIMARY_EMAIL = "alice@techcorp.local"
|
| 28 |
+
PRIMARY_NAME = "Alice Chen"
|
| 29 |
+
PRIMARY_PASSWORD = "User@Secure123"
|
| 30 |
+
PRIMARY_SOURCE_MARKERS = ("sara.shackleton", "shackleton.sara")
|
| 31 |
+
CUSTODIANS_FILE = Path(__file__).with_name("enron_custodians.txt")
|
| 32 |
+
SOURCE_YEAR_MIN = 1997
|
| 33 |
+
SOURCE_YEAR_MAX = 2002
|
| 34 |
+
MAX_BODY_CHARS = 200_000
|
| 35 |
+
|
| 36 |
+
EMAIL_RE = re.compile(
|
| 37 |
+
r"(?i)([a-z0-9][a-z0-9._%+/'=-]*@"
|
| 38 |
+
r"[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?"
|
| 39 |
+
r"(?:@[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?)*)"
|
| 40 |
+
)
|
| 41 |
+
SUBJECT_PREFIX_RE = re.compile(r"^\s*(?:(?:re|fw|fwd)\s*:\s*)+", re.IGNORECASE)
|
| 42 |
+
REPLY_SUBJECT_RE = re.compile(r"^\s*re\s*:", re.IGNORECASE)
|
| 43 |
+
QUOTED_HISTORY_MARKERS = (
|
| 44 |
+
re.compile(r"(?im)^\s*-{2,}\s*Original Message\s*-{2,}\s*$"),
|
| 45 |
+
re.compile(r"(?im)^\s*-{2,}\s*Forwarded Message\s*-{2,}\s*$"),
|
| 46 |
+
re.compile(r"(?im)^\s*-{2,}\s*Forwarded by\b"),
|
| 47 |
+
re.compile(r"(?im)^\s*Begin forwarded message:\s*$"),
|
| 48 |
+
re.compile(r"(?im)^\s*On .{3,200} wrote:\s*$"),
|
| 49 |
+
)
|
| 50 |
+
LOTUS_HISTORY_RE = re.compile(
|
| 51 |
+
r"(?ims)^\s*[A-Z][^\n]{1,100}\n"
|
| 52 |
+
r"\s*\d{1,2}/\d{1,2}/\d{2,4}[^\n]*(?:AM|PM)\s*\n"
|
| 53 |
+
r".{0,500}?^\s*To:\s*\S.*?^\s*Subject:\s*\S"
|
| 54 |
+
)
|
| 55 |
+
NAME_TOKEN_RE = re.compile(r"[A-Za-z][A-Za-z'.-]+")
|
| 56 |
+
|
| 57 |
+
FIRST_NAMES = (
|
| 58 |
+
"Avery", "Jordan", "Morgan", "Taylor", "Cameron", "Riley", "Parker", "Quinn",
|
| 59 |
+
"Casey", "Rowan", "Emerson", "Hayden", "Reese", "Skyler", "Finley", "Blake",
|
| 60 |
+
"Drew", "Harper", "Logan", "Micah", "Noel", "Payton", "Robin", "Sage",
|
| 61 |
+
"Alex", "Jamie", "Kendall", "Lane", "Marley", "Nico", "River", "Shawn",
|
| 62 |
+
"Terry", "Winter", "Bailey", "Dakota", "Ellis", "Frankie", "Gray", "Jules",
|
| 63 |
+
)
|
| 64 |
+
LAST_NAMES = (
|
| 65 |
+
"Bennett", "Brooks", "Campbell", "Carter", "Collins", "Cooper", "Diaz", "Ellis",
|
| 66 |
+
"Foster", "Garcia", "Gray", "Green", "Hall", "Hayes", "Howard", "Hughes",
|
| 67 |
+
"James", "Kelly", "Kim", "Lee", "Lewis", "Martin", "Mitchell", "Morgan",
|
| 68 |
+
"Morris", "Murphy", "Nelson", "Parker", "Patel", "Price", "Reed", "Rivera",
|
| 69 |
+
"Roberts", "Ross", "Scott", "Stewart", "Turner", "Walker", "Ward", "Young",
|
| 70 |
+
)
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
@dataclass
|
| 74 |
+
class SourceMessage:
|
| 75 |
+
path: Path
|
| 76 |
+
date: datetime
|
| 77 |
+
sender: tuple[str, str]
|
| 78 |
+
to: list[tuple[str, str]]
|
| 79 |
+
cc: list[tuple[str, str]]
|
| 80 |
+
bcc: list[tuple[str, str]]
|
| 81 |
+
subject: str
|
| 82 |
+
body: str
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def cli() -> argparse.Namespace:
|
| 86 |
+
parser = argparse.ArgumentParser()
|
| 87 |
+
parser.add_argument("source", type=Path, help="Extracted shackleton-s Maildir directory")
|
| 88 |
+
parser.add_argument("output", type=Path, help="Seed asset output directory")
|
| 89 |
+
parser.add_argument("--count", type=int, default=SAMPLE_SIZE)
|
| 90 |
+
return parser.parse_args()
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def normalize_address(value: str) -> str:
|
| 94 |
+
value = value.strip().strip("<>(),;:\"'").lower()
|
| 95 |
+
if value.startswith("mailto:"):
|
| 96 |
+
value = value[7:]
|
| 97 |
+
if "@" not in value or any(char.isspace() for char in value):
|
| 98 |
+
return ""
|
| 99 |
+
parts = value.split("@")
|
| 100 |
+
local, domain = parts[0], parts[-1]
|
| 101 |
+
if not local or not domain:
|
| 102 |
+
return ""
|
| 103 |
+
return f"{local}@{domain}"
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
def addresses(message: Message, header: str) -> list[tuple[str, str]]:
|
| 107 |
+
parsed: list[tuple[str, str]] = []
|
| 108 |
+
seen: set[str] = set()
|
| 109 |
+
for name, address in getaddresses(message.get_all(header, [])):
|
| 110 |
+
address = normalize_address(address)
|
| 111 |
+
if not address or address in seen:
|
| 112 |
+
continue
|
| 113 |
+
seen.add(address)
|
| 114 |
+
parsed.append((str(name).strip(), address))
|
| 115 |
+
return parsed
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
def extract_body(message: Message) -> str:
|
| 119 |
+
parts: list[Message]
|
| 120 |
+
if message.is_multipart():
|
| 121 |
+
parts = [
|
| 122 |
+
part
|
| 123 |
+
for part in message.walk()
|
| 124 |
+
if part.get_content_type() == "text/plain"
|
| 125 |
+
and part.get_content_disposition() != "attachment"
|
| 126 |
+
]
|
| 127 |
+
if not parts:
|
| 128 |
+
parts = [
|
| 129 |
+
part
|
| 130 |
+
for part in message.walk()
|
| 131 |
+
if part.get_content_maintype() == "text"
|
| 132 |
+
and part.get_content_disposition() != "attachment"
|
| 133 |
+
]
|
| 134 |
+
else:
|
| 135 |
+
parts = [message]
|
| 136 |
+
|
| 137 |
+
chunks: list[str] = []
|
| 138 |
+
for part in parts:
|
| 139 |
+
try:
|
| 140 |
+
content = part.get_content()
|
| 141 |
+
except Exception:
|
| 142 |
+
payload = part.get_payload(decode=True) or b""
|
| 143 |
+
content = payload.decode("utf-8", "replace")
|
| 144 |
+
if isinstance(content, str):
|
| 145 |
+
chunks.append(content)
|
| 146 |
+
|
| 147 |
+
body = "\n\n".join(chunks).replace("\x00", "").strip()
|
| 148 |
+
if len(body) > MAX_BODY_CHARS:
|
| 149 |
+
body = body[:MAX_BODY_CHARS].rstrip() + "\n\n[Long source message truncated]"
|
| 150 |
+
return body
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
def strip_quoted_history(body: str, subject: str) -> str:
|
| 154 |
+
"""Keep a reply's new content and represent history through RFC headers.
|
| 155 |
+
|
| 156 |
+
Enron's exported messages often paste the full parent message below an
|
| 157 |
+
Outlook-style separator. Roundcube already understands In-Reply-To and
|
| 158 |
+
References, so retaining that pasted copy makes a thread look like one
|
| 159 |
+
giant flat message instead of a real email conversation.
|
| 160 |
+
"""
|
| 161 |
+
if not REPLY_SUBJECT_RE.match(subject):
|
| 162 |
+
return body
|
| 163 |
+
|
| 164 |
+
cut_points = [
|
| 165 |
+
match.start()
|
| 166 |
+
for pattern in QUOTED_HISTORY_MARKERS
|
| 167 |
+
if (match := pattern.search(body)) is not None
|
| 168 |
+
]
|
| 169 |
+
|
| 170 |
+
# Some exports omit the separator but keep the Outlook header block.
|
| 171 |
+
lines = body.splitlines(keepends=True)
|
| 172 |
+
offsets: list[int] = []
|
| 173 |
+
offset = 0
|
| 174 |
+
for line in lines:
|
| 175 |
+
offsets.append(offset)
|
| 176 |
+
offset += len(line)
|
| 177 |
+
for index, line in enumerate(lines):
|
| 178 |
+
if not re.match(r"^\s*From:\s*\S", line, re.IGNORECASE):
|
| 179 |
+
continue
|
| 180 |
+
window = "".join(lines[index : index + 8])
|
| 181 |
+
if re.search(r"(?im)^\s*(?:Sent|Date):\s*\S", window) and re.search(
|
| 182 |
+
r"(?im)^\s*Subject:\s*\S", window
|
| 183 |
+
):
|
| 184 |
+
cut_points.append(offsets[index])
|
| 185 |
+
|
| 186 |
+
# Plain-text clients commonly quote the parent with consecutive > lines.
|
| 187 |
+
quoted = re.search(r"(?m)^\s*>.*(?:\n\s*>.*)+", body)
|
| 188 |
+
if quoted:
|
| 189 |
+
cut_points.append(quoted.start())
|
| 190 |
+
lotus_history = LOTUS_HISTORY_RE.search(body)
|
| 191 |
+
if lotus_history:
|
| 192 |
+
cut_points.append(lotus_history.start())
|
| 193 |
+
|
| 194 |
+
if not cut_points:
|
| 195 |
+
return body
|
| 196 |
+
cleaned = body[: min(cut_points)].rstrip()
|
| 197 |
+
return cleaned if cleaned else "(No additional reply text.)"
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
def parse_date(message: Message) -> datetime | None:
|
| 201 |
+
try:
|
| 202 |
+
value = parsedate_to_datetime(str(message.get("date", "")))
|
| 203 |
+
except (TypeError, ValueError, OverflowError):
|
| 204 |
+
return None
|
| 205 |
+
if value is None:
|
| 206 |
+
return None
|
| 207 |
+
if value.tzinfo is None:
|
| 208 |
+
value = value.replace(tzinfo=timezone.utc)
|
| 209 |
+
value = value.astimezone(timezone.utc)
|
| 210 |
+
if not SOURCE_YEAR_MIN <= value.year <= SOURCE_YEAR_MAX:
|
| 211 |
+
return None
|
| 212 |
+
return value
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
def parse_message(path: Path) -> SourceMessage | None:
|
| 216 |
+
message = BytesParser(policy=policy.default).parsebytes(path.read_bytes())
|
| 217 |
+
date = parse_date(message)
|
| 218 |
+
sender = addresses(message, "from")
|
| 219 |
+
if date is None or not sender:
|
| 220 |
+
return None
|
| 221 |
+
return SourceMessage(
|
| 222 |
+
path=path,
|
| 223 |
+
date=date,
|
| 224 |
+
sender=sender[0],
|
| 225 |
+
to=addresses(message, "to"),
|
| 226 |
+
cc=addresses(message, "cc"),
|
| 227 |
+
bcc=addresses(message, "bcc"),
|
| 228 |
+
subject=str(message.get("subject", "(no subject)")).strip() or "(no subject)",
|
| 229 |
+
body=extract_body(message),
|
| 230 |
+
)
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
def semantic_key(message: SourceMessage) -> bytes:
|
| 234 |
+
fields = [
|
| 235 |
+
message.sender[1],
|
| 236 |
+
",".join(address for _, address in message.to),
|
| 237 |
+
",".join(address for _, address in message.cc),
|
| 238 |
+
message.subject.casefold(),
|
| 239 |
+
message.body.casefold(),
|
| 240 |
+
]
|
| 241 |
+
return hashlib.sha256("\0".join(fields).encode("utf-8", "replace")).digest()
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
def load_sample(source: Path, count: int) -> list[SourceMessage]:
|
| 245 |
+
if not source.is_dir():
|
| 246 |
+
raise SystemExit(f"Source mailbox directory does not exist: {source}")
|
| 247 |
+
|
| 248 |
+
unique: dict[bytes, SourceMessage] = {}
|
| 249 |
+
for path in sorted(source.rglob("*")):
|
| 250 |
+
if not path.is_file() or path.parent.name == "all_documents":
|
| 251 |
+
continue
|
| 252 |
+
parsed = parse_message(path)
|
| 253 |
+
if parsed is None:
|
| 254 |
+
continue
|
| 255 |
+
unique.setdefault(semantic_key(parsed), parsed)
|
| 256 |
+
|
| 257 |
+
if len(unique) < count:
|
| 258 |
+
raise SystemExit(f"Only {len(unique)} usable unique messages; requested {count}")
|
| 259 |
+
|
| 260 |
+
# The newest deterministic slice retains dense reply chains and produces a
|
| 261 |
+
# realistic active mailbox instead of a uniform historical scatter.
|
| 262 |
+
ordered = sorted(unique.values(), key=lambda item: (item.date, str(item.path)))
|
| 263 |
+
return ordered[-count:]
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
def is_primary(address: str) -> bool:
|
| 267 |
+
local = address.split("@", 1)[0]
|
| 268 |
+
return any(marker in local for marker in PRIMARY_SOURCE_MARKERS)
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
def derive_name(address: str) -> str:
|
| 272 |
+
local = address.split("@", 1)[0]
|
| 273 |
+
tokens = [token.capitalize() for token in re.split(r"[._+\-/]+", local) if token.isalpha()]
|
| 274 |
+
if len(tokens) >= 2:
|
| 275 |
+
return " ".join(tokens[:3])
|
| 276 |
+
return ""
|
| 277 |
+
|
| 278 |
+
|
| 279 |
+
def collect_identities(sample: list[SourceMessage]) -> tuple[set[str], dict[str, Counter[str]]]:
|
| 280 |
+
all_addresses: set[str] = set()
|
| 281 |
+
names: dict[str, Counter[str]] = defaultdict(Counter)
|
| 282 |
+
for message in sample:
|
| 283 |
+
for name, address in [message.sender, *message.to, *message.cc, *message.bcc]:
|
| 284 |
+
all_addresses.add(address)
|
| 285 |
+
if name and "@" not in name:
|
| 286 |
+
names[address][name.strip()] += 1
|
| 287 |
+
for line in (message.subject + "\n" + message.body).splitlines():
|
| 288 |
+
for match in EMAIL_RE.finditer(line):
|
| 289 |
+
address = normalize_address(match.group(1))
|
| 290 |
+
all_addresses.add(address)
|
| 291 |
+
before = line[: match.start()].rstrip(" \t<'")
|
| 292 |
+
candidate = ""
|
| 293 |
+
quoted = re.search(r'"([^"\n]{2,80})"\s*$', before)
|
| 294 |
+
if quoted:
|
| 295 |
+
candidate = quoted.group(1)
|
| 296 |
+
else:
|
| 297 |
+
comma_name = re.search(
|
| 298 |
+
r"([A-Z][A-Za-z'.-]+,\s*[A-Z][A-Za-z'.-]+(?:\s+[A-Z]\.?){0,2})\s*$",
|
| 299 |
+
before,
|
| 300 |
+
)
|
| 301 |
+
plain_name = re.search(
|
| 302 |
+
r"([A-Z][A-Za-z'.-]+(?:[ \t]+(?:[A-Z][A-Za-z'.-]+|[A-Z]\.)){1,4})\s*$",
|
| 303 |
+
before,
|
| 304 |
+
)
|
| 305 |
+
selected = comma_name or plain_name
|
| 306 |
+
if selected:
|
| 307 |
+
candidate = selected.group(1)
|
| 308 |
+
candidate = re.sub(r"^(?:From|To|Cc|Bcc)\s*:\s*", "", candidate).strip()
|
| 309 |
+
if candidate and len(NAME_TOKEN_RE.findall(candidate)) >= 2:
|
| 310 |
+
names[address][candidate] += 1
|
| 311 |
+
all_addresses.discard("")
|
| 312 |
+
return all_addresses, names
|
| 313 |
+
|
| 314 |
+
|
| 315 |
+
def add_canonical_custodians(
|
| 316 |
+
all_addresses: set[str], names: dict[str, Counter[str]]
|
| 317 |
+
) -> int:
|
| 318 |
+
count = 0
|
| 319 |
+
for raw_line in CUSTODIANS_FILE.read_text(encoding="utf-8").splitlines():
|
| 320 |
+
if not raw_line or raw_line.startswith("#"):
|
| 321 |
+
continue
|
| 322 |
+
custodian_id, custodian_name = raw_line.split("\t", 1)
|
| 323 |
+
if custodian_id == "shackleton-s":
|
| 324 |
+
address = "sara.shackleton@enron.com"
|
| 325 |
+
else:
|
| 326 |
+
surname_key = re.sub(r"[^a-z]", "", custodian_id.rsplit("-", 1)[0])
|
| 327 |
+
candidates = [
|
| 328 |
+
address
|
| 329 |
+
for address in all_addresses
|
| 330 |
+
if surname_key
|
| 331 |
+
and surname_key in re.sub(r"[^a-z]", "", address.split("@", 1)[0])
|
| 332 |
+
]
|
| 333 |
+
address = sorted(candidates)[0] if candidates else f"custodian-{custodian_id}@enron.invalid"
|
| 334 |
+
all_addresses.add(address)
|
| 335 |
+
names[address][custodian_name] += 100
|
| 336 |
+
count += 1
|
| 337 |
+
return count
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
def generated_identity(index: int) -> tuple[str, str, str, str]:
|
| 341 |
+
first = FIRST_NAMES[index % len(FIRST_NAMES)]
|
| 342 |
+
last = LAST_NAMES[(index // len(FIRST_NAMES)) % len(LAST_NAMES)]
|
| 343 |
+
cycle = index // (len(FIRST_NAMES) * len(LAST_NAMES))
|
| 344 |
+
suffix = "" if cycle == 0 else f" {cycle + 1}"
|
| 345 |
+
email = f"{first.lower()}.{last.lower()}.{index + 1:04d}@techcorp.local"
|
| 346 |
+
return f"{first} {last}{suffix}", email, first, f"{last}{suffix}"
|
| 347 |
+
|
| 348 |
+
|
| 349 |
+
def build_identity_map(
|
| 350 |
+
original_addresses: set[str], names: dict[str, Counter[str]]
|
| 351 |
+
) -> tuple[dict[str, dict[str, str]], list[dict[str, str]]]:
|
| 352 |
+
mapping: dict[str, dict[str, str]] = {}
|
| 353 |
+
contacts: list[dict[str, str]] = []
|
| 354 |
+
contact_index = 0
|
| 355 |
+
for original in sorted(original_addresses):
|
| 356 |
+
if is_primary(original):
|
| 357 |
+
mapping[original] = {
|
| 358 |
+
"name": PRIMARY_NAME,
|
| 359 |
+
"email": PRIMARY_EMAIL,
|
| 360 |
+
"firstname": "Alice",
|
| 361 |
+
"surname": "Chen",
|
| 362 |
+
}
|
| 363 |
+
continue
|
| 364 |
+
generated_name, generated_email, first, surname = generated_identity(contact_index)
|
| 365 |
+
identity = {
|
| 366 |
+
"name": generated_name,
|
| 367 |
+
"email": generated_email,
|
| 368 |
+
"firstname": first,
|
| 369 |
+
"surname": surname,
|
| 370 |
+
}
|
| 371 |
+
mapping[original] = identity
|
| 372 |
+
contacts.append(identity)
|
| 373 |
+
contact_index += 1
|
| 374 |
+
|
| 375 |
+
# A source alias may be absent from the selected headers but still belongs
|
| 376 |
+
# to the chosen custodian; make the primary mapping explicit for auditing.
|
| 377 |
+
mapping.setdefault(
|
| 378 |
+
"sara.shackleton@enron.com",
|
| 379 |
+
{"name": PRIMARY_NAME, "email": PRIMARY_EMAIL, "firstname": "Alice", "surname": "Chen"},
|
| 380 |
+
)
|
| 381 |
+
return mapping, contacts
|
| 382 |
+
|
| 383 |
+
|
| 384 |
+
def original_names(
|
| 385 |
+
mapping: dict[str, dict[str, str]], observed_names: dict[str, Counter[str]]
|
| 386 |
+
) -> dict[str, str]:
|
| 387 |
+
replacements: dict[str, str] = {
|
| 388 |
+
"Sara Shackleton": PRIMARY_NAME,
|
| 389 |
+
"Sara": "Alice",
|
| 390 |
+
"Shackleton": "Chen",
|
| 391 |
+
}
|
| 392 |
+
for original, identity in mapping.items():
|
| 393 |
+
candidates = set(observed_names.get(original, {}))
|
| 394 |
+
derived = derive_name(original)
|
| 395 |
+
if derived:
|
| 396 |
+
candidates.add(derived)
|
| 397 |
+
tokens = NAME_TOKEN_RE.findall(derived)
|
| 398 |
+
if len(tokens) >= 2:
|
| 399 |
+
candidates.add(f"{tokens[-1]}, {tokens[0]}")
|
| 400 |
+
for candidate in candidates:
|
| 401 |
+
candidate = " ".join(candidate.split())
|
| 402 |
+
if len(candidate) < 4 or candidate.casefold() in {"unknown", "no address"}:
|
| 403 |
+
continue
|
| 404 |
+
replacements.setdefault(candidate, identity["name"])
|
| 405 |
+
|
| 406 |
+
# First/last-name-only signatures are common. Replace a token only when it
|
| 407 |
+
# resolves to one generated identity, avoiding inconsistent pseudonyms.
|
| 408 |
+
token_targets: dict[str, set[str]] = defaultdict(set)
|
| 409 |
+
for source_name, target_name in replacements.items():
|
| 410 |
+
source_tokens = NAME_TOKEN_RE.findall(source_name)
|
| 411 |
+
target_tokens = NAME_TOKEN_RE.findall(target_name)
|
| 412 |
+
if len(source_tokens) < 2 or len(target_tokens) < 2:
|
| 413 |
+
continue
|
| 414 |
+
for source_token, target_token in ((source_tokens[0], target_tokens[0]), (source_tokens[-1], target_tokens[-1])):
|
| 415 |
+
if len(source_token) >= 5:
|
| 416 |
+
token_targets[source_token].add(target_token)
|
| 417 |
+
for token, targets in token_targets.items():
|
| 418 |
+
if len(targets) == 1:
|
| 419 |
+
replacements.setdefault(token, next(iter(targets)))
|
| 420 |
+
return replacements
|
| 421 |
+
|
| 422 |
+
|
| 423 |
+
def compile_name_pattern(replacements: dict[str, str]) -> re.Pattern[str] | None:
|
| 424 |
+
names = sorted(replacements, key=lambda value: (-len(value), value.casefold()))
|
| 425 |
+
if not names:
|
| 426 |
+
return None
|
| 427 |
+
return re.compile(
|
| 428 |
+
r"(?<![A-Za-z])(?:" + "|".join(re.escape(name) for name in names) + r")(?![A-Za-z])",
|
| 429 |
+
re.IGNORECASE,
|
| 430 |
+
)
|
| 431 |
+
|
| 432 |
+
|
| 433 |
+
def anonymize(
|
| 434 |
+
value: str,
|
| 435 |
+
identities: dict[str, dict[str, str]],
|
| 436 |
+
folded_name_replacements: dict[str, str],
|
| 437 |
+
name_pattern: re.Pattern[str] | None,
|
| 438 |
+
) -> str:
|
| 439 |
+
protected_emails: list[str] = []
|
| 440 |
+
|
| 441 |
+
def protect_email(match: re.Match[str]) -> str:
|
| 442 |
+
original = normalize_address(match.group(1))
|
| 443 |
+
protected_emails.append(identities[original]["email"])
|
| 444 |
+
return f"\ue000{len(protected_emails) - 1}\ue001"
|
| 445 |
+
|
| 446 |
+
value = EMAIL_RE.sub(protect_email, value)
|
| 447 |
+
if name_pattern is not None:
|
| 448 |
+
value = name_pattern.sub(
|
| 449 |
+
lambda match: folded_name_replacements[match.group(0).casefold()], value
|
| 450 |
+
)
|
| 451 |
+
# Keep body-level historical dates broadly aligned with the shifted headers.
|
| 452 |
+
# Do this while generated addresses are protected so numeric address suffixes
|
| 453 |
+
# such as ``.2001`` are never mistaken for source years.
|
| 454 |
+
value = re.sub(
|
| 455 |
+
r"\b(199[7-9]|200[0-2])\b",
|
| 456 |
+
lambda match: str(int(match.group(1)) + 24),
|
| 457 |
+
value,
|
| 458 |
+
)
|
| 459 |
+
value = re.sub(
|
| 460 |
+
"\ue000([0-9]+)\ue001",
|
| 461 |
+
lambda match: protected_emails[int(match.group(1))],
|
| 462 |
+
value,
|
| 463 |
+
)
|
| 464 |
+
# Lotus Notes frequently appends a second directory suffix after an
|
| 465 |
+
# address (for example ``<user@domain>@ENRON``). It is not part of the
|
| 466 |
+
# Internet address matched above, but must not leak the source namespace.
|
| 467 |
+
value = re.sub(r"(?i)@enron(?:\.com)?\b", " [TechCorp]", value)
|
| 468 |
+
return value
|
| 469 |
+
|
| 470 |
+
|
| 471 |
+
def normalize_subject(subject: str) -> str:
|
| 472 |
+
normalized = SUBJECT_PREFIX_RE.sub("", subject).strip().casefold()
|
| 473 |
+
return re.sub(r"\s+", " ", normalized)
|
| 474 |
+
|
| 475 |
+
|
| 476 |
+
def person(identity: dict[str, str]) -> dict[str, str]:
|
| 477 |
+
return {"name": identity["name"], "email": identity["email"]}
|
| 478 |
+
|
| 479 |
+
|
| 480 |
+
def convert_messages(
|
| 481 |
+
sample: list[SourceMessage],
|
| 482 |
+
identities: dict[str, dict[str, str]],
|
| 483 |
+
name_replacements: dict[str, str],
|
| 484 |
+
) -> list[dict[str, object]]:
|
| 485 |
+
latest = max(message.date for message in sample)
|
| 486 |
+
date_shift = RECENT_THROUGH - latest
|
| 487 |
+
name_pattern = compile_name_pattern(name_replacements)
|
| 488 |
+
folded_name_replacements = {
|
| 489 |
+
key.casefold(): replacement for key, replacement in name_replacements.items()
|
| 490 |
+
}
|
| 491 |
+
converted: list[dict[str, object]] = []
|
| 492 |
+
thread_last: dict[str, tuple[str, list[str]]] = {}
|
| 493 |
+
|
| 494 |
+
for index, source in enumerate(sample, 1):
|
| 495 |
+
message_id = f"<corpus-{index:05d}@techcorp.local>"
|
| 496 |
+
subject = anonymize(source.subject, identities, folded_name_replacements, name_pattern)
|
| 497 |
+
reply_body = strip_quoted_history(source.body, source.subject)
|
| 498 |
+
body = anonymize(reply_body, identities, folded_name_replacements, name_pattern)
|
| 499 |
+
thread_key = normalize_subject(subject)
|
| 500 |
+
in_reply_to = ""
|
| 501 |
+
references: list[str] = []
|
| 502 |
+
if SUBJECT_PREFIX_RE.match(subject) and thread_key in thread_last:
|
| 503 |
+
previous_id, previous_references = thread_last[thread_key]
|
| 504 |
+
in_reply_to = previous_id
|
| 505 |
+
references = [*previous_references, previous_id][-20:]
|
| 506 |
+
if thread_key:
|
| 507 |
+
thread_last[thread_key] = (message_id, references)
|
| 508 |
+
|
| 509 |
+
sender_identity = identities[source.sender[1]]
|
| 510 |
+
converted.append(
|
| 511 |
+
{
|
| 512 |
+
"id": f"corpus-{index:05d}",
|
| 513 |
+
"message_id": message_id,
|
| 514 |
+
"from": person(sender_identity),
|
| 515 |
+
"to": [person(identities[address]) for _, address in source.to],
|
| 516 |
+
"cc": [person(identities[address]) for _, address in source.cc],
|
| 517 |
+
"subject": subject,
|
| 518 |
+
"date": (source.date + date_shift).isoformat(),
|
| 519 |
+
"body": body,
|
| 520 |
+
"folder": "Sent" if sender_identity["email"] == PRIMARY_EMAIL else "INBOX",
|
| 521 |
+
"flags": [],
|
| 522 |
+
"in_reply_to": in_reply_to,
|
| 523 |
+
"references": references,
|
| 524 |
+
}
|
| 525 |
+
)
|
| 526 |
+
|
| 527 |
+
# Most mail is read, the newest inbound slice remains unread, and inbound
|
| 528 |
+
# messages followed by a sent message in the same thread are answered.
|
| 529 |
+
latest_inbound = {
|
| 530 |
+
message["id"]
|
| 531 |
+
for message in [item for item in converted if item["folder"] == "INBOX"][-250:]
|
| 532 |
+
}
|
| 533 |
+
future_sent_threads: set[str] = set()
|
| 534 |
+
for message in reversed(converted):
|
| 535 |
+
key = normalize_subject(str(message["subject"]))
|
| 536 |
+
flags: list[str] = []
|
| 537 |
+
if message["id"] not in latest_inbound:
|
| 538 |
+
flags.append("\\Seen")
|
| 539 |
+
if message["folder"] == "INBOX" and key in future_sent_threads:
|
| 540 |
+
flags.append("\\Answered")
|
| 541 |
+
if message["folder"] == "Sent":
|
| 542 |
+
future_sent_threads.add(key)
|
| 543 |
+
message["flags"] = flags
|
| 544 |
+
return converted
|
| 545 |
+
|
| 546 |
+
|
| 547 |
+
def write_json(path: Path, value: object) -> None:
|
| 548 |
+
path.write_text(json.dumps(value, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
|
| 549 |
+
|
| 550 |
+
|
| 551 |
+
def write_jsonl_gzip(path: Path, messages: list[dict[str, object]]) -> None:
|
| 552 |
+
with path.open("wb") as raw:
|
| 553 |
+
with gzip.GzipFile(filename="", mode="wb", fileobj=raw, mtime=0, compresslevel=9) as archive:
|
| 554 |
+
for message in messages:
|
| 555 |
+
archive.write(json.dumps(message, ensure_ascii=False, separators=(",", ":")).encode("utf-8"))
|
| 556 |
+
archive.write(b"\n")
|
| 557 |
+
|
| 558 |
+
|
| 559 |
+
def main() -> int:
|
| 560 |
+
args = cli()
|
| 561 |
+
sample = load_sample(args.source, args.count)
|
| 562 |
+
original_addresses, observed_names = collect_identities(sample)
|
| 563 |
+
custodian_count = add_canonical_custodians(original_addresses, observed_names)
|
| 564 |
+
identities, contacts = build_identity_map(original_addresses, observed_names)
|
| 565 |
+
replacements = original_names(identities, observed_names)
|
| 566 |
+
stripped_reply_count = sum(
|
| 567 |
+
strip_quoted_history(message.body, message.subject) != message.body for message in sample
|
| 568 |
+
)
|
| 569 |
+
messages = convert_messages(sample, identities, replacements)
|
| 570 |
+
|
| 571 |
+
# Existing task users stay valid; Alice is the anonymized selected custodian.
|
| 572 |
+
users = [
|
| 573 |
+
{"email": PRIMARY_EMAIL, "name": PRIMARY_NAME, "password": PRIMARY_PASSWORD, "role": "Legal Counsel"},
|
| 574 |
+
{"email": "bob@techcorp.local", "name": "Bob Martin", "password": PRIMARY_PASSWORD, "role": "Project Manager"},
|
| 575 |
+
{"email": "carol@techcorp.local", "name": "Carol White", "password": PRIMARY_PASSWORD, "role": "UX Designer"},
|
| 576 |
+
{"email": "david@techcorp.local", "name": "David Kim", "password": PRIMARY_PASSWORD, "role": "QA Engineer"},
|
| 577 |
+
]
|
| 578 |
+
# Keep the benchmark's original address book baseline intact. Bob and Carol
|
| 579 |
+
# are deliberately absent because several benchmark tasks ask Alice to add
|
| 580 |
+
# them as contacts. Every anonymized corpus participant is still included.
|
| 581 |
+
contacts.sort(key=lambda contact: (contact["name"], contact["email"]))
|
| 582 |
+
|
| 583 |
+
manifest = {
|
| 584 |
+
"domain": "techcorp.local",
|
| 585 |
+
"users": users,
|
| 586 |
+
"primary_user": PRIMARY_EMAIL,
|
| 587 |
+
"source": {
|
| 588 |
+
"dataset": "CMU CALO Enron Email Dataset",
|
| 589 |
+
"documentation": "http://enrondata.org/en/latest/data/calo-enron-email-dataset/",
|
| 590 |
+
"custodian_id": "shackleton-s",
|
| 591 |
+
"custodian_name": "Sara Shackleton",
|
| 592 |
+
"anonymized_as": PRIMARY_NAME,
|
| 593 |
+
"canonical_custodian_count": custodian_count,
|
| 594 |
+
},
|
| 595 |
+
"corpus_message_count": len(messages),
|
| 596 |
+
"contact_count": len(contacts),
|
| 597 |
+
"recent_through": RECENT_THROUGH.isoformat(),
|
| 598 |
+
"threaded_reply_count": sum(bool(message["in_reply_to"]) for message in messages),
|
| 599 |
+
"stripped_reply_history_count": stripped_reply_count,
|
| 600 |
+
}
|
| 601 |
+
|
| 602 |
+
args.output.mkdir(parents=True, exist_ok=True)
|
| 603 |
+
write_json(args.output / "manifest.json", manifest)
|
| 604 |
+
write_json(args.output / "contacts.json", contacts)
|
| 605 |
+
write_jsonl_gzip(args.output / "messages.jsonl.gz", messages)
|
| 606 |
+
|
| 607 |
+
print(
|
| 608 |
+
f"Built {len(messages)} anonymized messages, "
|
| 609 |
+
f"{manifest['threaded_reply_count']} threaded replies, and {len(contacts)} contacts"
|
| 610 |
+
)
|
| 611 |
+
print(f"Date range: {messages[0]['date']} .. {messages[-1]['date']}")
|
| 612 |
+
return 0
|
| 613 |
+
|
| 614 |
+
|
| 615 |
+
if __name__ == "__main__":
|
| 616 |
+
raise SystemExit(main())
|
preparation/generate_maildir.py
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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|
+
|
| 6 |
+
import gzip
|
| 7 |
+
import hashlib
|
| 8 |
+
import json
|
| 9 |
+
import os
|
| 10 |
+
from datetime import datetime, timezone
|
| 11 |
+
from email.mime.text import MIMEText
|
| 12 |
+
from email.utils import format_datetime
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
HERE = Path(__file__).resolve().parent
|
| 17 |
+
MAILDIR_BASE = Path(os.environ.get("MAILDIR_BASE", "/var/vmail"))
|
| 18 |
+
SEED_FILE = HERE / "seed_data.json"
|
| 19 |
+
ASSET_DIR = Path(os.environ.get("SEED_ASSET_DIR", HERE / "seed_assets"))
|
| 20 |
+
MANIFEST_FILE = ASSET_DIR / "manifest.json"
|
| 21 |
+
MESSAGES_FILE = ASSET_DIR / "messages.jsonl.gz"
|
| 22 |
+
STANDARD_FOLDERS = {"Sent", "Trash", "Drafts"}
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def maildir_name(user_email: str) -> Path:
|
| 26 |
+
local, domain = user_email.split("@", 1)
|
| 27 |
+
return MAILDIR_BASE / domain / local
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def ensure_maildir(base_path: Path, folder: str | None = None) -> Path:
|
| 31 |
+
path = base_path / "Maildir"
|
| 32 |
+
if folder and folder.upper() != "INBOX":
|
| 33 |
+
path /= f".{folder}"
|
| 34 |
+
for subdirectory in ("cur", "new", "tmp"):
|
| 35 |
+
(path / subdirectory).mkdir(parents=True, exist_ok=True)
|
| 36 |
+
return path
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def unique_filename(date: datetime, index: int) -> str:
|
| 40 |
+
token = hashlib.sha1(f"{date.isoformat()}:{index}".encode()).hexdigest()[:12]
|
| 41 |
+
return f"{int(date.timestamp())}.M{token}P{index:05d}.techcorp.local"
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def write_maildir_message(
|
| 45 |
+
folder_path: Path,
|
| 46 |
+
message: bytes,
|
| 47 |
+
flags: list[str],
|
| 48 |
+
date: datetime,
|
| 49 |
+
index: int,
|
| 50 |
+
) -> None:
|
| 51 |
+
flag_chars = []
|
| 52 |
+
if "\\Answered" in flags:
|
| 53 |
+
flag_chars.append("R")
|
| 54 |
+
if "\\Seen" in flags:
|
| 55 |
+
flag_chars.append("S")
|
| 56 |
+
if "\\Flagged" in flags:
|
| 57 |
+
flag_chars.append("F")
|
| 58 |
+
if "\\Deleted" in flags:
|
| 59 |
+
flag_chars.append("T")
|
| 60 |
+
|
| 61 |
+
base_name = unique_filename(date, index)
|
| 62 |
+
if "\\Seen" in flags:
|
| 63 |
+
output = folder_path / "cur" / f"{base_name}:2,{''.join(sorted(flag_chars))}"
|
| 64 |
+
else:
|
| 65 |
+
output = folder_path / "new" / base_name
|
| 66 |
+
output.write_bytes(message)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def as_datetime(value: str) -> datetime:
|
| 70 |
+
result = datetime.fromisoformat(value)
|
| 71 |
+
if result.tzinfo is None:
|
| 72 |
+
result = result.replace(tzinfo=timezone.utc)
|
| 73 |
+
return result
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
def mailbox_address(name: str, email: str) -> str:
|
| 77 |
+
safe_name = name.replace('"', "'")
|
| 78 |
+
return f'"{safe_name}" <{email}>'
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def build_message(
|
| 82 |
+
*,
|
| 83 |
+
sender: dict[str, str],
|
| 84 |
+
to: list[dict[str, str]],
|
| 85 |
+
cc: list[dict[str, str]],
|
| 86 |
+
subject: str,
|
| 87 |
+
date: datetime,
|
| 88 |
+
body: str,
|
| 89 |
+
message_id: str,
|
| 90 |
+
in_reply_to: str = "",
|
| 91 |
+
references: list[str] | None = None,
|
| 92 |
+
corpus: bool = False,
|
| 93 |
+
) -> bytes:
|
| 94 |
+
message = MIMEText(body, "plain", "utf-8")
|
| 95 |
+
message["From"] = mailbox_address(sender["name"], sender["email"])
|
| 96 |
+
message["To"] = ", ".join(mailbox_address(person["name"], person["email"]) for person in to)
|
| 97 |
+
if cc:
|
| 98 |
+
message["Cc"] = ", ".join(mailbox_address(person["name"], person["email"]) for person in cc)
|
| 99 |
+
message["Subject"] = subject
|
| 100 |
+
message["Date"] = format_datetime(date)
|
| 101 |
+
message["Message-ID"] = message_id
|
| 102 |
+
if in_reply_to:
|
| 103 |
+
message["In-Reply-To"] = in_reply_to
|
| 104 |
+
if references:
|
| 105 |
+
message["References"] = " ".join(references)
|
| 106 |
+
message["X-Mailer"] = "TechCorp Webmail"
|
| 107 |
+
if corpus:
|
| 108 |
+
message["X-Seed-Source"] = "EnronData.org / CMU CALO (anonymized)"
|
| 109 |
+
return message.as_bytes()
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
def load_corpus_messages() -> list[dict[str, object]]:
|
| 113 |
+
with gzip.open(MESSAGES_FILE, "rt", encoding="utf-8") as handle:
|
| 114 |
+
return [json.loads(line) for line in handle if line.strip()]
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def folder_path(user_email: str, folder: str) -> Path:
|
| 118 |
+
base = maildir_name(user_email) / "Maildir"
|
| 119 |
+
return base if folder.upper() == "INBOX" else base / f".{folder}"
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
def create_subscriptions_file(mailbox_base: Path, folders: set[str]) -> None:
|
| 123 |
+
path = mailbox_base / "Maildir" / "subscriptions"
|
| 124 |
+
path.write_text(
|
| 125 |
+
"".join(f"{folder}\n" for folder in sorted(folders) if folder.upper() != "INBOX"),
|
| 126 |
+
encoding="utf-8",
|
| 127 |
+
)
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
def deliver_task_fixtures(
|
| 131 |
+
legacy: dict[str, object],
|
| 132 |
+
name_map: dict[str, str],
|
| 133 |
+
) -> int:
|
| 134 |
+
count = 0
|
| 135 |
+
for index, definition in enumerate(legacy["emails"]):
|
| 136 |
+
sender_email = definition["from"]
|
| 137 |
+
date = as_datetime(definition["date"])
|
| 138 |
+
message = build_message(
|
| 139 |
+
sender={"name": name_map.get(sender_email, sender_email.split("@")[0]), "email": sender_email},
|
| 140 |
+
to=[{"name": name_map.get(email, email.split("@")[0]), "email": email} for email in definition.get("to", [])],
|
| 141 |
+
cc=[],
|
| 142 |
+
subject=definition["subject"],
|
| 143 |
+
date=date,
|
| 144 |
+
body=definition["body"],
|
| 145 |
+
message_id=definition["message_id"],
|
| 146 |
+
in_reply_to=definition.get("in_reply_to", ""),
|
| 147 |
+
references=definition.get("references", []),
|
| 148 |
+
)
|
| 149 |
+
for user_email, delivery in definition["delivery"].items():
|
| 150 |
+
write_maildir_message(
|
| 151 |
+
folder_path(user_email, delivery["folder"]),
|
| 152 |
+
message,
|
| 153 |
+
delivery.get("flags", []),
|
| 154 |
+
date,
|
| 155 |
+
index,
|
| 156 |
+
)
|
| 157 |
+
count += 1
|
| 158 |
+
return count
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
def deliver_corpus(primary_user: str, messages: list[dict[str, object]], start_index: int) -> None:
|
| 162 |
+
for offset, definition in enumerate(messages):
|
| 163 |
+
date = as_datetime(str(definition["date"]))
|
| 164 |
+
message = build_message(
|
| 165 |
+
sender=definition["from"],
|
| 166 |
+
to=definition["to"],
|
| 167 |
+
cc=definition.get("cc", []),
|
| 168 |
+
subject=str(definition["subject"]),
|
| 169 |
+
date=date,
|
| 170 |
+
body=str(definition["body"]),
|
| 171 |
+
message_id=str(definition["message_id"]),
|
| 172 |
+
in_reply_to=str(definition.get("in_reply_to", "")),
|
| 173 |
+
references=definition.get("references", []),
|
| 174 |
+
corpus=True,
|
| 175 |
+
)
|
| 176 |
+
write_maildir_message(
|
| 177 |
+
folder_path(primary_user, str(definition["folder"])),
|
| 178 |
+
message,
|
| 179 |
+
definition.get("flags", []),
|
| 180 |
+
date,
|
| 181 |
+
start_index + offset,
|
| 182 |
+
)
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
def count_messages(user_email: str) -> int:
|
| 186 |
+
root = maildir_name(user_email) / "Maildir"
|
| 187 |
+
return sum(
|
| 188 |
+
1
|
| 189 |
+
for path in root.rglob("*")
|
| 190 |
+
if path.is_file() and path.parent.name in {"cur", "new"}
|
| 191 |
+
)
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
def main() -> int:
|
| 195 |
+
legacy = json.loads(SEED_FILE.read_text(encoding="utf-8"))
|
| 196 |
+
manifest = json.loads(MANIFEST_FILE.read_text(encoding="utf-8"))
|
| 197 |
+
users = manifest["users"]
|
| 198 |
+
primary_user = manifest["primary_user"]
|
| 199 |
+
corpus_messages = load_corpus_messages()
|
| 200 |
+
if len(corpus_messages) != manifest["corpus_message_count"]:
|
| 201 |
+
raise RuntimeError("Corpus count does not match seed manifest")
|
| 202 |
+
|
| 203 |
+
user_folders: dict[str, set[str]] = {user["email"]: set(STANDARD_FOLDERS) for user in users}
|
| 204 |
+
for definition in legacy["emails"]:
|
| 205 |
+
for user_email, delivery in definition["delivery"].items():
|
| 206 |
+
if delivery["folder"].upper() != "INBOX":
|
| 207 |
+
user_folders[user_email].add(delivery["folder"])
|
| 208 |
+
for definition in corpus_messages:
|
| 209 |
+
if str(definition["folder"]).upper() != "INBOX":
|
| 210 |
+
user_folders[primary_user].add(str(definition["folder"]))
|
| 211 |
+
|
| 212 |
+
for user in users:
|
| 213 |
+
base = maildir_name(user["email"])
|
| 214 |
+
ensure_maildir(base)
|
| 215 |
+
for folder in user_folders[user["email"]]:
|
| 216 |
+
ensure_maildir(base, folder)
|
| 217 |
+
create_subscriptions_file(base, user_folders[user["email"]])
|
| 218 |
+
|
| 219 |
+
name_map = {user["email"]: user["name"] for user in users}
|
| 220 |
+
fixture_count = deliver_task_fixtures(legacy, name_map)
|
| 221 |
+
deliver_corpus(primary_user, corpus_messages, fixture_count)
|
| 222 |
+
|
| 223 |
+
output_dir = Path(os.environ.get("SEED_OUT_DIR", HERE / "configs"))
|
| 224 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 225 |
+
with (output_dir / "dovecot-passwd").open("w", encoding="utf-8") as handle:
|
| 226 |
+
for user in users:
|
| 227 |
+
handle.write(f"{user['email']}:{{PLAIN}}{user['password']}::::\n")
|
| 228 |
+
with (output_dir / "postfix-vmailbox").open("w", encoding="utf-8") as handle:
|
| 229 |
+
for user in users:
|
| 230 |
+
local = user["email"].split("@", 1)[0]
|
| 231 |
+
handle.write(f"{user['email']} {manifest['domain']}/{local}/Maildir/\n")
|
| 232 |
+
|
| 233 |
+
print(f"Seeded {len(users)} login users, {fixture_count} task fixtures, and {len(corpus_messages)} corpus messages")
|
| 234 |
+
for user in users:
|
| 235 |
+
print(f" {user['email']}: {count_messages(user['email'])} mailbox messages")
|
| 236 |
+
return 0
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
if __name__ == "__main__":
|
| 240 |
+
raise SystemExit(main())
|
preparation/seed_roundcube.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Initialize Roundcube's SQLite database and the primary user's contacts."""
|
| 3 |
+
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import json
|
| 7 |
+
import os
|
| 8 |
+
import sqlite3
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
ASSET_DIR = Path(os.environ.get("SEED_ASSET_DIR", "/opt/thunderbird-seed/seed_assets"))
|
| 13 |
+
DATABASE = Path(os.environ.get("ROUNDCUBE_DB", "/var/lib/roundcube/roundcube.db"))
|
| 14 |
+
SCHEMA = Path(os.environ.get("ROUNDCUBE_SCHEMA", "/var/www/roundcube/SQL/sqlite.initial.sql"))
|
| 15 |
+
MAIL_HOST = "127.0.0.1"
|
| 16 |
+
CHANGED = "2026-07-10 17:00:00"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def vcard_escape(value: str) -> str:
|
| 20 |
+
return (
|
| 21 |
+
value.replace("\\", "\\\\")
|
| 22 |
+
.replace(";", "\\;")
|
| 23 |
+
.replace(",", "\\,")
|
| 24 |
+
.replace("\n", "\\n")
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def vcard(contact: dict[str, str]) -> str:
|
| 29 |
+
return "\r\n".join(
|
| 30 |
+
[
|
| 31 |
+
"BEGIN:VCARD",
|
| 32 |
+
"VERSION:3.0",
|
| 33 |
+
f"FN:{vcard_escape(contact['name'])}",
|
| 34 |
+
f"N:{vcard_escape(contact['surname'])};{vcard_escape(contact['firstname'])};;;",
|
| 35 |
+
f"EMAIL;TYPE=INTERNET:{contact['email']}",
|
| 36 |
+
"REV:2026-07-10T17:00:00Z",
|
| 37 |
+
"END:VCARD",
|
| 38 |
+
"",
|
| 39 |
+
]
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def main() -> int:
|
| 44 |
+
manifest = json.loads((ASSET_DIR / "manifest.json").read_text(encoding="utf-8"))
|
| 45 |
+
contacts = json.loads((ASSET_DIR / "contacts.json").read_text(encoding="utf-8"))
|
| 46 |
+
if len(contacts) != manifest["contact_count"]:
|
| 47 |
+
raise RuntimeError("Contact count does not match seed manifest")
|
| 48 |
+
|
| 49 |
+
DATABASE.parent.mkdir(parents=True, exist_ok=True)
|
| 50 |
+
DATABASE.unlink(missing_ok=True)
|
| 51 |
+
connection = sqlite3.connect(DATABASE)
|
| 52 |
+
connection.execute("PRAGMA foreign_keys = ON")
|
| 53 |
+
connection.executescript(SCHEMA.read_text(encoding="utf-8"))
|
| 54 |
+
|
| 55 |
+
user_ids: dict[str, int] = {}
|
| 56 |
+
for user in manifest["users"]:
|
| 57 |
+
cursor = connection.execute(
|
| 58 |
+
"INSERT INTO users (username, mail_host, created, language, preferences) VALUES (?, ?, ?, ?, ?)",
|
| 59 |
+
(user["email"], MAIL_HOST, CHANGED, "en_US", "a:0:{}"),
|
| 60 |
+
)
|
| 61 |
+
user_id = int(cursor.lastrowid)
|
| 62 |
+
user_ids[user["email"]] = user_id
|
| 63 |
+
connection.execute(
|
| 64 |
+
"""
|
| 65 |
+
INSERT INTO identities
|
| 66 |
+
(user_id, changed, del, standard, name, organization, email, "reply-to", bcc, signature, html_signature)
|
| 67 |
+
VALUES (?, ?, 0, 1, ?, 'TechCorp', ?, '', '', '', 0)
|
| 68 |
+
""",
|
| 69 |
+
(user_id, CHANGED, user["name"], user["email"]),
|
| 70 |
+
)
|
| 71 |
+
|
| 72 |
+
primary_user_id = user_ids[manifest["primary_user"]]
|
| 73 |
+
group_cursor = connection.execute(
|
| 74 |
+
"INSERT INTO contactgroups (user_id, changed, del, name) VALUES (?, ?, 0, ?)",
|
| 75 |
+
(primary_user_id, CHANGED, "TechCorp Directory"),
|
| 76 |
+
)
|
| 77 |
+
group_id = int(group_cursor.lastrowid)
|
| 78 |
+
|
| 79 |
+
for contact in contacts:
|
| 80 |
+
words = " ".join(
|
| 81 |
+
[
|
| 82 |
+
contact["name"].casefold(),
|
| 83 |
+
contact["firstname"].casefold(),
|
| 84 |
+
contact["surname"].casefold(),
|
| 85 |
+
contact["email"].casefold(),
|
| 86 |
+
]
|
| 87 |
+
)
|
| 88 |
+
cursor = connection.execute(
|
| 89 |
+
"""
|
| 90 |
+
INSERT INTO contacts
|
| 91 |
+
(user_id, changed, del, name, email, firstname, surname, vcard, words)
|
| 92 |
+
VALUES (?, ?, 0, ?, ?, ?, ?, ?, ?)
|
| 93 |
+
""",
|
| 94 |
+
(
|
| 95 |
+
primary_user_id,
|
| 96 |
+
CHANGED,
|
| 97 |
+
contact["name"],
|
| 98 |
+
contact["email"],
|
| 99 |
+
contact["firstname"],
|
| 100 |
+
contact["surname"],
|
| 101 |
+
vcard(contact),
|
| 102 |
+
words,
|
| 103 |
+
),
|
| 104 |
+
)
|
| 105 |
+
connection.execute(
|
| 106 |
+
"INSERT INTO contactgroupmembers (contactgroup_id, contact_id, created) VALUES (?, ?, ?)",
|
| 107 |
+
(group_id, int(cursor.lastrowid), CHANGED),
|
| 108 |
+
)
|
| 109 |
+
|
| 110 |
+
connection.commit()
|
| 111 |
+
connection.close()
|
| 112 |
+
print(f"Seeded Roundcube users={len(user_ids)} contacts={len(contacts)}")
|
| 113 |
+
return 0
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
if __name__ == "__main__":
|
| 117 |
+
raise SystemExit(main())
|
release-manifest.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"repo_id": "WebArena-Pro/thunderbird-data",
|
| 3 |
+
"application_repository": "https://github.com/McGill-NLP/webarena-pro",
|
| 4 |
+
"prepared_at_utc": "2026-11-13T20:57:31.848389+00:00",
|
| 5 |
+
"visibility": "private",
|
| 6 |
+
"source_urls": [
|
| 7 |
+
"https://www.cs.cmu.edu/~enron/",
|
| 8 |
+
"https://enrondata.org/en/latest/data/calo-enron-email-dataset/"
|
| 9 |
+
],
|
| 10 |
+
"files": [
|
| 11 |
+
{
|
| 12 |
+
"path": "LICENSES.md",
|
| 13 |
+
"bytes": 860,
|
| 14 |
+
"sha256": "16ae557c2cae05ef026063ae734a6a3047f333b402a6c611b0feeaeb29cf1d36"
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"path": "README.md",
|
| 18 |
+
"bytes": 2077,
|
| 19 |
+
"sha256": "45049050dbe02db1af68d3288a12bc1550c3c93fb4f237ced9f92a9ab07ac54d"
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"path": "metadata/task-fixtures.json",
|
| 23 |
+
"bytes": 22420,
|
| 24 |
+
"sha256": "7c6d159b348d51324cae1c32d0eb1405e5453b67fc85265d30db85e4487e4812"
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"path": "preparation/build_enron_seed.py",
|
| 28 |
+
"bytes": 24094,
|
| 29 |
+
"sha256": "3cc67d51a2763b4828045c10514f3d0e73d0449f08cb0879f03d362d9bedc686"
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"path": "preparation/generate_maildir.py",
|
| 33 |
+
"bytes": 8469,
|
| 34 |
+
"sha256": "62e229e5b99e6616b06b87dc43c1125cb06ef131fd04e4cabd979b86818994e8"
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"path": "preparation/seed_roundcube.py",
|
| 38 |
+
"bytes": 3926,
|
| 39 |
+
"sha256": "60fefaf9ee39c6494ca11eb40f8f94a930dc73ac4bdbdd1887099086bc6329cf"
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"path": "seed_assets/contacts.json",
|
| 43 |
+
"bytes": 623107,
|
| 44 |
+
"sha256": "7ca4a99e78aa648edd972e6a7fc1b26de20ab1be0f08c977334379593fb2734e"
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"path": "seed_assets/manifest.json",
|
| 48 |
+
"bytes": 1151,
|
| 49 |
+
"sha256": "a0c70d9541ae3f0ef6941a88d107a863a876d2dca1b9d3d548d9827ac4520043"
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"path": "seed_assets/messages.jsonl.gz",
|
| 53 |
+
"bytes": 2261329,
|
| 54 |
+
"sha256": "241d7975d78d2c02cf7cab0420c8ffa29e99d38a77d71b4fde1a1893b634c666"
|
| 55 |
+
}
|
| 56 |
+
],
|
| 57 |
+
"remote_media_preserved": false
|
| 58 |
+
}
|
seed_assets/contacts.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
seed_assets/manifest.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"domain": "techcorp.local",
|
| 3 |
+
"users": [
|
| 4 |
+
{
|
| 5 |
+
"email": "alice@techcorp.local",
|
| 6 |
+
"name": "Alice Chen",
|
| 7 |
+
"password": "User@Secure123",
|
| 8 |
+
"role": "Legal Counsel"
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
"email": "bob@techcorp.local",
|
| 12 |
+
"name": "Bob Martin",
|
| 13 |
+
"password": "User@Secure123",
|
| 14 |
+
"role": "Project Manager"
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"email": "carol@techcorp.local",
|
| 18 |
+
"name": "Carol White",
|
| 19 |
+
"password": "User@Secure123",
|
| 20 |
+
"role": "UX Designer"
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"email": "david@techcorp.local",
|
| 24 |
+
"name": "David Kim",
|
| 25 |
+
"password": "User@Secure123",
|
| 26 |
+
"role": "QA Engineer"
|
| 27 |
+
}
|
| 28 |
+
],
|
| 29 |
+
"primary_user": "alice@techcorp.local",
|
| 30 |
+
"source": {
|
| 31 |
+
"dataset": "CMU CALO Enron Email Dataset",
|
| 32 |
+
"documentation": "http://enrondata.org/en/latest/data/calo-enron-email-dataset/",
|
| 33 |
+
"custodian_id": "shackleton-s",
|
| 34 |
+
"custodian_name": "Sara Shackleton",
|
| 35 |
+
"anonymized_as": "Alice Chen",
|
| 36 |
+
"canonical_custodian_count": 148
|
| 37 |
+
},
|
| 38 |
+
"corpus_message_count": 5000,
|
| 39 |
+
"contact_count": 4510,
|
| 40 |
+
"recent_through": "2026-07-10T17:00:00+00:00",
|
| 41 |
+
"threaded_reply_count": 1525,
|
| 42 |
+
"stripped_reply_history_count": 1311
|
| 43 |
+
}
|
seed_assets/messages.jsonl.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:241d7975d78d2c02cf7cab0420c8ffa29e99d38a77d71b4fde1a1893b634c666
|
| 3 |
+
size 2261329
|