Run artifact

workspace/targets/LayersTesting/ANALYSIS.md

Blueprint Analysis: drydock Layers Testing 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: Schema and Bulk Load

IDStoryHigh-level AC
LEDGER-SCHEMA-001Initialize an empty ledger with ledger initinit prepares three tables (accounts, categories, transactions) with the specified columns and keys, writes nothing, and removes existing records when rerun; count reports 0 rows for each table
LEDGER-LOAD-001Load accounts from CSV with ledger load accounts <csv>Header must match account,name; all rows accepted; writes table,loaded and accounts,<rows>; invalid row rejects the whole file with exit 3
LEDGER-LOAD-002Load categories from CSV with ledger load categories <csv>Header must match category,description; all rows accepted; writes table,loaded and categories,<rows>; invalid row rejects the whole file with exit 3
LEDGER-LOAD-003Load transactions from CSV with ledger load transactions <csv>Header must match txn_id,date,account,category,amount,memo; keeps file txn_id; all rows accepted or none; unknown account or category rejects the whole file with exit 3
LEDGER-LOAD-004Reject a load file with unreadable pathUnreadable file named on command line exits 1 with no writes

Feature: Account Management

IDStoryHigh-level AC
LEDGER-ACCT-001Add an account with ledger account add <code> <name>Validates code (1–12 chars A-Z0-9) and name (1–40 chars, no comma/newline); duplicate key rejected with exit 3; returns account row with 0 transactions and 0.00 balance
LEDGER-ACCT-002Retrieve an account with ledger account get <code>Returns current account row; absent code exits 4
LEDGER-ACCT-003Rename an account with ledger account rename <code> <name>Updates name only; returns updated row; absent code exits 4
LEDGER-ACCT-004Delete an account with ledger account delete <code>Removes account and writes deleted and code; refused with exit 3 while transactions exist; absent code exits 4

Feature: Transaction Management

IDStoryHigh-level AC
LEDGER-TXN-001Post a transaction with ledger txn postValidates account, category (must exist), amount (-?DIGITS[.D[D]], nonzero, ≤2 decimals), date (real calendar date), memo (0–60 chars); assigns txn_id as max+1 or 1; returns row; invalid input exits 3
LEDGER-TXN-002Retrieve a transaction with ledger txn get <id>Returns current transaction row; absent id exits 4
LEDGER-TXN-003Amend a transaction amount with ledger txn amend <id> <amount>Changes only amount; returns updated row; rejected if resulting balance would go negative; absent id exits 4
LEDGER-TXN-004Delete a transaction with ledger txn delete <id>Removes row and writes deleted and id; rejected if resulting balance would go negative; absent id exits 4

Feature: Transfers

IDStoryHigh-level AC
LEDGER-XFER-001Transfer cash between accounts with ledger transfer <from> <to> <amount> <date>Records two rows in category TRANSFER (outgoing -amount then incoming +amount) with specified memos and consecutive ids; accounts must differ and amount must be positive; rejected entirely if source would go negative

Feature: Reporting

IDStoryHigh-level AC
LEDGER-RPT-001Report account balances with ledger report balancesPer-account rows ordered by code with count and balance, then TOTAL,,<count>,<sum>
LEDGER-RPT-002Report category totals with ledger report categoriesPer-category rows ordered by code (including empty categories) with inflow, outflow, net, then TOTAL row
LEDGER-RPT-003Report monthly totals with ledger report monthlyPer YYYY-MM with transactions, ascending, with inflow, outflow, net, then TOTAL row

Feature: Command Contract

IDStoryHigh-level AC
LEDGER-CLI-001Enforce the CSV output contract and exit codesSuccessful commands write CSV headers, \n endings, two-decimal amounts, no trailing spaces; failures write nothing to stdout and one diagnostic to stderr; exit 2 for unknown commands, tables, reports, or wrong argument counts
LEDGER-CLI-002Enforce the no-negative-balance rule across all writing commandsLoading, posting, amending, deleting, and transferring each check every resulting balance before any write and reject the whole command with exit 3

Story Guidance

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

None.

Surfaced Acceptance Criteria

IDStory IDCriterion
AC-001LEDGER-SCHEMA-001init writes nothing to standard output and exits 0
AC-002LEDGER-LOAD-001A rejected accounts load stores none of the rows before the rejected row
AC-003LEDGER-LOAD-003A rejected transactions load stores none of the rows before the rejected row
AC-004LEDGER-ACCT-001Account code validation rejects lowercase letters, codes longer than 12 characters, and empty codes with exit 3
AC-005LEDGER-TXN-001Amount input with three decimal places is rejected with exit 3
AC-006LEDGER-TXN-001Date 2026-02-30 is rejected with exit 3
AC-007LEDGER-TXN-003Amending a transaction to an amount that would drive its account below zero exits 3 and leaves the original amount
AC-008LEDGER-TXN-004Deleting a transaction that would drive its account below zero exits 3 and keeps the row
AC-009LEDGER-XFER-001A transfer whose source would go negative stores neither of its two rows
AC-010LEDGER-XFER-001A transfer with equal source and destination accounts exits 3
AC-011LEDGER-RPT-002Categories with no transactions appear in the report with zero values

Source Inventory

PathContent kindDispositionReason
sources/INSTRUCTIONS.mdmarkdownanalyzedreadable UTF-8
sources/run.shcodeanalyzedreadable UTF-8
sources/seed_accounts.csvtextanalyzedreadable UTF-8
sources/seed_categories.csvtextanalyzedreadable UTF-8
sources/seed_transactions.csvtextanalyzedreadable UTF-8
sources/seed_transactions_bad.csvtextanalyzedreadable UTF-8

Relationship Model

Source or groupRelationship typeRelated source or groupEvidenceDelivery implication
sources/run.shinstruction-to-testsources/INSTRUCTIONS.mdGrader known answers mirror the CLI contract and rules in INSTRUCTIONS.mdGrader is the final acceptance gate; stories must reproduce its outputs exactly
sources/seed_accounts.csvdependencysources/run.sh (B1, D2, C1)Grader loads these rows and asserts their counts and balancesAccount load story must precede balance report stories
sources/seed_categories.csvdependencysources/run.sh (B2, C2)Grader loads these rows and asserts category totalsCategory load story must precede category report story
sources/seed_transactions.csvdependencysources/run.sh (B3, C1–C3)Grader loads 120 rows and asserts all report totalsTransaction load story must precede all report stories
sources/seed_transactions_bad.csvinstruction-to-testsources/run.sh (D1)Row 11 names unknown account NOSUCH; grader expects exit 3 with no writesLoad validation must be atomic
sources/INSTRUCTIONS.mddependencysources/run.shOutput formats and exit codes are fixed by INSTRUCTIONS.mdOutput and exit-code stories derive from this file

Source Roles

PathRolePlan dispositionBuild disposition
sources/INSTRUCTIONS.mdnormative specificationcontextprompt-only
sources/run.shconformance harnesscompassstage
sources/seed_accounts.csvtest helpercontextstage
sources/seed_categories.csvtest helpercontextstage
sources/seed_transactions.csvtest helpercontextstage
sources/seed_transactions_bad.csvtest helpercontextstage

Planning Instructions

Delivery Shape

The system is a Python 3.11+ command-line executable named ledger at the application root. Inputs are command-line arguments and CSV files named on the command line. Outputs are CSV on standard output and diagnostics on standard error. All persistence goes through the shipped persistence library over SQLite, with DATABASE_URL or DATABASE_PATH selecting the database file. Each writing command validates all inputs and rules before its first write, so it either completes fully or changes nothing.

Story Realization Map

Test and Acceptance Strategy

Focused story tests run the story's own slice of the Python test suite in bin/test.sh, scoped per story. The terminal verification story runs the grader sh sources/run.sh and the unfiltered suite. Sea Trials are verified by the SEA_TRIALS.md criteria, and the grader is the authoritative proof for report and workflow correctness.

Sequencing and Dependencies

  1. LEDGER-SCHEMA-001 (init and count) first.
  2. LEDGER-LOAD-001, LEDGER-LOAD-002 in parallel after LEDGER-SCHEMA-001.
  3. LEDGER-LOAD-003 after LEDGER-LOAD-001 and LEDGER-LOAD-002.
  4. Account, transaction, and transfer stories after the loads.
  5. Report stories after all write stories are in place.
  6. LEDGER-CLI-001 and LEDGER-CLI-002 cross-cut and are verified during each story they touch.
  7. Terminal verification story runs the full grader after all others.

Source Conflicts and Gaps

Analysis Notes

generated: 2026-10-27 blueprint: /mnt/c/Users/barlo/projects/drydock/uat/LayersTesting/runs/20261027.135355/workspace/targets/LayersTesting/blueprint

Quality: Ready blockers: 0 questions: 0 features: 6 stories: 15 stack: Python 3.11+, SQLite, pytest display_name: not proposed short_description: not proposed

Observations: