Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ Each Node.js project's `engines.node` declares its supported versions. Hub, Star

### Replica Hub

Hub has a TypeScript Express API, React + Vite frontend, and PostgreSQL with Prisma. Hosting and review features are not built yet. Use the [Hub devcontainer](hub/docs/development.md#devcontainer), or npm and a Node.js version matching `engines.node` in [hub/package.json](hub/package.json):
Hub has a TypeScript Express API, React + Vite frontend, and PostgreSQL with Prisma. To work on the UI without running Hub, use [Storybook](hub/docs/storybook.md):

```sh
cd hub
npm ci
npm run dev:mock
npm run storybook
```

See [Hub development](hub/docs/development.md) for setup and [Routed frontend](hub/docs/frontend.md) for the current frontend workflow and API contracts. A GitHub App is not required.
See [Hub development](hub/docs/development.md) to start the real app and [Routed frontend](hub/docs/frontend.md) for routes and API contracts. Local developer sign-in does not require a GitHub App.

### Replica Starter

Expand Down Expand Up @@ -118,12 +118,12 @@ Run `npm run test:database` for server cases that save records. Follow the [data

Useful focused commands include:

| Goal | Command |
| --------------- | ----------------------------------------------- |
| TypeScript test | `npm test -- PATH` |
| Type check | `npm run typecheck` |
| Storybook build | `npm run storybook:build` |
| Prose review | `bin/review-prose` |
| Goal | Command |
| --------------- | ------------------------- |
| TypeScript test | `npm test -- PATH` |
| Type check | `npm run typecheck` |
| Storybook build | `npm run storybook:build` |
| Prose review | `bin/review-prose` |

From the repository root, run `hub/bin/review-prose` to include changed prose across all projects. Hub and build-action dependency updates must satisfy the [shared dependency policy](docs/testing-and-review.md#update-dependencies). See [Hub testing and operations](hub/docs/testing-and-operations.md) for the complete Hub check and review workflow.

Expand Down
6 changes: 3 additions & 3 deletions hub/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ Run the following commands from `hub/`, using a Node.js version supported by `en

```sh
npm ci --engine-strict
npm run dev:mock
npm run storybook
```

Open <http://127.0.0.1:5173/repositories/2001> for the mock frontend; it needs no API, database, or credentials. Installation generates Prisma Client without connecting to PostgreSQL.
Open <http://127.0.0.1:6006> for [Storybook](docs/storybook.md); it needs no API, database, or credentials. Installation generates Prisma Client without connecting to PostgreSQL.

After installing Hub dependencies, use the [devcontainer](docs/development.md#devcontainer) for the real API or prepare local PostgreSQL and configuration. Copy `.env.example` only for first-time setup; preserve an existing `.env` and never commit credentials.

Expand Down Expand Up @@ -69,6 +69,6 @@ For documentation-only changes, review prose and links rather than running appli
- Keep HTTP parsing and responses outside domains. Agree on the design before adding product models, permissions, deployment choices, or product API routes.
- Follow [database conventions](docs/database.md) for Prisma models, migrations, and the shared client, and [authentication](docs/authentication.md) for identity and access boundaries.
- Keep `HubThemeProvider` around application and Storybook content so portals inherit Brand and `--hub-*` tokens. Do not fix overlays to the light theme.
- Keep product copy independent of mock data. Mock-only controls and diagnostics belong in the bottom-right test toolbar; [the frontend guide](docs/frontend.md) owns fixtures and resets.
- Keep sample data and UI callbacks in Storybook. Use tests against the application and API contracts for routing, permissions, and persistence.
- Follow [Storybook requirements](docs/storybook.md#ui-changes-and-pull-request-evidence) for visual changes and PR screenshots, and [telemetry](docs/telemetry.md) for explicit spans and safe attributes.
- Use the [root browser workflow](../AGENTS.md#browser-validation-and-playwright-fallback) and [browser validation workflow](../starter/.agents/skills/browser-canvas-validation/WORKFLOW.md) for rendered checks.
4 changes: 2 additions & 2 deletions hub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Hub is being rebuilt on `build/hub/new` using TypeScript, Express, React, Vite, and Vitest. This branch lets contributors start the new app locally. It is not ready to replace the existing Hub.

Signed-in members can browse repositories, preview Builds and templates, create a prototype brief, and review a saved Build. React Router uses the Express API and PostgreSQL in real mode, and local fixtures only in mock mode.
Signed-in members can browse repositories, preview Builds and templates, create a prototype brief, and review a saved Build. Hub uses the Express API and PostgreSQL. [Storybook](docs/storybook.md) renders pages with sample data without the API.

Contributors can use PostgreSQL and Prisma locally or in the devcontainer. The backend provides:

Expand All @@ -15,6 +15,6 @@ Hub builds local branches from committed checkouts or [imports Builds from GitHu

The [production runtime](docs/deployment.md) packages the frontend, API, and workers in one image, with a separate release setup script.

Use [Development](docs/development.md) to start the API and frontend, and [Routed frontend](docs/frontend.md) for connected routes, local modes, and the division between UI and backend work. Review [Architecture](docs/architecture.md), [code architecture conventions](docs/backend-architecture.md), and [coding conventions](docs/coding-conventions.md) before adding behavior.
Use [Development](docs/development.md) to start the API and frontend, and [Routed frontend](docs/frontend.md) for connected routes and the division between UI and backend work. Review [Architecture](docs/architecture.md), [code architecture conventions](docs/backend-architecture.md), and [coding conventions](docs/coding-conventions.md) before adding behavior.

The prototype extension and build action consume shared canvas and Controls source under [client/](client/). They remain separate projects.
101 changes: 0 additions & 101 deletions hub/client/application/hub/bootstrap-hub-api/index.test.ts

This file was deleted.

15 changes: 0 additions & 15 deletions hub/client/application/hub/bootstrap-hub-api/index.ts

This file was deleted.

28 changes: 0 additions & 28 deletions hub/client/application/hub/contracts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,10 @@ const httpUrl = z.url({ protocol: /^https?$/ })
const timestamp = z.iso.datetime({ offset: true })
const buildStateSchema = z.enum(["failed", "queued", "running", "successful", "superseded"])

// Keep numeric mock IDs while accepting UUIDs from the API.
export const recordIdentifierSchema = z
.string()
.regex(/^(?:[1-9]\d*|[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})$/i)

export const routeIdentifierSchema = z
.string()
.regex(/^[1-9]\d*$/)
.transform(Number)
.pipe(identifier)

export const userSchema = z.object({
id: z.string().min(1),
login: z.string().min(1),
Expand Down Expand Up @@ -107,12 +100,6 @@ export const workspaceResponseSchema = z.object({
publicSharingSettingsAvailable: z.boolean().optional(),
capabilities: workspaceCapabilitiesSchema.optional(),
welcomeHidden: z.boolean().optional(),
navigation: z
.object({
welcomeHidden: z.boolean(),
notificationsUnreadCount: z.number().int().nonnegative(),
})
.optional(),
})

export const repositoryResponseSchema = z.object({
Expand Down Expand Up @@ -151,21 +138,6 @@ export const authorResultsSchema = z.object({
nextCursor: z.string().nullable(),
})

export const prototypeDetailsSchema = z
.object({
name: z
.string()
.trim()
.min(1, "Enter a prototype name.")
.max(120, "Use at most 120 characters for the prototype name."),
description: z
.string()
.trim()
.max(4000, "Use at most 4,000 characters for the description.")
.nullable(),
})
.strict()

const metadataSpace = /^[\s\u0085]$/u

function trimMetadata(value: string) {
Expand Down
2 changes: 0 additions & 2 deletions hub/client/application/hub/contracts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type {
buildHistoryResponseSchema,
buildSchema,
paginationSchema,
prototypeDetailsSchema,
prototypeEditSchema,
prototypeQuerySchema,
prototypeResponseSchema,
Expand All @@ -27,7 +26,6 @@ export type RepositoryResponse = z.infer<typeof repositoryResponseSchema>
export type PrototypeResponse = z.infer<typeof prototypeResponseSchema>
export type BuildHistoryResponse = z.infer<typeof buildHistoryResponseSchema>
export type AuthorResults = z.infer<typeof authorResultsSchema>
export type PrototypeDetails = z.infer<typeof prototypeDetailsSchema>
export type PrototypeEdit = z.infer<typeof prototypeEditSchema>
export type RouteQuery = z.infer<typeof routeQuerySchema>
export type PrototypeQuery = z.infer<typeof prototypeQuerySchema>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
import { act, fireEvent, renderHook, screen, waitFor, within } from "@testing-library/react"
import { http, HttpResponse } from "msw"
import { setupServer } from "msw/node"
import { act, renderHook, waitFor } from "@testing-library/react"
import { describe, expect, it, vi } from "vitest"

import { useReviewComments } from "@hooks/use-review-comments"
import type { ReviewComment } from "@utils/review-comment/types"

import { createMockHandlers } from "../mocks/create-mock-handlers"
import { createMockStore } from "../mocks/create-mock-store"
import { renderHubFlow } from "../routes/fixtures/render-hub-flow"
import { createReviewTransport } from "./"

describe("createReviewTransport()", () => {
it.each([403, 503])(
"removes previously loaded comments when a mutation loses review access with HTTP %i",
async (status) => {
vi.stubEnv("MODE", "development")
const path = "/api/repositories/2001/prototypes/1/review-comments"
const comment: ReviewComment = {
id: 2,
Expand Down Expand Up @@ -62,7 +56,6 @@ describe("createReviewTransport()", () => {
)

it("clears a loaded collection when refreshing review access returns HTTP 503", async () => {
vi.stubEnv("MODE", "development")
const path = "/api/repositories/2001/prototypes/1/review-comments"
const comment: ReviewComment = {
id: 2,
Expand Down Expand Up @@ -97,49 +90,4 @@ describe("createReviewTransport()", () => {
expect(result.current.comments).toEqual([])
expect(result.current.loading).toBe(false)
})

it.each([422, 500])(
"keeps the conversation and reply draft available after an ordinary HTTP %i failure",
async (status) => {
const store = createMockStore({ origin: window.location.origin })
const server = setupServer(...createMockHandlers(store))
const router = await renderHubFlow(
server,
"/repositories/2001/prototypes/1?build=3&comment=1",
)
const conversation = await screen.findByRole("dialog", { name: "Conversation" })
const savedReply = within(conversation).getByText("I will try a shorter heading.")
const reply = within(conversation).getByRole("textbox", { name: "Reply" })
fireEvent.change(reply, { target: { value: "Keep this unsaved review draft." } })
const rejectReply = vi.fn(() =>
HttpResponse.json({ error: "The reply could not be saved." }, { status }),
)
server.use(
http.post(
`${store.origin}/api/repositories/2001/prototypes/1/review-comments/1/replies`,
rejectReply,
),
)

await router.settle(() =>
fireEvent.click(within(conversation).getByRole("button", { name: "Reply" })),
)

expect(rejectReply).toHaveBeenCalledOnce()
expect(within(conversation).getByRole("alert")).toBeVisible()
expect(savedReply).toBeVisible()
expect(reply).toHaveValue("Keep this unsaved review draft.")
expect(within(conversation).getByRole("button", { name: "Reply" })).toBeEnabled()

server.resetHandlers()
await router.settle(() =>
fireEvent.click(within(conversation).getByRole("button", { name: "Reply" })),
)

expect(within(conversation).getByText("Keep this unsaved review draft.")).toBeVisible()
expect(reply).toHaveValue("")
expect(within(conversation).queryByRole("alert")).not.toBeInTheDocument()
},
15_000,
)
})
14 changes: 0 additions & 14 deletions hub/client/application/hub/development-tools/index.tsx

This file was deleted.

Loading
Loading