Skip to content

Anonymous contribution via gitGost - #18

Merged
livrasand merged 1 commit into
livrasand:mainfrom
gitgost-anonymous:gitgost-1768601434
Jan 16, 2026
Merged

Anonymous contribution via gitGost#18
livrasand merged 1 commit into
livrasand:mainfrom
gitgost-anonymous:gitgost-1768601434

Conversation

@gitgost-anonymous

@gitgost-anonymous gitgost-anonymous commented Jan 16, 2026

Copy link
Copy Markdown
Collaborator

docs: add environment configuration guide and Supabase database integration

Agregado archivo .env.example con variables de entorno documentadas (GITHUB_TOKEN requerido, Supabase opcional). Actualizado README con sección "Hosted Configuration" explicando setup de GitHub token, variables de entorno y configuración opcional de Supabase. Creado schema.sql con tabla prs, índices, RLS policies y comentarios de privacidad. Implementado cliente Supabase en internal/database/supabase.go con métodos Ins


This is an anonymous contribution made via gitGost.

The original author's identity has been anonymized to protect their privacy.

Summary by CodeRabbit

  • New Features

    • Added optional PR statistics and recent pull request tracking with database persistence
    • Improved UI messaging about data storage location and anonymity protection
    • Dynamic API endpoint configuration for flexible deployment
  • Documentation

    • Added hosting configuration guide with GitHub token setup and optional database initialization instructions
  • Chores

    • Added environment configuration template

✏️ Tip: You can customize this high-level summary in your review settings.

…ration

Agregado archivo .env.example con variables de entorno documentadas (GITHUB_TOKEN requerido, Supabase opcional). Actualizado README con sección "Hosted Configuration" explicando setup de GitHub token, variables de entorno y configuración opcional de Supabase. Creado schema.sql con tabla prs, índices, RLS policies y comentarios de privacidad. Implementado cliente Supabase en internal/database/supabase.go con métodos Ins
@coderabbitai

coderabbitai Bot commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This pull request introduces Supabase-based database persistence for anonymous PR tracking. It adds environment configuration for GitHub token and Supabase credentials, implements a SQL schema with row-level security policies, creates a Supabase client for PR operations, refactors handlers to use database-backed statistics, and updates the web UI with dynamic API endpoints.

Changes

Cohort / File(s) Summary
Environment & Configuration
.env.example, internal/config/config.go, README.md
Introduces placeholder environment variables (GITHUB_TOKEN, SUPABASE_URL, SUPABASE_KEY) with usage guidance. Adds SupabaseURL and SupabaseKey fields to Config struct, populated from environment variables. Includes setup documentation for GitHub tokens and optional Supabase initialization.
Database Layer
database/schema.sql, internal/database/supabase.go
Defines SQL schema for prs table with columns for owner, repo, URL, and timestamp; adds unique index and row-level security policies allowing anonymous inserts and public reads. Implements SupabaseClient with methods for inserting, fetching, and counting PR records, including context-aware HTTP requests and proper error handling.
Application Initialization & Handlers
cmd/server/main.go, internal/http/handlers.go
Adds conditional database initialization in main based on Supabase environment variables. Refactors handlers to use centralized database client instead of in-memory storage. Introduces InitDatabase() and updates RecordPR() to accept context; replaces StatsHandler and RecentPRsHandler to query from database.
User Interface
web/index.html
Replaces hard-coded API endpoints with dynamic API_BASE selection (localhost vs. production). Updates contributor handle from @ghost-contributor to @gitgost-anonymous. Adds UI section highlighting commit messages as PR descriptions and explanatory notes about data storage location.

Sequence Diagram(s)

sequenceDiagram
    participant Web as Web Client
    participant Server as Git Server
    participant Handler as RecordPR Handler
    participant DB as Supabase DB

    Web->>Server: git push (with PR details)
    Server->>Handler: ReceivePack (owner, repo, prURL)
    Handler->>Handler: Extract PR metadata
    Handler->>DB: InsertPR(ctx, owner, repo, prURL)
    alt PR not duplicate
        DB->>DB: Insert row in prs table
        DB-->>Handler: 201 Created
        Handler->>Handler: Log success
    else URL already exists
        DB-->>Handler: 409 Conflict
        Handler->>Handler: Log duplicate
    end
Loading
sequenceDiagram
    participant Web as Web Client
    participant Server as Git Server
    participant Stats as StatsHandler
    participant Recent as RecentPRsHandler
    participant DB as Supabase DB

    Web->>Server: GET /api/stats
    Server->>Stats: Handle stats request
    Stats->>DB: GetTotalPRs(ctx)
    DB-->>Stats: Total count
    Stats->>DB: GetLatestPRCreatedAt(ctx)
    DB-->>Stats: Latest timestamp
    Stats-->>Web: {total_prs, latest_pr_timestamp}

    Web->>Server: GET /api/recent-prs
    Server->>Recent: Handle recent PRs request
    Recent->>DB: GetRecentPRs(ctx, limit)
    DB-->>Recent: Recent PR records
    Recent->>DB: GetTotalPRs(ctx)
    DB-->>Recent: Total count
    Recent-->>Web: {prs: [...], total_prs}
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰✨ A database takes the stage,
With Supabase turning a blank page,
PRs now persist in the cloud so bright,
Anonymous contributions, perfectly tight!
From memory's leap to SQL's grace,
hops — persistence finds its place! 🌱

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@livrasand
livrasand self-requested a review January 16, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants