Run artifact

workspace/targets/CsvStat/ANALYSIS.md

Blueprint Analysis: drydock CsvStat Uat Case

Commander Expectations

Crew

CrewCharge
CommanderDefines intent and decides what done means.
Team LeadConfirms epic completeness and stakeholder expectations.
Planning CrewAuthors atomic specifications and the ordered Manifest.
Shipyard CrewBuilds the tickets without synchronous Commander access.

Story List

Feature: Build and Test Gate

IDStoryHigh-level AC
FOUND-001Build the csvstat executable from the module rootgo build ./cmd/csvstat succeeds at the application root using only the Go standard library
FOUND-002Provide the POSIX test gatebin/test.sh exits zero only when go vet ./... and go test ./... both pass

Feature: Command Line Interface

IDStoryHigh-level AC
CLI-001Accept exactly one file after optional optionsOne file is required; options precede the file
CLI-002Profile a single named column--column <name> writes only that column's profile row
CLI-003Select frequency mode with --freq--freq <name> lists frequencies instead of the profile
CLI-004Reject malformed arguments with exit 2Missing or extra file, unknown option, missing option value, non-positive --top, --top without --freq, and --column with --freq each exit 2

Feature: CSV Ingestion

IDStoryHigh-level AC
INGEST-001Read UTF-8 RFC 4180 CSV with a header recordThe first record is the header; quoted fields containing commas parse as one value
INGEST-002Trim header names and valuesLeading and trailing spaces are removed from every header name and value before other rules apply
INGEST-003Recognize null spellingsEmpty values and NA, N/A, NULL ignoring case are null
INGEST-004Reject empty, bad-header, or ragged inputAn empty file, an empty or repeated header name, or a record with a different field count exits 3

Feature: Column Typing

IDStoryHigh-level AC
TYPE-001Infer integer and number columnsEvery non-null value matches -?[0-9]+ for integer, or -?[0-9]+(\.[0-9]+)? for number
TYPE-002Infer date columnsEvery non-null value matches YYYY-MM-DD and is a real calendar date
TYPE-003Infer boolean and text columns, and empty for all-null columnsBoolean is true or false ignoring case; text is the fallback; a column with no non-null value is empty

Feature: Column Statistics

IDStoryHigh-level AC
STAT-001Report rows, nulls, and distinct countsRows counts data records; nulls counts null values; distinct counts exact trimmed non-null strings
STAT-002Report min and max by column typeInteger, number, date, boolean, and text min and max follow the brief's rules; empty columns leave them blank
STAT-003Report sum and mean for numeric columnsInteger sum is a plain integer; number sum is a decimal; mean is total over non-null count; other types leave them blank
STAT-004Report median for numeric columnsMedian of sorted non-null values, or mean of the two middle values when the count is even
STAT-005Format decimal results to two placesNumber min, max, sum, mean, and median, and integer mean and median, use two decimals rounded half away from zero

Feature: Profile Output

IDStoryHigh-level AC
OUT-001Write the profile as RFC 4180 CSVHeader column,type,rows,nulls,distinct,min,max,sum,mean,median, one row per column in file order, \n line endings, fields quoted as needed

Feature: Frequency Listing

IDStoryHigh-level AC
FREQ-001Count and order distinct non-null valuesHeader value,count; count descending, then value ascending by byte; nulls omitted; header only when no non-null value exists
FREQ-002Limit frequency rows with --topAt most --top rows are listed; default is 5

Feature: Failure Reporting

IDStoryHigh-level AC
ERR-001Write a diagnostic line on failureA failing command writes nothing to standard output and one stderr line naming the file, and the line number for a rejected record
ERR-002Exit 1 when the file cannot be readA missing or unreadable file exits 1 and writes nothing to standard output

Feature: Acceptance Verification

IDStoryHigh-level AC
VERIFY-001Pass the supplied gradersh sources/run.sh exits zero with every one of its 22 checks passing

Story Guidance

Named stories planning must produce. Authoritative record: STORY_GUIDANCE.json.

None.

Surfaced Acceptance Criteria

