Changes between Version 1 and Version 2 of RelationalAIUsage


Ignore:
Timestamp:
09/29/26 20:58:04 (9 hours ago)
Author:
231285
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RelationalAIUsage

    v1 v2  
    1212=== Diagram ===
    1313
    14 The student produces `relational_schema.jpg` in DBeaver from the live `project` schema; see !RelationalDesign for instructions.
     14`relational_diagram_v4.png` was exported by the student in DBeaver from the live `project` schema, with the tables in the same positions as the entity sets of `ERModel_v05.png`; see [wiki:RelationalDesign] (section "How to regenerate it") for instructions.
    1515
    1616=== Results in details / description ===
    … …  
    3737== Entire AI usage log ==
    3838
    39 See ERModelAIUsage — the full transcript of the 2026-04-21 conversation covers both P1 and P2 work. The specific prompts that drove the relational-design output were the same "make it work and make it fill in or to follow all of the needed instructions" instruction and the student's subsequent "do everything that you need to do".
     39See [wiki:ERModelAIUsage] — the full transcript of the 2026-04-21 conversation covers both P1 and P2 work. The specific prompts that drove the relational-design output were the same "make it work and make it fill in or to follow all of the needed instructions" instruction and the student's subsequent "do everything that you need to do".
    4040
    4141> '''Student action required:''' append any future consultations where you asked the AI to refine the schema, tune constraints, or write additional queries.
    … …  
    4444=== Session 2 — 2026-08-06 / 2026-08-07 ===
    4545
    46 Prompts are logged in full in ERModelAIUsage (section "Session 2 — 2026-08-06 / 2026-08-07");
     46Prompts are logged in full in [wiki:ERModelAIUsage] (section "Session 2 — 2026-08-06 / 2026-08-07");
    4747the one that drove this phase was ''"Also fix some database things or golang things if you think we can do it better"''. Changes to the P2 artefacts:
    4848
    … …  
    5353   `float64`, which was reported to the user as "Insufficient holding") was fixed
    5454   at the same time.
    55  * !RelationalDesign gained an explicit account of the
     55 * [wiki:RelationalDesign] gained an explicit account of the
    5656   partial transformation: which ER construct each foreign key comes from, that
    5757   M:N relationships with attributes become tables whose foreign-key pair is a
    … …  
    7070
    7171Driven by the same design review logged in full in
    72 ERModelAIUsage (section "Session 3 — 2026-09-16"):
     72[wiki:ERModelAIUsage] (section "Session 3 — 2026-09-16"):
    7373a sell order had nothing to check `holdings.quantity` against except itself,
    7474so nothing stopped two sell orders from being granted the same units.
    … …  
    8080 * `v_portfolio` gained `reserved_quantity` and the derived
    8181   `available_quantity = quantity - reserved_quantity`.
    82  * !RelationalDesign gained a "Reservation and the order
     82 * [wiki:RelationalDesign] gained a "Reservation and the order
    8383   lifecycle" section explaining why the check is enforced at the database
    8484   level rather than trusted to application code, and why it does not conflict
    … …  
    9090(`-init` then `-load-data`), and against a manually seeded 2 BTC holding to
    9191reproduce the exact scenario that motivated the change — see
    92 UseCase0005Implementation for
     92[wiki:UseCase0005Implementation] for
    9393the transcript.
    9494
    … …  
    9696`trade.go` alone to keep the reservation consistent — the same reasoning
    9797already applied to `avg_price NOT NULL` in session 2.
     98
     99=== Session 4 — 2026-09-29 (Claude Opus 5.5): correction after review ===
     100
     101'''Prompt (student, excerpt):''' I pasted the reviewer's comments on P2:
     102
     103> the `contains` relationship from the model is implemented differently in the database
     104> the `holds` relationship from the model is implemented differently in the database
     105> there may be other inconsistencies that are difficult to spot; the Phase 2 diagram should
     106> have been created using DBeaver with a layout visually similar to the ERD
     107
     108> I suggest correcting only the Phase 1 model so that it matches Phase 2 [...] For Phase 2,
     109> simply update the image according to the requirements.
     110
     111'''Response (AI, summarised):'''
     112
     113 * Explained the mismatch. In the model, `Holds` and `Contains` were M:N relationships, whose table key would be the pair `{user_id, crypto_id}` / `{watchlist_id, crypto_id}`. But `holdings` and `watchlist_items` have their own `id` primary key, which is how an entity set is implemented. Following the reviewer's advice, P1 was corrected (v05, entity sets `Holdings` and `WatchlistItems`), and the database was not changed.
     114 * Found the other inconsistencies between this page and the live schema. The page was missing `users.reserved_balance`, `orders.filled_quantity`, the status `partially_filled`, `market_trades.buy_order_id` / `sell_order_id` and the whole `order_events` table. The "10 tables", "5 indexes" and "the one nullable foreign key" counts were also out of date (really 11 tables, 8 indexes in `schema_creation.sql`, and 3 nullable foreign keys).
     115 * Rewrote [wiki:RelationalDesign]. Each relation is labelled with its entity set and each foreign key with its relationship, and the transformation is a table of all 15 relationships → 15 foreign keys, with `NOT NULL` following participation.
     116 * Wrote export instructions with a table grid that mirrors `ERModel_v05.png`.
     117
     118'''What I decided:''' to correct P1 instead of the database, as the reviewer suggested. I
     119exported `relational_diagram_v4.png` from DBeaver myself, with the tables arranged like the
     120ER diagram.