Skip to content

app/: review fixes for the domain tables and the build API (sc-8900) - #71

Merged
ndbroadbent merged 2 commits into
mainfrom
laravel-review-fixes
Dec 2, 2026
Merged

ndbroadbent merged 2 commits into
mainfrom
laravel-review-fixes

Conversation

@ndbroadbent

Copy link
Copy Markdown
Member

The second review's fixes for #54 and #62, on top of #62. They go in before processing.

Schema (the baseline migration, since nothing has run it yet):

  • partial indexes on the foreign keys whose deletes would scan a big table: baselines.review_id, baselines.approved_by, builds.created_by_user_id, comments.user_id, comment_threads.resolved_by;
  • credit_transactions.build_id (ON DELETE SET NULL, indexed): a build charge names its build, and spend takes it;
  • credit_transactions.day, with a unique key on (organization, project, day) for gallery roll-ups.

Registration is one conditional upsert:

  • the update applies only over a carried-forward row or the same file;
  • no row back is the 409, so two shards racing with different files can't both win;
  • the update resets carried_forward, base_snapshot_id, review and error.

Limits:

  • commit and parent commits: 1 to 64 letters and digits. Not strictly 40 or 64 hex, because today's MCP contract tests send short commits like abc and lmn, and the golden answers echo them back;
  • branch ≤ 255, name ≤ 100, nonce ≤ 200, content type ≤ 255, meta ≤ 16 KB;
  • hashes must be lowercase hex, matching the blob store's key rule.

Also:

  • every snapshot in a request is validated before any is written;
  • today's 401 messages: missing project token, invalid project token, invalid personal access token;
  • the personal organization takes the next slug when a concurrent sign-up wins the race;
  • add_purchased_credits uses db::is_unique_violation.

Credits (for subdomains' /me and billing): plans, the allowance, the open source pool, blocked, spend and usage(&Organization), which is today's usage JSON.

Not here: expire_abandoned on build creation needs the processing job, so it lands with processing (or the stuck-build sweep, sc-8896).

Tests: limits and 401s, validate-before-write, usage. All of cargo test passes, and clippy is clean.

@visualci-com

visualci-com Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

VisualCI

docspring/visualci · build #372 · 331 unchanged · no changes

This PR vs base: nothing since #228, across 9 builds

Updated as builds change. Agents can review with VisualCI's MCP tools.

…keys whose deletes would scan (baselines.review_id and approved_by, builds.created_by_user_id, comments.user_id, comment_threads.resolved_by); credit_transactions.build_id and a gallery day key; snapshot registration as one conditional upsert (a race between two files is a 409 for one of them), resetting a carried row; limits on commits, parent commits, branch, name, nonce, content type and meta; every snapshot validated before any is written; today's 401 messages; the personal organization takes the next slug on a race; credits::usage, plans, allowance and spend
…'s server image sets it; build output under app/target/ is no longer tracked
@ndbroadbent
ndbroadbent merged commit cd0a6dd into main Dec 2, 2026
11 checks passed
@ndbroadbent
ndbroadbent deleted the laravel-review-fixes branch December 2, 2026 20:21
ndbroadbent added a commit that referenced this pull request Dec 2, 2026
…ads, the open source pool) from the domain's credits::usage, as today's (#71); the sc-8900 gate
ndbroadbent added a commit that referenced this pull request Dec 2, 2026
)

* app/: the person's own page (sc-8900): GET /api/ui/me (who they are, their organizations and roles, pending invitations, email choices, the heard-about question), email choices, an organization's billing email (admins), 'How did you hear about VisualCI?'; the team's email about each new sign-up through the outbox (reply-to the person), once answered or ten minutes after sign-up, every minute with a heartbeat (VISUALCI_SIGNUPS_HEARTBEAT) that fails when one waits over 40 minutes

* Me, review fixes: /me says which forges people can sign in with (an OAuth application with its ID and secret), as today's; staff who aren't in an organization can't change its billing email; the sign-ups heartbeat fails when the database can't answer

* Test: a signed-out /api/ui/me asks for JSON, as the React app does (a page request goes to /login since #57)

* /me: each organization's usage (plan, credits this month, packs, reloads, the open source pool) from the domain's credits::usage, as today's (#71); the sc-8900 gate

* Rebased on main: Cargo.lock resolved from main's, and the boot checks and dependencies merged
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.

1 participant