| 1 | # Use-Case Model AI Usage
|
|---|
| 2 |
|
|---|
| 3 | ## Name of AI service/solution that was used
|
|---|
| 4 |
|
|---|
| 5 | **Claude Code** (Anthropic)
|
|---|
| 6 |
|
|---|
| 7 | - **URL:** https://claude.com/claude-code
|
|---|
| 8 | - **Type of service/subscription:** Claude subscription, model Claude Opus 4.7 (1M context).
|
|---|
| 9 |
|
|---|
| 10 | ## Final result
|
|---|
| 11 |
|
|---|
| 12 | ### Results in details / description
|
|---|
| 13 |
|
|---|
| 14 | The AI:
|
|---|
| 15 |
|
|---|
| 16 | - Proposed the actor taxonomy (Visitor, Trader, Market Simulator) from the project description and the existing Go code.
|
|---|
| 17 | - Derived a set of 7 use cases covering the full trading loop (register, login, deposit, buy, sell, view portfolio, watchlist).
|
|---|
| 18 | - Wrote each `UseCaseXXXX.md` file with:
|
|---|
| 19 | - initiating actor, other actors, goals
|
|---|
| 20 | - step-by-step dialog-form scenario
|
|---|
| 21 | - **tested** SQL statements for every database-touching step, using the `project` schema
|
|---|
| 22 | - alternate flows for the most common failure cases (insufficient funds, insufficient holding, duplicate user, invalid input)
|
|---|
| 23 |
|
|---|
| 24 | ## Summary of AI involvement
|
|---|
| 25 |
|
|---|
| 26 | | | Session 1 — 2026-04-21 | Session 2 — 2026-08-06/07 |
|
|---|
| 27 | |---|---|---|
|
|---|
| 28 | | **What I brought** | The project description in `opis.md` and the existing Go backend | The use-case model as completed in session 1 |
|
|---|
| 29 | | **What the AI did** | Proposed the actor taxonomy and drafted seven use cases with tested SQL | Nothing — the model was not changed |
|
|---|
| 30 | | **What I decided** | To go solo, and therefore to document seven use cases rather than the three the rubric requires | To re-verify every scenario's SQL against a live database rather than trust the April run |
|
|---|
| 31 |
|
|---|
| 32 | This phase was finished in session 1. In session 2 the only work was
|
|---|
| 33 | verification: each scenario was executed against a live PostgreSQL 16 database,
|
|---|
| 34 | including the failure paths, and the results recorded on the
|
|---|
| 35 | `UseCaseXXXXImplementation` pages.
|
|---|
| 36 |
|
|---|
| 37 | ## Entire AI usage log
|
|---|
| 38 |
|
|---|
| 39 | See [ERModelAIUsage](../P1-ConceptualModel/ERModelAIUsage.md) for the full transcript — the same 2026-04-21 session produced the use-case documentation. The defining student prompt was:
|
|---|
| 40 |
|
|---|
| 41 | > I'm going solo do everything that you need to do, and tell me after what do I need to do
|
|---|
| 42 |
|
|---|
| 43 | which led the AI to pick "solo → 3 minimum per rubric → document 7 for a margin" as a default.
|
|---|
| 44 |
|
|---|
| 45 | > **Student action required:** append any future refinements of the use-case list or scenarios here.
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 | ### Session 2 — 2026-08-06 / 2026-08-07
|
|---|
| 49 |
|
|---|
| 50 | No changes were made to the use-case model in this session: the actor list, the
|
|---|
| 51 | seven use cases and the scenario SQL in `UseCase0001`–`UseCase0007` are as
|
|---|
| 52 | produced on 2026-04-21. The SQL in those scenarios was, however, re-verified by
|
|---|
| 53 | executing the corresponding prototype flows against a live PostgreSQL 16
|
|---|
| 54 | database, including the failure paths (insufficient funds, insufficient holding,
|
|---|
| 55 | duplicate registration, wrong password). The results are documented per use case
|
|---|
| 56 | on the `UseCaseXXXXImplementation` pages.
|
|---|
| 57 |
|
|---|
| 58 | ### Session 3 — 2026-09-16
|
|---|
| 59 |
|
|---|
| 60 | Driven by the design review logged in full in
|
|---|
| 61 | [ERModelAIUsage](../P1-ConceptualModel/ERModelAIUsage.md#session-3--2026-09-16):
|
|---|
| 62 | placing a sell order checked `holdings.quantity` directly, with no way to
|
|---|
| 63 | record that part of a position was already promised to another, unsettled
|
|---|
| 64 | order.
|
|---|
| 65 |
|
|---|
| 66 | **What changed:**
|
|---|
| 67 |
|
|---|
| 68 | - [UseCase0005](UseCase0005.md) — the scenario now reserves the crypto
|
|---|
| 69 | (`holdings.reserved_quantity`) before removing it from the position, checks
|
|---|
| 70 | `quantity - reserved_quantity` rather than raw `quantity`, and adds a
|
|---|
| 71 | worked example and a note on why the reserve and settle steps stay inside
|
|---|
| 72 | one transaction rather than two (only market orders are implemented, and
|
|---|
| 73 | splitting into two commits would risk an order stuck `open` with no cancel
|
|---|
| 74 | use case to recover it).
|
|---|
| 75 | - [UseCase0004](UseCase0004.md) — no change to the balance logic, but the
|
|---|
| 76 | order insert now goes through `status='open'` before a final
|
|---|
| 77 | `UPDATE ... SET status='executed'`, matching the sell side, so `Orders`
|
|---|
| 78 | genuinely has the lifecycle [ERModel](../P1-ConceptualModel/ERModel.md)
|
|---|
| 79 | describes for it rather than a status column that is only ever written
|
|---|
| 80 | once.
|
|---|
| 81 | - [UseCase0006](UseCase0006.md) — the `v_portfolio` reference and its query
|
|---|
| 82 | gained `reserved_quantity`/`available_quantity`, since the portfolio screen
|
|---|
| 83 | is where a Trader would actually see the new field.
|
|---|
| 84 | - The use-case importance table and UC0005's one-line description in
|
|---|
| 85 | [UseCaseModel](UseCaseModel.md) were reworded to mention the reservation.
|
|---|
| 86 |
|
|---|
| 87 | Every changed scenario's SQL was re-run against the live database, including a
|
|---|
| 88 | two-concurrent-sells test that reproduces the exact bug being fixed: see
|
|---|
| 89 | [UseCase0005Implementation](../P4-Prototype/UseCase0005Implementation.md).
|
|---|
| 90 |
|
|---|
| 91 | **What I decided:** to keep this a revision of the existing UC0004/UC0005
|
|---|
| 92 | pages rather than a new use case (e.g. "cancel order") — `cancelled` remains
|
|---|
| 93 | an unused status, same as before, since nothing in the prototype produces it
|
|---|
| 94 | and inventing a cancel flow was not what the review asked for.
|
|---|