Reetie Cost Calculator

Home Stock Ledger

Stock Ledger

A standard build task with a baseline test and a follow-up change.

Compare hands-on tests

Starter repository and test suite

Starting commit d5b764663d02ff71fc3868578ccf0fe149ea67c5

git init -b main --object-format=sha1 stock-ledger
git -C stock-ledger fast-import < stock-ledger-start.fi
git -C stock-ledger restore --source=HEAD --staged --worktree .
git -C stock-ledger rev-parse HEAD

Run the baseline test from the fixed starting commit. Run the change test from the approved baseline revision. Use Python 3 in an isolated evaluation environment.

python3 stock-ledger-verify.py base stock-ledger
python3 stock-ledger-verify.py change stock-ledger --base-commit "$BASE_COMMIT"

Baseline test

5 checks

Version stock-ledger-grund-03 · Method reetie-capability-1 · Dry run before freezing

Original prompt
Work in the supplied Stock Ledger repository. Start from exactly d5b764663d02ff71fc3868578ccf0fe149ea67c5, with a clean history rooted at that revision. Keep the existing Python 3 command-line entry point: python3 ledger.py INPUT. INPUT is a UTF-8 JSON Lines path, or - for standard input. Each nonblank record is an object containing a nonempty warehouse string, a nonempty sku string and an integer delta. Boolean values are invalid as deltas. Aggregate by warehouse and SKU, retain zero and negative quantities, and sort by warehouse then SKU using Python string order.

Add an optional --format switch with json and csv values. Calls without the option and explicit --format json must preserve the existing JSON array of warehouse, sku, quantity objects. CSV must contain a warehouse,sku,quantity header followed by the same sorted rows. Use UTF-8 and standard CSV quoting, including for fields with commas, double quotes or non-ASCII text. Empty input yields an empty JSON array or header-only CSV. Invalid input or an unsupported format must exit with status 2, describe the problem on stderr, and leave stdout empty even after valid earlier rows. Use the existing Python standard-library toolchain. Commit the final result and state how you verified it.

Use English for all user-facing copy and submitted documentation.
Requirements and expected results
IDRequirementCapability levelExpected resultEvidence
A01JSON compatibility 1 The same groups, sort order, negative quantities, and zero quantities appear.Observed result, date, and evidence for the tested artifact
A02CSV from a file 1 The columns are warehouse, sku, and quantity, with the same rows and ordering as JSON.Observed result, date, and evidence for the tested artifact
A03CSV from standard input 1 A CSV reader reconstructs every field correctly.Observed result, date, and evidence for the tested artifact
A04Input validation 1 The command exits with status 2, explains the failure on stderr, and leaves stdout empty.Observed result, date, and evidence for the tested artifact
A05Empty input and unsupported format 1 CSV contains only the header. XML exits with status 2, prints an error, and leaves stdout empty.Observed result, date, and evidence for the tested artifact

Change and regression tests

9 checks

Version stock-ledger-andring-03 · Method reetie-capability-1 · Dry run before freezing

Original prompt
Continue from your exact accepted first revision of Stock Ledger, retaining the supplied starter in its history. Add optional --warehouse NAME. Match exactly, including case. Apply the filter to both formats. Keep the existing CLI and preserve all previous behavior when the option is omitted. For an unknown warehouse return an empty JSON array or header-only CSV. Validate the entire input before producing output, including records from other warehouses. The CLI must accept the flags before or after INPUT. Commit the result and verify both the new behavior and the previous contract.

Use English for all user-facing copy and submitted documentation.
Requirements and expected results
IDRequirementCapability levelExpected resultEvidence
B01Filter JSON 1 Only East rows appear in the same order, including negative and zero quantities.Observed result, date, and evidence for the tested artifact
B02Filter CSV 1 The original header and only the West row appear.Observed result, date, and evidence for the tested artifact
B03Validate the whole source 1 The command exits with status 2, explains the failure, and leaves stdout empty.Observed result, date, and evidence for the tested artifact
B04Exact filter matching 1 A case mismatch produces empty JSON. An unknown warehouse yields header-only CSV.Observed result, date, and evidence for the tested artifact
R-A01JSON compatibility 1 The same groups, sort order, negative quantities, and zero quantities appear.Observed result, date, and evidence for the tested artifact
R-A02CSV from a file 1 The columns are warehouse, sku, and quantity, with the same rows and ordering as JSON.Observed result, date, and evidence for the tested artifact
R-A03CSV from standard input 1 A CSV reader reconstructs every field correctly.Observed result, date, and evidence for the tested artifact
R-A04Input validation 1 The command exits with status 2, explains the failure on stderr, and leaves stdout empty.Observed result, date, and evidence for the tested artifact
R-A05Empty input and unsupported format 1 CSV contains only the header. XML exits with status 2, prints an error, and leaves stdout empty.Observed result, date, and evidence for the tested artifact