
Summary
Key points of this document
- Where are the design challenges?
- How to define boundaries?
- Details that matter in implementation
Overview
CSV is an easy-to-handle format, but the meaning and type of columns are often not explicitly stated within the file. If used for scenario execution, validation during import and saving execution history are crucial. The interesting aspect of a CSV scenario execution platform is not just reading files, but its ability to fix data, expected results, and execution environment for reproducibility.
Where are the design challenges?
In applications that upload and process CSVs, execution often fails due to variations in column names, character encoding, line breaks, whitespace, and numerical formats. If users don't know which row caused the failure, they cannot fix it.
CSVs are often created by external systems or manually, making them difficult to fully control. Also, since the content can change even with the same filename, reproducing execution results later requires content hashing or version control.
Validation using CSV is easy, but reproducibility decreases if it depends on filenames, column order, or local modifications. If treated as a scenario execution platform, CSV is not just input, but a test asset that fixes expected behavior.
How to define boundaries?
During import, save the CSV as a dataset version, recording headers, inferred types, validation results, and hashes. Scenario execution refers to the dataset version and parameters, saving results and errors separately.
In design, we separate datasets, scenarios, executions, and results. CSVs contain values close to business input, while expected results, tolerances, and skip conditions are managed in separate files or metadata.
Details that matter in implementation
In FastAPI, we separate upload, validation, execution, and result retrieval. The React screen displays previews, column mappings, error lists, and execution history. For large CSVs, we consider streaming or chunking instead of loading all rows into memory.
FastAPI validates uploaded CSVs and creates execution jobs. The React side displays execution status, failed rows, and differences, allowing users to select items for re-execution. Results are saved per run_id to enable viewing differences from the previous execution.
- CSV rows should have "scenario" in addition to natural keysrowAdd an ID to track failed rows.
- Separate column type conversion and business validation, and classify where failures occur.
- Do not mix expected results into the CSV body; separate them as validation definitions.
Observe how it breaks
For validation, prepare files with different character encodings, missing columns, extra columns, blank rows, duplicate keys, and large volumes. Also, confirm that the same data version can be re-executed from the execution history, and that only error rows can be corrected and resubmitted.
For validation, we sample missing columns, extra columns, character encoding differences, digit separators, mixed line breaks, and expected value mismatches. Since scenario execution itself is the test target, we also check the error display of the execution platform.
Discarded options and trade-offs
Over-automating schema inference risks processing with incorrect types. For critical processes, it is safer to include a step where a human reviews the inferred schema before execution.
While CSV is easy to handle, it is weak in nested structures and type representation. For complex scenarios, JSON or database fixtures may be more suitable. It is effective to limit CSV to inputs readable by business users and to use a separate format for validation definitions.
Decision criteria to leave on site
The reliability of CSV processing is determined by post-upload validation and version control. By separating dataset versions, column definitions, and scenario execution, it becomes a processing platform where results are easily reproducible.
CSV scenarios are weak if they are merely manual checks put into a file. By separating input, expectations, execution, and differences, it becomes a platform that can continuously confirm the impact of changes.


