Changes between Version 3 and Version 4 of Use-Case


Ignore:
Timestamp:
09/24/26 13:18:08 (3 days ago)
Author:
231285
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Use-Case

    v3 v4  
    11= Use-case model =
    22
    3 The detailed pages for this phase are kept in the project's GitHub repository,
    4 [https://github.com/StefanTrsunov/bp StefanTrsunov/bp], under `docs/P3-UseCaseModel/`. Every
    5 use-case link below opens the corresponding file there.
     3The detailed pages for this phase are kept in the project's !GitHub repository,
     4`https://github.com/StefanTrsunov/bp`, under `docs/P3-UseCaseModel/`. Every
     5use case below is documented on its own wiki page (UseCase0001 to UseCase0007).
    66
    77== Actors / Roles ==
    88
    9 '''Visitor''' – Anyone using EduBerza without an account, who can look at public market
     9'''Visitor''' – Anyone using !EduBerza without an account, who can look at public market
    1010information, create an account, and log in.
    1111
    … …  
    2121=== Visitor ===
    2222
    23  * [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0001.md UC0001] –
     23 * UC0001 –
    2424   '''Register new account''' – Visitor creates an account with a unique username and e-mail; the
    2525   password is stored as a SHA-256 hash.
    26  * [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0002.md UC0002] –
     26 * UC0002 –
    2727   '''Log in''' – Visitor authenticates with username and password so the system treats every
    2828   following action as a Trader.
    … …  
    3030=== Trader ===
    3131
    32  * [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0003.md UC0003] –
     32 * UC0003 –
    3333   '''Deposit virtual funds''' – Trader tops up their virtual cash balance; the user row and the
    3434   ledger are written in one transaction.
    35  * [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0004.md UC0004] –
     35 * UC0004 –
    3636   '''Place market BUY order''' – Trader buys a crypto asset at the current market price, which
    3737   debits cash and upserts the holding at a running weighted-average price.
    38  * [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0005.md UC0005] –
     38 * UC0005 –
    3939   '''Place market SELL order''' – Trader sells part or all of a holding at the current market
    40    price, which credits cash and preserves the cost basis.
    41  * [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0006.md UC0006] –
     40   price, which reserves the crypto being sold, credits cash and preserves the cost basis.
     41 * UC0006 –
    4242   '''View portfolio and transaction history''' – Trader inspects current holdings, unrealised
    4343   P/L, cash balances and the most recent ledger entries.
    44  * [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0007.md UC0007] –
     44 * UC0007 –
    4545   '''Manage watchlist''' – Trader lists, adds and removes crypto assets on a personal watchlist,
    4646   where adding an asset already on the list is a no-op.
    … …  
    4949
    5050The Market Simulator initiates no use case of its own. It participates in
    51 [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0004.md UC0004] and
    52 [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0005.md UC0005]
     51UC0004 and
     52UC0005
    5353indirectly, by keeping `project.market_trades` populated so that `project.v_latest_prices`
    5454returns a current price for every active market.
    … …  
    5757
    5858{{{#!comment
    59 The diagram is optional for P3. Commit the exported image to
    60 docs/P3-UseCaseModel/use_case_diagram.png and then replace this comment with:
     59The diagram is optional for P3. Attach the exported image use_case_diagram.png
     60to this wiki page and then replace this comment with:
    6161
    62 [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/use_case_diagram.png Use-case model diagram]
     62[[Image(use_case_diagram.png)]]
    6363}}}
    6464
    … …  
    6767The following use-cases are documented in detail, with SQL tested against the P2 database:
    6868
    69  * [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0001.md UseCase0001] – Visitor registers a new account
    70  * [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0002.md UseCase0002] – Visitor logs in
    71  * [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0003.md UseCase0003] – Trader deposits virtual funds
    72  * [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0004.md UseCase0004] – Trader places a market BUY order
    73  * [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0005.md UseCase0005] – Trader places a market SELL order
    74  * [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0006.md UseCase0006] – Trader views portfolio and transaction history
    75  * [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0007.md UseCase0007] – Trader manages a watchlist
     69 * UseCase0001 – Visitor registers a new account
     70 * UseCase0002 – Visitor logs in
     71 * UseCase0003 – Trader deposits virtual funds
     72 * UseCase0004 – Trader places a market BUY order
     73 * UseCase0005 – Trader places a market SELL order
     74 * UseCase0006 – Trader views portfolio and transaction history
     75 * UseCase0007 – Trader manages a watchlist
    7676
    7777== Realization details on selection of the most important use cases ==
    … …  
    7979This is a solo project, so '''at least 3 use cases''' are required. '''7 use cases''' are
    8080documented, for a safety margin. All seven are implemented in the P4 prototype; see
    81 [https://github.com/StefanTrsunov/bp/tree/main/server server/] for the Go source and
    82 [https://github.com/StefanTrsunov/bp/blob/main/docs/P4-Prototype/PrototypeImplementation.md PrototypeImplementation]
     81`server/` for the Go source and
     82!PrototypeImplementation
    8383for the documented runs.
    8484
    8585||=Use case=||=Importance=||=Why it was selected=||
    86 ||[https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0001.md UC0001 – Register]||High||Nothing else works without it; demonstrates `INSERT` with a uniqueness check.||
    87 ||[https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0002.md UC0002 – Log in]||High||Authenticates every Trader action; demonstrates `SELECT` with parameter binding.||
    88 ||[https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0003.md UC0003 – Deposit]||High||Shows a multi-row transaction: `UPDATE users` plus `INSERT INTO transactions`.||
    89 ||[https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0004.md UC0004 – Buy]||Very high||Core of the exchange: `INSERT orders`, `UPDATE users`, upsert `holdings`, ledger entry, market trade.||
    90 ||[https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0005.md UC0005 – Sell]||Very high||Dual of Buy; demonstrates row-level `FOR UPDATE` locking and cost-basis bookkeeping.||
    91 ||[https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0006.md UC0006 – Portfolio]||High||Demonstrates joins over `holdings`, `markets` and `crypto`, and the `v_portfolio` view.||
    92 ||[https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCase0007.md UC0007 – Watchlist]||Medium||Demonstrates N–M relation handling and `ON CONFLICT` upsert semantics.||
    93 
     86||UC0001 – Register||High||Nothing else works without it; demonstrates `INSERT` with a uniqueness check.||
     87||UC0002 – Log in||High||Authenticates every Trader action; demonstrates `SELECT` with parameter binding.||
     88||UC0003 – Deposit||High||Shows a multi-row transaction: `UPDATE users` plus `INSERT INTO transactions`.||
     89||UC0004 – Buy||Very high||Core of the exchange: `INSERT orders`, `UPDATE users`, upsert `holdings`, ledger entry, market trade.||
     90||UC0005 – Sell||Very high||Dual of Buy; demonstrates row-level `FOR UPDATE` locking, reservation of committed crypto (`holdings.reserved_quantity`) and cost-basis bookkeeping.||
     91||UC0006 – Portfolio||High||Demonstrates joins over `holdings`, `markets` and `crypto`, and the `v_portfolio` view.||
     92||UC0007 – Watchlist||Medium||Demonstrates N–M relation handling and `ON CONFLICT` upsert semantics.||
    9493
    9594== AI usage ==
    … …  
    9897
    9998 * '''Phase log:'''
    100    [https://github.com/StefanTrsunov/bp/blob/main/docs/P3-UseCaseModel/UseCaseModelAIUsage.md UseCaseModelAIUsage.md]
     99   UseCaseModelAIUsage
    101100   – service used, what the AI produced, and what I decided myself.
    102101 * '''Full conversation transcript:'''
    103    [https://github.com/StefanTrsunov/bp/blob/main/docs/P1-ConceptualModel/ERModelAIUsage.md ERModelAIUsage.md]
     102   ERModelAIUsage
    104103   – the same conversation produced the P1–P4 artefacts, so the complete prompt/response log is
    105    kept in one place. Direct links:
    106    [https://github.com/StefanTrsunov/bp/blob/main/docs/P1-ConceptualModel/ERModelAIUsage.md#session-1--2026-04-21 Session 1 – 2026-04-21],
    107    [https://github.com/StefanTrsunov/bp/blob/main/docs/P1-ConceptualModel/ERModelAIUsage.md#session-2--2026-08-06--2026-08-07 Session 2 – 2026-08-06/07].
     104   kept in one place. Relevant sections of that page:
     105   Session 1 – 2026-04-21,
     106   Session 2 – 2026-08-06/07,
     107   Session 3 – 2026-09-16.
    108108
    109 '''Service:''' Claude Code (Anthropic), https://claude.com/claude-code – Claude subscription,
    110 model Claude Opus 4.7 (1M context).
     109'''Service:''' Claude Code (Anthropic), `https://claude.com/claude-code` – Claude subscription,
     110model Claude Opus 4.7 (1M context) in sessions 1–2, Claude Sonnet 5 in session 3.
    111111
    112112'''In short:''' the AI proposed the actor taxonomy and drafted the seven use cases with their SQL
    113113in session 1. In session 2 the use-case model itself was '''not''' changed – the only work was
    114114re-executing every scenario, including the failure paths, against a live PostgreSQL 16 database.
     115In session 3, UC0004 and UC0005 were revised to reserve the resource an order commits (crypto on
     116a sell) before settling it, closing a gap where nothing stopped a second sell order from being
     117granted crypto already promised to a first one; see the Session 3 – 2026-09-16 section of
     118UseCaseModelAIUsage.