Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Map Reject Codes First. Move One Classifier After.

说明与用途

冻结测试数据表并捕获金色快照,使 CSV 导入器成为一个契约,防止在重构时出现意外漂移。

问题

Messy import scripts fail extracts for a measurable reason because validation rules are hidden inside file reads and writes, causing drift when refactoring.

结果

By freezing a fixture table and recording a gold snapshot, the importer’s behavior becomes a contract that protects against accidental drift during refactoring.

工作流

  • 1. Build a CSV fixture that covers all branches (blank email, missing name, bad role, mixed‑case email, missing role).
  • 2. Store the fixture text as a constant in the test module to avoid file I/O during asserts.
  • 3. Run the importer with a recording writer that appends written records to a list.
  • 4. Print the summary dict and written records to capture the first gold snapshot.
  • 5. Verify the snapshot matches expected counts, reject codes, and canonical dicts.
  • 6. Use the snapshot as a contract; any future refactor must preserve these outputs.
  • 7. Optionally compute a hash of the snapshot for quick change detection.

证据

Build one CSV that hits every branch once.

来源

Run the importer against a recording writer.

来源

Expected gold, derived from the fixture rules above: ...

来源

  • 记录日期: 2026-09-21T09:15:23.557Z