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

grain.social/grain

photography-focused photo sharing platform

grain.social
1 collaborator
0
2

next: HUD's own hud check, the app's lexicons and its HUD version

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

What changes

HUD's own check in the next check. .knotless/workflows/next.yml runs HUD_WORKSPACE=off hud check next, the loader hud-next runs at startup. The hud binary is built from HUD's public repository at vendor/hud/COMMIT, kept in the cached /opt/hud, and built again only when that commit moves. Its Rust toolchain and build are deleted once the binary is copied out. HUD publishes no hud binary or image to download, so it has to be built. next/check-apps.mjs keeps only Grain's own rules that HUD doesn't check: grain-*.json names, app: "Grain", one view per method, footer and sign-in links, and the permission-set grants.

The app's own lexicons. next/lexicons/social/grain is a copy of lexicons/social/grain. HUD checks the views and push calls against it and serves them with it, in place of any Grain lexicon it bundles. check-apps.mjs fails when the copy differs from the root's by any file. The next check now also runs on pulls touching lexicons/social/grain.

The HUD it needs, and schemas. grain.social.json says "hud": ">=0.2.0". It and every view name HUD's JSON Schemas through $schema, at a35a6d8, the vendored commit, for editor completion. The main URL is a 404 until app/shell merges.

vendor/hud at 0ce953e, the newest HUD app/shell, after merging feature/hud (the Android app). It includes hud check, the version gate, ?key and app lexicons from df2008e and a35a6d8. The shell now imports @hud/shared/* from web/shared/src, so next/ aliases that in place of $shared.

Why

Twice today a HUD or views change took next.grain.social down: a view used a prop the running HUD lacked, and a HUD dropped a lexicon a live view named. Now the check runs HUD's real loader, so it can't drift from what hud-next refuses. The app ships the lexicons it is checked against, so a HUD release can't pull them out from under it. A committed copy plus a diff check is the boring option: hud check next and the deploy, which sends only next/ and vendor/hud/, both see it as is, with nothing to generate.

How it was checked

  • HUD_WORKSPACE=off hud check next with HUD a35a6d8 passes: "1 app and 17 views, as HUD 0.2.0 loads them".
  • A registerPush lexicon in next/lexicons changed to a query fails it, which shows HUD reads the app's lexicons.
  • I broke the app file several ways (pushes, pages, typeahead, services, domain) to see which rules hud check already covers. It covered all of them, so check-apps.mjs keeps only the rules it doesn't. Footer links, sign-in links and permission grants still pass hud check, so those stay in check-apps.mjs.
  • node check-apps.mjs passes, and fails on an added or changed lexicon file.
  • npm run check (0 errors, 0 warnings) and npm run build in next/ pass.
  • Fetching the hud source by commit from knotless.dev works.
  • The binary build in the runner is left to CI.

Shortcomings

  • The first run of next after a HUD commit moves builds hud from source (Rust and HUD's pages), which takes minutes. Later runs use /opt/hud.
  • Deploy order: hud-next must run a HUD that has a35a6d8 (0ce953e, as vendored) before this deploys. An older one refuses the app file's "hud" key, and the deploy rolls back (or, with the hetzner-infra change, refuses before swapping).
Approved

The pull adds HUD's own hud check next to the next check. The binary is built from the public HUD source at vendor/hud/COMMIT and cached in /opt/hud. It also commits a copy of the app's lexicons under next/lexicons, adds a hud version gate and $schema lines, and moves the vendor to a35a6d8 with the @hud/shared alias. I found nothing that must change.

  • Workflow: The rebuild runs only when the cached /opt/hud/COMMIT differs from vendor/hud/COMMIT. HUD_WORKSPACE=off /opt/hud/hud check next runs after the install.
  • Pull paths: Adding lexicons/social/grain/** to the pull paths is right, because the copy-versus-root diff in check-apps.mjs has to run when the root lexicons change.
  • check-apps.mjs: The rules it keeps are the ones you showed hud check doesn't cover. The file-for-file comparison catches missing, extra and differing files.
  • Aliases: The $shared to @hud/shared change is consistent across tsconfig.json, vite.config.ts and the sitemap import.

Two things to know, neither blocking:

  • The rustup installer is fetched unpinned from sh.rustup.rs. A pinned toolchain would make the first build after a commit move reproducible.
  • The 45-minute timeout and the first-run build are as you describe. The runner build itself is unverified, as your body says.

I did not read the 150 or so copied lexicon JSON files, the vendored HUD files (iOS, renderer, shell and shared sources), or the AGENTS.md and 16 other view-file diffs. The lexicon copies are what the diff check enforces, and the vendored files are generated by vendor/hud.sh. The view-file diffs match the one I read, which only adds a $schema line.

Approved

Since my approval at 79995425, the only change is a merge of feature/hud (the Android app) at 36972e8. That moves vendor/hud/COMMIT to 0ce953e, which the body says. The pull's own pieces are as I approved them: the hud check next workflow step, the next/lexicons copy with its diff check, the hud version gate and the $schema lines. The $schema URLs still name a35a6d8, an ancestor of the vendored commit.

The delta is almost all Android sources and regenerated vendored HUD files. It was too large to read whole, so I did not read it. I only confirmed from the log that the merge brings in the base's changes and the vendor bump, and nothing in the pull's own next/ files. The binary build in the runner is still untested, as before. The deploy-order note about hud-next needing HUD at 0ce953e or later still applies.

Pinned the runner's Rust to 1.98.0, the toolchain HUD's Dockerfile builds hud-next's image with, so the first build after a HUD commit moves is reproducible.

Approved

Since my approval at 36972e8, the only change is in .knotless/workflows/next.yml. The rustup install now passes --default-toolchain 1.98.0, which is the Rust version HUD's Dockerfile builds hud-next's image with. This answers the unpinned-toolchain note from my first review, and the first build after a HUD commit moves should now be reproducible. Nothing else changed, so what I approved stands. I couldn't check that 1.98.0 matches HUD's Dockerfile, and the runner build is still untested.

Approved

Since my approval at 6f93e05, two things changed. In next.yml, the hud step now starts with set -e, and it empties /opt/hud by removing the two files in it instead of removing the directory. That is right for a cache mount, and set -e makes a failed build stop the step. android/gradle.properties also gains hudVersion=0.2.0, which the vendored hudkit build reads. Neither change breaks what I approved. I did not build the binary in the runner.

Merged as 70987c5
Part of a stack of 2
  1. next: HUD's own hud check, the app's lexicons and its HUD version Landed as 70987c5
  2. main