Skip to content
This repository was archived by the owner on Feb 17, 2026. It is now read-only.

docs: update schema documentation#9

Merged
kubrickcode merged 1 commit intomainfrom
docs/update-schema-docs
Feb 1, 2026
Merged

docs: update schema documentation#9
kubrickcode merged 1 commit intomainfrom
docs/update-schema-docs

Conversation

@kubrickcode
Copy link
Member

Automated update of schema documentation from specvital-infra.

Generated by tbls - includes:

  • Table details with columns, types, constraints
  • Indexes and unique keys
  • ER diagram (Mermaid)

Triggered by: feat(db): add quota_reservations table for concurrent request handling

Concurrent requests caused race condition leading to quota overflow and server resource waste.
Existing CheckQuota only checked completed usage, ignoring estimated usage of pending jobs.

Adopted Reservation pattern: reserve estimated amount at request, charge actual amount at completion.
Rejected pre-deduction+refund due to UX complexity, Worker re-check fails "block at web level" requirement.
Added expires_at column for orphan reservation cleanup (per database-architect recommendation).

@gemini-code-assist
Copy link

Summary of Changes

Hello @kubrickcode, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request automates the update of the database schema documentation, incorporating the newly introduced public.quota_reservations table. This table is a critical addition, designed to address issues with concurrent requests and quota management by implementing a reservation-based system. The updated documentation provides a clear overview of the new table's structure, its relationships with other tables, and its role in ensuring robust resource allocation.

Highlights

  • New Table Documentation: Documentation for the public.quota_reservations table has been added, detailing its structure, columns, constraints, and indexes.
  • Schema Overview Updates: The main README.md and public.users.md files have been updated to include references to the new public.quota_reservations table, including its foreign key relationship to public.users within ER diagrams.
  • Comprehensive JSON Schema Update: The schema.json file now contains the complete and detailed schema definition for public.quota_reservations, ensuring programmatic access to its structure.
  • Quota Management Solution: The quota_reservations table is introduced to address concurrent request issues and prevent quota overflow by implementing a reservation pattern for estimated resource usage.
  • Orphan Reservation Cleanup: The new table includes an expires_at column, allowing for the automatic cleanup of expired or orphaned quota reservations.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces automated documentation updates for the new quota_reservations table, which is a crucial addition for handling concurrent requests and preventing quota overflows. The changes are well-structured and the new schema design appears sound. My review includes a couple of suggestions to enhance the clarity of the generated documentation for the new table, primarily by adding descriptive text that explains its purpose and the roles of its columns.

# public.quota_reservations

## Description

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Description section for the new quota_reservations table is empty. Adding a brief explanation of the table's purpose would significantly improve the documentation's clarity, especially for new developers. You could use information from the pull request description to explain how this table helps prevent race conditions in quota management.

Suggested change
Stores temporary reservations for quota-consuming operations to prevent race conditions and quota overflows from concurrent requests. A reservation is created when a job is requested and is consumed or expires after the job completes or times out.

Comment on lines +9 to +15
| id | uuid | gen_random_uuid() | false | | | |
| user_id | uuid | | false | | [public.users](public.users.md) | |
| event_type | usage_event_type | | false | | | |
| reserved_amount | integer | | false | | | |
| job_id | bigint | | false | | | |
| expires_at | timestamp with time zone | (now() + '01:00:00'::interval) | false | | | |
| created_at | timestamp with time zone | now() | false | | | |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Comment column is empty for all fields in the quota_reservations table. Adding comments to explain the purpose of each field would improve the documentation's clarity. Since this is auto-generated documentation, you might need to add these comments in the database schema itself so they are picked up by tbls on the next run.

For example:

  • job_id: "The ID of the background job (e.g., from River) that this reservation is for."
  • reserved_amount: "The estimated quota amount reserved for the operation."
  • expires_at: "Timestamp when the reservation becomes invalid and can be cleaned up if the job is orphaned."

@kubrickcode kubrickcode merged commit c001b0b into main Feb 1, 2026
1 check passed
@kubrickcode kubrickcode deleted the docs/update-schema-docs branch February 1, 2026 11:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant