Repository navigation
Add Coinbase compliance report artifacts and synthetic tests - #511
Conversation
New module for Coinbase's compliance_report.csv law enforcement return (IdvComplianceReport). The existing coinbaseArchive module reads a different export (coinbase_data.json), so this is a separate module. The report is one CSV of '***'-titled sections. Named sections get their own artifact (subscriber details, ID verification, phones, previous emails, billing addresses, bank accounts, other payment methods, crypto addresses, totals, transactions, exchange activity, account events, manual reviews). Every other section is reported cell for cell under Other Sections, so no section is dropped. Values are reported as produced, with the provider's column names. Timestamps are converted to UTC only when the value states an offset or a zone abbreviation, next to the value as produced and a Time Basis column. Columns a later production adds are kept in Other Columns. Tested against a synthetic return (generator included) and one real 2025 production holding two reports; other years are untested. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017LbbHja96FzwdwqWVug21P
caseSYNTH001 is generated by admin/test/scripts/gen_coinbase_compliance_synth.py with fabricated values only. It covers two reports plus a byte-identical nested copy, offset, Z, zone-abbreviation and zone-less timestamps, a multi-line cell, a table split by a blank row, the two-table legacy card section, an unnamed extra column, unmapped, header-only and empty sections, and a decoy CSV that matches the path pattern. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017LbbHja96FzwdwqWVug21P
abrignoni
left a comment
There was a problem hiding this comment.
Thanks, Mike. This one is in really good shape. The module is tight, nothing in a report gets dropped (unnamed sections go to Other Sections and unknown columns are kept as JSON), and the fixture covers two different users, a duplicate copy of a report, a CSV that is not a report, and timestamps with no zone. The committed test cases all match, the repo checks and the changed-files lint pass, and a full RLEAPP run on the fixture produced all 14 artifacts with no local paths in the output. Good stuff.
A few things before it goes in.
Needs a fix
-
A report with quoted cells is skipped silently.
_read_reportdecides whether a file is a report by checking the raw first text line forUSER ATTRIBUTES ***, not the first parsed CSV cell. I rewrote the fixture report with every cell quoted, so the first line reads"USER ATTRIBUTES ***", and_read_reportreturnedNone. That means all 14 artifacts report nothing for that file and nothing is logged. Please check the first cell of the first parsed CSV row instead, and add alogfuncline for any matched file that is not read as a report, so the examiner can see it was skipped. -
Notes wording. Every notes field ends with "Tested against synthetic returns and against one real 2025 production holding two reports", and the duplicate-copy sentence says "(the tested one did)". Since the production cannot be referenced, nobody reading the report can check either one. I'd describe the scope without the testing claim, for example "Layouts are those of synthetic returns and one 2025 production; other production years and layouts may differ", and "A production can hold the same report more than once, and each copy is reported."
Question
- Second header rows inside a section.
_tablestreats a block after a blank line as a new table only when its first cell isPAN. Any other second header in a section is read as a data row under the first table's column names, with the rows after it following along. For the named-column artifacts that puts values under the wrong headers. Have you seen other sections carry a second table in real reports? If so, it would be safer to start a new table whenever a block's first row looks like a header, or to send those blocks to Other Sections.
Suggestion
- The notes say values with a zone abbreviation (PST and so on) are converted as fixed offsets, but the only abbreviated value in the fixture is the CREATED field in USER ATTRIBUTES, which is not converted. Adding one abbreviated timestamp to a section with a Timestamp (UTC) column (transactions or events) would put that path under test.
Happy to take another look once these are in.
Detect reports using parsed CSV cells and log skipped matches. Recognize repeated or changed known headers and preserve uncertain header-like blocks in Other Sections. Document layout limits and exercise fixed-offset zone abbreviations in converted columns. All 14 artifact baselines pass; 377 regression tests run successfully with eight skips.
Adds 14 RLEAPP artifacts for Coinbase IdvComplianceReport legal-process returns (
*compliance_report*.csv), with synthetic fixtures and expected results. Source File and CSV Record retain record context; derived UTC timestamps have adjacent source timestamps and time-basis columns.Review revisions
Validation
Scope
Layouts are those of synthetic returns and one 2025 production; other production years and layouts may differ. Values retain the documented whitespace normalization; source copies are not silently deduplicated. No real return data is included. This is a self-contained RLEAPP artifact module, independent of the Robinhood submission.