~ knotless Search/
↑↓ move↵ open⇧↵ all results

grain.social/grain

photography-focused photo sharing platform

grain.social
1 collaborator
0
2

next/ and ios/: the next grain.social and the iOS app, drawn by HUD

Merged
Merged chadtmiller.com asked to merge into feature/hud from grain.social/grain:hud/move-in

What changes

The next grain.social and the iOS app move in. next/ is the web shell that has lived in HUD's app/: a Vite and Svelte page with no server of its own, drawing next/grain.social.json's tabs, each a nav stack of tool calls to a HUD server over /mcp, /oauth, /xrpc, /blob and /icon. ios/ is HUD's app/ios, the same app drawn by HUDKit, made the next version of grain-ios: bundle id ${BUNDLE_ID} (grain-ios's social.grain.grain by default, as its justfile and ci_scripts set it), team ${APPLE_TEAM_ID}, marketing version 10 (grain-ios is at 9), build 60, and an Xcode Cloud ci_scripts/ci_post_clone.sh that generates the project. Its default server is https://next.grain.social.

HUD is vendored. vendor/hud is a copy of what both build from out of HUD's repository at b64cb1e7fc (vendor/hud/COMMIT): web/renderer/src and its package.json, web/shared, and ios/HUDKit. just vendor-hud <commit> (vendor/hud.sh) replaces it from knotless://chadtmiller.com/hud. HUD's server is not here. vendor/svelte.config.js and vendor/tsconfig.json have the renderer compiled as next/ compiles it, rather than under grain's SvelteKit config at the root.

The renderer's packages resolve from next/node_modules. leaflet and protomaps-leaflet (and @types/leaflet) are in next/package.json, and resolve.dedupe sends the renderer's imports of them and of svelte there, so npm ci in next/ is the one install.

Recipes and the check. just next <HUD url>, just next-build, just ios, just vendor-hud <commit>. The next check (.knotless/workflows/next.yml) runs svelte-check and vite build on pulls into main and feature/* touching next/, vendor/ or itself. AGENTS.md says what each part is and how to move the copy. The root's vp lint and fmt leave next/ and vendor/ alone, and fmt leaves ios/'s asset catalogs to Xcode, and .dockerignore keeps them out of grain-serve's image.

next.grain.social deploys from feature/hud. .knotless/workflows/next-deploy.yml runs on ci.knotless.dev alone, on pushes to feature/hud touching next/, vendor/hud, or itself: it builds next/ and deploy/next-deploy.sh sends next/dist to grain's box, where grain-next-deploy (hetzner-infra's services/grain-next) swaps it in. Its key, GRAIN_NEXT_DEPLOY_KEY, is sealed to that runner and ref, and the box takes it only for that forced command. The HUD server behind it, hud-next, is deployed from hetzner-infra. Pulls never run it.

Why

The HUD-drawn Grain becomes the next grain.social and the next grain-ios, so it lives in grain. HUD's repository is private and the runners give a step no way to read it (the runner's checkout does not fetch submodules, and a pull's run gets no credentials), so a submodule could not be built by the check; a copy at a named commit can, and moving it is one recipe.

How it was checked

On this Mac: cd next && npm ci && npm run check && npm run build (svelte-check: 395 files, 0 errors, 0 warnings; vite build passes), from a fresh node_modules and with no install at the root. just ios then xcodebuild -scheme Grain for the iOS simulator: BUILD SUCCEEDED, the app social.grain.grain 10 (60) with grain.social.json bundled; not installed on the simulator. vendor/hud.sh b64cb1e7fc wrote the copy. The next check passes on the runner, as do the rest.

Shortcomings

  • No check builds ios/: the runners are Linux. Build it on a Mac before a pull that touches it.
  • The app has none of grain-ios's entitlements (push, associated domains), and installing it replaces grain-ios's app on a simulator or device; BUNDLE_ID=social.grain.next just ios installs beside it. Xcode Cloud has not been pointed at ios/.
  • next.grain.social is not up yet, so the app's default server answers nothing until it is.
  • next-deploy.yml has not run yet: it first runs on the push to feature/hud this merge makes.
  • Grain's views are still the ones bundled in HUD's server.

Review

Start at next/vite.config.ts and vendor/hud.sh; everything under vendor/hud is HUD's, copied as it is.

Approved

This pull adds next/ (a Vite and Svelte shell over HUD's renderer), ios/, and a vendored copy of HUD at a named commit. It also adds vendor/hud.sh and a next check.

I read the files the pull's body points to: next/vite.config.ts, vendor/hud.sh and .knotless/workflows/next.yml. I did not read the rest of the diff: vendor/hud is HUD's code copied as it is, and I did not open ios/ or the other next/ files.

  • vite.config.ts: The aliases and resolve.dedupe do what the comments say. dedupe makes the vendored renderer's svelte, leaflet and protomaps-leaflet imports resolve from next/node_modules. server.fs.allow covers the repository root, so the dev server can serve vendor/.
  • hud.sh: set -euo pipefail is on and the commit is resolved to a full sha before anything is deleted. The old copy is removed only after the clone succeeds, and README.md is kept. The script wipes everything else in vendor/hud, so a file HUD removed goes too.
  • next.yml: The path filter covers next/**, vendor/** and the workflow file itself. The cache and the npm-ci step are keyed to next/.

The next check is untested in CI, as the body says, and the iOS build runs only on a Mac. Both are stated openly, so I'm not asking for changes.

Approved

Since my approval at 80889bf, the only change is in the root vite.config.ts. fmt now also ignores ios/**/*.xcassets/**, so the formatter leaves Xcode's asset-catalog JSON alone. The change is small, matches the body's description, and doesn't affect what I approved earlier.

Approved

Since my approval at c79d9c4, the pull adds .knotless/workflows/next-deploy.yml, deploy/next-deploy.sh and a paragraph in AGENTS.md.

  • Deploy workflow: It runs only on pushes to feature/hud, on ci.knotless.dev alone, and the key is sealed to that runner and ref. A pull's run never gets the secret. The path filter and the superseded: finish setting match what the comments say.
  • next-deploy.sh: It has set -eu and refuses to run without next/dist/index.html. The key goes to a mktemp file with mode 600, removed by a trap. The script streams the tarball over ssh to the forced command grain-next-deploy <sha>.
  • Host key: StrictHostKeyChecking=accept-new trusts the box's host key on first connect. On a fresh runner that is trust-on-first-use. The host is a fixed IP and the key's forced command limits what it can do, so I don't think this needs to change. Pinning the host key later would be tighter.

It is untested until the first push, as the body says. I'm not asking for changes.

On the host key: left as accept-new for now, as the forced command bounds what the key can do. Pinning the box's key in next-deploy.yml (a known_hosts line, as the ssh-key step takes) is the tighter follow-on, best done once hetzner-infra's grain-next has settled.

Merged as 1fc3bbb
Part of a stack of 2
  1. next/ and ios/: the next grain.social and the iOS app, drawn by HUD Landed as 1fc3bbb
  2. main