Understand the data behind the screen
Know what the app remembers and who should be allowed to see it.
By the end, you can describe a , its owner, and which actions different users can take.
Step 1: The screen reflects saved records
A is one saved , such as one note. Fields hold its parts: identifier, owner, and text. The browser is the display window; the database is the stockroom. Hiding a record in the display window does not lock the stockroom.
Step 2: Decide who may do each action
The owner identifies whose it is. A is an identity or permission group, such as organizer or attendee. Write rules for reading, creating, editing, and deleting. Signing in identifies a person; it does not give them edit access to everybody’s events.
Step 3: Ask for a data gate
The server or database must enforce the access rule before returning or changing private . In Supabase, () applies policies to saved . Enabling the switch is not proof that the policies work. Administrator connections can bypass policies and are not a learner-account test.
Step 4: Test ordinary users and shared claims
With fictional data, A reads A’s note but cannot read or edit B’s note; signed-out access follows the private-note rule. Test inserts and attempts to change ownership too. If one available book is reserved immediately, two members’ need a shared database check-and-claim rule. Separate browser buttons cannot protect one shared copy.
Interactive System Map
Two common ways the pieces connect
The browser shows the interface. Data rules decide what a signed-in person may read or change. Private service credentials stay on the server.
Read or save user-owned data
A browser can safely use a publishable Supabase key when Row Level Security protects the exposed tables.
Call a private outside service
When an operation needs a private key or server-only check, send it through your app server.
List each ’s fields, owner, and allowed read/create/edit/delete actions. Propose database access rules and show checks as ordinary A, B, and signed out using fictional notes. For immediate book reservations, explain how the database checks and claims one copy together. Do not apply policies until I review them. Illustrative before / after (behavior, not ready-to-run code): - Fetch all notes, then hide other owners + Verify identity → apply saved access rule → return permitted notes
Test both allowed and denied actions. If the feature is a waitlist rather than a reservation, state that rule explicitly before designing availability checks.
Picture it, then try it
Test the locker with ordinary keys
Each private note is a locker. An administrator's master key opening it says nothing about whether a visitor's key works correctly.
Private-note test Expected A reads A allowed A reads or edits B denied A assigns owner B denied Signed out reads notes denied
AI shows that is enabled and an administrator can read drafts. What evidence is missing?
Compare your reasoning with the worked answer
Test allowed and denied actions as ordinary A, B, and signed out using fictional . Check inserting a for another owner and changing ownership as well as reading. is the database row-access rule system; the switch alone does not establish correct policies. A page filter cannot protect records already downloaded.
Picture it, then try it
One repeated ticket versus two competing tickets
Showing the same coat-check ticket twice should retrieve one saved result. Two different tickets for the last available item require the clerk to check and claim it together.
Same intent: R7 → saved R7 → retry returns R7 Different intents: R7 ─┐ R8 ─┴→ one copy → one confirmed claim Unsafe: both read available → both save reserved Safe: check-and-claim together → one succeeds
Two people use different valid for one book. Does retry protection decide who gets the book?
Compare your reasoning with the worked answer
No. Same-key protection handles a repeated intent. The database must separately preserve the one-copy rule using an appropriate conditional claim or locking/isolation design. A groups work but does not by its name alone prevent two reads from making conflicting decisions. The losing needs a truthful unavailable result.
Sources and further reading
Notes are private to their owners. The AI hides other owners’ notes after downloading them. What must change before real notes are used?
Choose one answer.