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

grain.social/grain

photography-focused photo sharing platform

grain.social
1 collaborator
0
2

HUD 0.2.0's packages from its registries in place of vendor/hud

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

What changes

Grain stops copying HUD's source into vendor/hud and takes HUD 0.2.0's published packages from HUD's registries on knotless (knotless://chadtmiller.com/hud, its docs/sdk.md). Reading them needs no login. vendor/hud/, vendor/hud.sh and just vendor-hud are gone, so a pull no longer conflicts on vendor/hud/COMMIT.

next/: @hud/renderer, @hud/shell and @hud/shared ^0.2.0 are devDependencies, from @hud:registry=… in next/.npmrc (the lock pins 0.2.0 at knotless.dev). The vendor/hud/web aliases, tsconfig paths, dedupes and fs.allow go, and so do leaflet, protomaps-leaflet, esm-env and @types/leaflet, which were listed only for the renderer's source and now come with @hud/renderer. Every import stays as it was (@hud/shell, @hud/shell/server, @hud/shared/result, the two stylesheets).

ios/: XcodeGen can't name a registry package, so ios/HUD is a small local package that depends on .package(id: "hud.HUDKit", exact: "0.2.0"), and project.yml takes it by path. Xcode reads registries only from the project's workspace, not from a local package's .swiftpm, so project.yml's postGenCommand copies ios/HUD/.swiftpm/configuration/registries.json and the committed pins, ios/Package.resolved, into Grain.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/. Xcode Cloud resolves only from committed pins, which is why the pins are committed, as grain-ios does. ci_post_clone.sh gets this through xcodegen generate.

android/: place.hud:hudkit:0.2.0 comes from HUD's Maven registry (settings.gradle.kts, includeGroup("place.hud")). The app has its own gradle/libs.versions.toml (HUD 0.2.0's versions for what the app itself names, plus hud = "0.2.0"). The :hudkit include, HUD's catalog, -Phudkit, hudVersion and the root MapLibre substitution go: hudkit's Gradle metadata already excludes org.maplibre.gl:android-sdk and brings android-sdk-opengl, and the release runtime classpath has no Vulkan android-sdk.

CI and deploy: the next check builds hud for hud check from HUD's public repo at the tag of the app file's version ("hud": ">=0.2.0" → refs/tags/v0.2.0), cached in /opt/hud keyed by that tag. next-image, next-deploy and deploy/next-deploy.sh send and build next/ alone, and next/Dockerfile copies next/.npmrc before the npm ci it already ran, which now fetches HUD's packages from knotless.dev. vendor/** drops out of the workflows' paths.

Version bumps: just hud-version <x.y.z> moves the three places together, next's packages (and lock), ios/HUD/Package.swift with ios/Package.resolved, and android's catalog hud, plus the app file's hud, which is what the next check builds. AGENTS.md and the iOS and Android READMEs say this.

Why

Every pull that moved vendor/hud conflicted on vendor/hud/COMMIT, and the copy was 390 files of someone else's source. HUD now publishes one version of all three kits, so Grain takes a version as it takes any other dependency.

