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
24 changes: 24 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.git
**/.git
**/.env
**/.env.*
!**/.env.example
.pnpm-store
crates
**/node_modules
**/.next
**/dist
**/test-results
**/.turbo
apps/desktop
apps/mobile
apps/browser-native
apps/chat
apps/commonplace-collab
apps/theorem-vscode
apps/commonplace-api
.theorem
.full-stack-feature
.playwright-mcp
plans
docs
25 changes: 25 additions & 0 deletions apps/console/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# CommonPlace console for Fly. Build context is the CommonPlace repo root.
FROM node:22-bookworm

WORKDIR /app
ENV NEXT_TELEMETRY_DISABLED=1
ENV PORT=8080

RUN corepack enable

COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
COPY apps/console ./apps/console
COPY packages ./packages
COPY .commonplace-canonical .commonplace-canonical

# NEXT_PUBLIC_* is inlined at `next build`. Runtime Fly secrets do not reach this step.
ARG NEXT_PUBLIC_CONSOLE_CHAT_URL=/api/chat/stream
ARG NEXT_PUBLIC_THEOREM_GATEWAY_URL=
ENV NEXT_PUBLIC_CONSOLE_CHAT_URL=$NEXT_PUBLIC_CONSOLE_CHAT_URL
ENV NEXT_PUBLIC_THEOREM_GATEWAY_URL=$NEXT_PUBLIC_THEOREM_GATEWAY_URL
Comment on lines +17 to +19

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Supply the gateway URL during the Fly build

For images built from the checked-in Fly configuration, this argument remains empty because [build.args] supplies only NEXT_PUBLIC_CONSOLE_CHAT_URL. Since this public variable is inlined during next build, runtime secrets cannot repair it: program runs that return only a recording_id open prototype.stage without a gateway base, and the stage renders its named unavailable state instead of loading the recording. Provide NEXT_PUBLIC_THEOREM_GATEWAY_URL in fly.console.toml or a usable build-time default.

Useful? React with 👍 / 👎.


RUN pnpm install --no-frozen-lockfile --filter @commonplace/console... \
&& pnpm --filter @commonplace/console run build:railway

EXPOSE 8080
CMD ["node", "apps/console/scripts/start-railway.mjs"]
14 changes: 8 additions & 6 deletions apps/console/src/views/RecordTableView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,15 @@ export function RecordTableView({ set: initialSet, host, instance }: ViewRenderP
setCellFocus((current) => (current ? { ...current, mode: 'soft' } : current));
return;
}
const note = receipt.value?.note ?? '';
const receiptValue = receipt.value as
| { note?: string; code?: string; refusal?: { code?: string } }
| undefined;
const note = receiptValue?.note ?? '';
const code =
typeof receipt.value?.code === 'string'
? receipt.value.code
: typeof (receipt.value as { refusal?: { code?: string } } | undefined)?.refusal
?.code === 'string'
? (receipt.value as { refusal: { code: string } }).refusal.code
typeof receiptValue?.code === 'string'
? receiptValue.code
: typeof receiptValue?.refusal?.code === 'string'
? receiptValue.refusal.code
: null;
if (code || /reject|enforcement|refused|validated|put_item_validated/i.test(note)) {
setSchemaRowProperty(rowId, fieldKey, previous);
Expand Down
2 changes: 1 addition & 1 deletion apps/console/src/views/model/ModelView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ export function ModelView({ set, host }: ViewRenderProps) {
if (ghost) void applyPin(ghost.observedKey, 'type');
},
declareDisabled: proposalBusy || observed.types.length === 0,
onSpawnObject: (position) => {
onSpawnObject: (position: { x: number; y: number }) => {
void spawnObject(position);
},
onCompareVersion: (id: string) => {
Expand Down
42 changes: 42 additions & 0 deletions fly.console.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# CommonPlace product console. Public hostname is apps.theoremweb.com
# (apex theoremweb.com stays on Vercel / Theseus).
#
# Deploy from the CommonPlace repo root:
# fly deploy --config fly.console.toml --app travis-commonplace-console
app = "travis-commonplace-console"
primary_region = "iad"
kill_signal = "SIGTERM"
kill_timeout = "30s"

[build]
dockerfile = "apps/console/Dockerfile"

[build.args]
NEXT_PUBLIC_CONSOLE_CHAT_URL = "/api/chat/stream"

[env]
PORT = "8080"
HOSTNAME = "0.0.0.0"
AUTH_TRUST_HOST = "true"
AUTH_URL = "https://apps.theoremweb.com"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep the Console on its canonical host

When this Fly configuration is deployed, AUTH_URL makes apps.theoremweb.com an independently authenticated product origin even though the Console constitution fixes v2.theoremharness.com as the canonical host and Railway as its deployment path. This creates a second production deployment that can drift in code, secrets, sessions, and OAuth configuration; keep the Fly hostname as a redirect/alias to the canonical deployment rather than hosting another Console instance.

AGENTS.md reference: apps/console/AGENTS.md:L18-L22

Useful? React with 👍 / 👎.

Comment on lines +17 to +21

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Point the deployment doctor at the Fly origin

In the Fly environment, neither DOCTOR_PUBLIC_BASE_URL nor Railway's RAILWAY_PUBLIC_DOMAIN is set, so /api/doctor falls through to its hard-coded https://v2.theoremharness.com base. Consequently, invoking the doctor on apps.theoremweb.com probes the separate Railway deployment and can report healthy routes even when this Fly instance is broken. Set DOCTOR_PUBLIC_BASE_URL to the Fly hostname in this environment block.

Useful? React with 👍 / 👎.

Comment on lines +17 to +21

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Inject revision metadata for the Fly deployment

The GET handler in src/app/api/version/route.ts identifies code solely from RAILWAY_GIT_COMMIT_SHA or GITHUB_SHA, but this Fly environment supplies neither value and the Docker context excludes .git. As a result, /api/version returns git.sha: null for this deployment, defeating the endpoint's purpose of distinguishing a current image from a stale one. Pass the deployed revision into one of the names the handler reads, or extend the handler and config with explicit Fly revision metadata.

Useful? React with 👍 / 👎.


[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = "off"
auto_start_machines = true
min_machines_running = 1
processes = ["app"]

[[http_service.checks]]
grace_period = "1m"
interval = "15s"
method = "GET"
path = "/api/healthz"
protocol = "http"
timeout = "10s"

[[vm]]
size = "shared-cpu-2x"
memory = "2gb"
processes = ["app"]
Loading