IDStory IDCriterion
AC-001INGEST-001A line ending after the last record does not create an extra data record.
AC-002INGEST-003A quoted empty field is an empty value and is counted as null.
AC-003INGEST-004A file containing only blank lines is rejected as empty with exit 3.
AC-004STAT-005A number total or mean that rounds to zero is written as 0.00 without a leading minus sign.
AC-005TYPE-003Boolean min and max are written as lowercase true or false regardless of input case.
AC-006CLI-004A usage error writes one stderr line that shows the two command forms.
AC-007STAT-002A column with exactly one non-null value reports that value as both min and max.

Source Inventory

PathContent kindDispositionReason
sources/INSTRUCTIONS.mdmarkdownanalyzedreadable UTF-8
sources/employees.csvtextanalyzedreadable UTF-8
sources/header_only.csvtextanalyzedreadable UTF-8
sources/orders.csvtextanalyzedreadable UTF-8
sources/ragged.csvtextanalyzedreadable UTF-8
sources/run.shcodeanalyzedreadable UTF-8
sources/sensors.csvtextanalyzedreadable UTF-8

Relationship Model

Source or groupRelationship typeRelated source or groupEvidenceDelivery implication
sources/run.shinstruction-to-testsources/INSTRUCTIONS.mdCheck IDs and expected output mirror the Command and Profile output sectionsVERIFY-001 depends on every implementation story
sources/run.shtest-kit-to-implementation./cmd/csvstatgo build -o "$BIN" ./cmd/csvstat at the application rootFOUND-001 precedes every check
sources/employees.csv, sources/sensors.csv, sources/orders.csv, sources/header_only.csv, sources/ragged.csvdependencysources/run.shDATA resolves to sources/ when employees.csv is present beside the scriptStage all five fixtures under sources/
sources/INSTRUCTIONS.mdinstruction-to-testbin/test.sh suite"Tests" section requires coverage of types, statistics, nulls, rounding, outputs, and exit codesFOUND-002 owns the suite; stories add their own slices
sources/INSTRUCTIONS.mddependencysources/ragged.csv, sources/header_only.csvRejection and empty-profile rulesINGEST-004 and STAT-001 depend on these fixtures

Source Roles

PathRolePlan dispositionBuild disposition
sources/INSTRUCTIONS.mdnormative specification and conformance test suitecontextprompt-only
sources/run.shconformance harnesscontextstage
sources/employees.csvassetcontextstage
sources/sensors.csvassetcontextstage
sources/orders.csvassetcontextstage
sources/header_only.csvassetcontextstage
sources/ragged.csvassetcontextstage

Planning Instructions

Delivery Shape

The system is a single Go command-line executable, csvstat, in a Go module whose main package is ./cmd/csvstat. It reads one CSV file given on the command line and writes either a column profile or a frequency listing to standard output as CSV. Inputs are one file and its options. Outputs are CSV on standard output and a diagnostic line on standard error for failures. Exit codes are 0 for success, 1 for an unreadable file, 2 for usage errors, and 3 for rejected input. The execution flow is: parse arguments, read and trim the file, reject malformed input, infer column types, then compute either the profile or the frequencies.

Story Realization Map

Test and Acceptance Strategy

Each implementation story runs its own focused tests and never runs the whole grader. A story that exercises the grader declares Suite: scoped and bounds the run with the runner's --pattern selector. VERIFY-001 is the single terminal story. It depends on every other story and declares Suite: full, which runs sh sources/run.sh unfiltered and requires exit zero. The project-wide criteria in SEA_TRIALS.md are proved by the terminal run and by bin/test.sh. Sample tests prove a unit only. Full conformance is proved by the grader.

Sequencing and Dependencies

Source Conflicts and Gaps

No conflicts were found between sources/INSTRUCTIONS.md, the fixtures, and sources/run.sh. Spot checks by hand, not by execution, matched the expected values: the employee id sum of 24300, the manager_id statistics (9 non-null values, sum 30, mean 3.33, median 4.00), the orders.csv ref and shipped text typing, and the customer distinct count with Globex at 10. No blocker or questionnaire is required.

Analysis Notes

generated: 2026-10-25 blueprint: /mnt/c/Users/barlo/projects/drydock/uat/CsvStat/runs/20261025.051314/workspace/targets/CsvStat/blueprint

Quality: Ready blockers: 0 questions: 0 features: 9 stories: 24 stack: Go 1.22 or newer, standard library only display_name: not proposed short_description: not proposed