How it was checked

  • Same source: the vendored commit (5addfcf) and v0.2.0 (51ffab3) have no difference under web/renderer, web/shell, web/shared, ios/HUDKit, android/hudkit or HUD's catalog (git diff --stat). The registry's HUDKit 0.2.0 archive matches vendor/hud/ios/HUDKit file for file.
  • next/: npm ci, npm run check (0 errors, 0 warnings, 334 files), npm run build. I ran the build before and after with node build, both against HUD_INTERNAL_URL=https://next.grain.social (read-only, signed out), and compared the server-rendered HTML of /, /profile/manton.org/gallery/3n2w7bb54mtpk and /profile/did:plc:ypx5shor4ojgky27ncur6aei/story/3n2w7obmiid2o. Once Svelte's class hashes and the hashed asset names are normalized, the only differences are the build version, SvelteKit's __sveltekit_<hash> global and two <svelte:head> hydration markers, all build-derived. The client output is 1556 KB before and 1560 KB after, with 30 chunks each.
  • iOS: just ios, then xcodebuild -scheme Grain -destination 'generic/platform=iOS Simulator' build (BUILD SUCCEEDED, hud.HUDKit @ 0.2.0 resolved from the registry), and a Release build for generic/platform=iOS with CODE_SIGNING_ALLOWED=NO (BUILD SUCCEEDED). I checked a fresh fetch with an empty cache: it warns only that the archive is unsigned. There is no just ios-release.
  • Android: ./gradlew :app:assembleDebug :app:assembleRelease (both APKs built, the release one unsigned locally).
  • just hud-version 0.2.0 leaves the tree as it is. Its patterns move each of the four files when given another version. A version not on the registry fails at npm install, before anything else changes.
  • Left to CI: next (the tag fetch and the first hud build at v0.2.0), next-image (the kaniko build, with npm ci against knotless.dev), android.

Shortcomings

  • The registry's archives aren't signed, so SwiftPM warns on every fresh fetch. A machine that once resolved hud.HUDKit 0.2.0 from another registry fails on the checksum. This one had a fingerprint left by a local test registry (http://127.0.0.1:8931); I moved it to /tmp/spm-stale-backup.
  • Trying an unreleased HUDKit or hudkit now means publishing it locally (publishToMavenLocal, or a local Swift registry) or a version bump. -Phudkit=<checkout> is gone.
  • The next check's first run after this rebuilds hud (its cache was keyed by commit).
  • Deploy order: hetzner-infra's pull at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/hetzner-infra/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.pull/3n2wayqumlz6f first. The box's installed grain-next-deploy already builds whatever tar it gets, so next-deploy works with this as it stands. That pull fixes up.sh (by hand), which archived vendor/hud and would fail on a grain without it, and it updates the notes.
Approved

This pull replaces vendor/hud with HUD 0.2.0's published packages (npm for next/, a Swift registry through the local ios/HUD package, and Maven for android/). I found nothing that must change.

I read every non-vendor file in the diff. The 390 vendor/** files are pure deletions, and I did not read them. I did not build any of this myself.

  • next/:
    • .npmrc sits next to the lock file and Dockerfile, and the Dockerfile copies it before npm ci.
    • The lock pins 0.2.0 with integrity hashes.
    • The removed aliases, tsconfig paths and fs.allow match what the packages now provide, and esm-env, leaflet and protomaps-leaflet come in transitively.
  • CI and deploy:
    • next.yml derives the tag from the app file's hud field and caches by tag, in a new VERSION file in /opt/hud.
    • The fetch is of refs/tags/$tag. The first run on this pull rebuilds hud, as the body says.
    • The vendor/** path filters and the git archive and image context lines are consistent with each other.
  • ios/: postGenCommand runs after generation and copies the registry file and the pins into the workspace, which is what Xcode Cloud needs.
  • android/:
    • The Maven registry is limited to the place.hud group.
    • The app's catalog is trimmed to the entries the app uses.
    • The MapLibre substitution is dropped on the strength of hudkit's published metadata. Your release-classpath check backs that up.
  • just hud-version: the sed patterns touch each of the four files and leave the tree unchanged at 0.2.0, as you describe.

The body already lists the unsigned-archive warning, the checksum failure on a machine with a stale fingerprint, and the deploy ordering with hetzner-infra. The next, next-image and android checks are the remaining verification, and they run on the pull.

Approved

I read what changed since my approval at da3a7e4. It is cleanup that follows from vendor/ being gone. It drops vendor from .dockerignore and from the vite.config.ts lint and fmt ignore lists. It also reformats ios/HUD/.swiftpm/configuration/registries.json, with the same registry URL and the same content. None of this breaks what I approved.

Merged as 3e7bd6e
Part of a stack of 2
  1. HUD 0.2.0's packages from its registries in place of vendor/hud Landed as 3e7bd6e
  2. main