Skip to content

app/: the web app's project, build, snapshot, review and comment pages (sc-8900) - #106

Merged
ndbroadbent merged 3 commits into
mainfrom
laravel-ui-pages
Dec 3, 2026
Merged

ndbroadbent merged 3 commits into
mainfrom
laravel-ui-pages

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

The web app's core JSON endpoints, ported from server/src/controllers/ui.rs to app/src/http/ui/ (sc-8900, a cutover blocker). Same JSON, role checks, status codes and error bodies as today. Based on main.

Routes

  • Projects (projects.rs):
    • GET /api/ui/orgs/{org}/projects/{project}: settings, newest 100 builds, tokens for members, role, member, public, repository_seen_in_ci, has_documents, gallery.
    • POST /api/ui/orgs/{org}/projects: admins.
    • PATCH /api/ui/orgs/{org}/projects/{project}: admins, on domain::projects::change_settings; a changed repository_url links (or unlinks) through forge::link::link_repository first, with today's 400s.
  • Builds (builds.rs):
    • GET …/builds/{number}: snapshots in review order with approved_elsewhere, local baseline notes (members only), flaky, matches and on_main_unreviewed, thumbnails and text line counts; the reviews with who, client, agent and note; can_review.
    • GET …/builds/{number}/snapshots/{pid}: the comparison (or against=previous), with context and its threads.
    • POST …/builds/{number}/review, with snapshot_ids or only.
    • POST …/snapshots/{pid}/pages/{position}/{action}.
    • GET …/pulls/{number}.
  • Comments (comments.rs):
    • POST …/snapshots/{pid}/comments (a new thread or a reply);
    • PATCH and DELETE …/comments/{id};
    • POST …/threads/{id}/resolve.

Rules, as today

  • A project's members see it with their role. Anyone, signed in or not, reads a public project (the demo) as read, without tokens, local baseline notes or where local builds ran. Anything else is a 404, so private projects stay invisible.
  • Review, page actions, commenting and resolving need a member (not read-only); settings and creating projects need an admin. Refusals are a 403 {"error": "forbidden", "description": "only … of the organization can …"}.
  • A required session that's missing gives today's 401 body; a bad value gives a 400 {"error": "Bad Request", "description": …}, and a taken project slug today's "that name is taken".

Differences and follow-ups

Performance and edge cases

  • The build page reads no page text except the first changed page of each changed text snapshot (for its line counts): one query for those pages' text hashes, one for the texts. It no longer loads every page's text (pages::of_many_without_text). Thumbnails' blobs are checked in one chunked query.
  • A slug taken by a concurrent request (PostgreSQL's unique violation, 23505) answers as today: "that name is taken" in the web app, "Entity already exists" over MCP (today's e.to_string() of Loco's EntityAlreadyExists), never a 500. domain::projects::create now says why it refused (Refused::InvalidSlug or Refused::Taken).
  • page_action on a position the snapshot doesn't have is a 404, as today. An existing page that can't take the action is its 400.
  • Carried-forward and unchanged snapshots: today's server compared carried-forward snapshots, so they had page rows and a thumbnail. Here their pages are synthesized from the render or the source image, so the build page shows the same page counts and thumbnail.

Tests

tests/ui.rs ports server/tests/requests' assertions for these routes:

  • demo.rs: anyone reads the demo, an outsider can't review, and a private project is a 404 signed out and for a signed-in outsider.
  • public_projects.rs: only an admin makes a project public, and only with a public repository; outsiders see builds and the pull request page without laptop details, and can't review.
  • access.rs: a read-only member looks but can't change settings (today's 403 text), review or comment.
  • A member's comment, reply, edit, resolve and delete, an open thread blocking approval, and the review showing on the build page with its source and note.
  • Linking from the settings page, with GitHub's answers faked: a read-only member is refused before the forge (403), a writer gets today's refusal, a bad URL and a repository linked in another organization are refused, and move_link moves it.
  • A slug taken in a race (a trigger inserts the same slug between the check and the insert), and a missing page position (404).
  • tests/mcp.rs: update_project_links_a_repository_as_the_forge_allows, a new golden directory: a project token refused, a writer refused, a maintainer links.

Gates on agents-build-2, with a throwaway Postgres 17 and RustFS, removed after: fmt, clippy (--locked) and the full app suite (--locked) all exited 0.

ndbroadbent added a commit that referenced this pull request Dec 3, 2026
…rst changed page of text snapshots (for line counts) and checks thumbnails in one query; a slug taken in a race answers today's words ("that name is taken" in the web app, "Entity already exists" over MCP); a page position a snapshot doesn't have is a 404; the settings page and MCP update_project link repositories through forge::link::link_repository
…s (sc-8900): show_project, create_project and update_project, show_build with its reviews, show_snapshot, review, page_action, the pull request changeset and the comment routes, with today's JSON, role checks (members, read-only members, public projects) and error bodies
…rst changed page of text snapshots (for line counts) and checks thumbnails in one query; a slug taken in a race answers today's words ("that name is taken" in the web app, "Entity already exists" over MCP); a page position a snapshot doesn't have is a 404; the settings page and MCP update_project link repositories through forge::link::link_repository
@ndbroadbent
ndbroadbent merged commit 37d0750 into main Dec 3, 2026
12 checks passed
@ndbroadbent
ndbroadbent deleted the laravel-ui-pages branch December 3, 2026 03:45
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