fix/milestone-1-review-findings #24

Merged
nrupard merged 2 commits from fix/milestone-1-review-findings into main 2026-05-15 18:22:46 +02:00
Owner
No description provided.
Bundles the targeted fixes from the post-merge review of PRs #20/#21/#22/#23 (multi-arch build, runtime config injection, operator compose + public mirror, update banner).

PR A: setup-qemu-action now registers both amd64 and arm64 emulators so a future arm64 runner does not need a follow-up patch to build amd64.

PR B: entrypoint.sh wraps both the _mokosh_config.js write and the index.html inject in failure-tolerant guards so a read-only rootfs (operator running with `read_only: true`) still boots; the SPA falls back to compile-time defaults with a stderr warning. OidcConfig::for_current_origin() is now memoized in a thread-local cache so the up-to-three Box::leak allocations on resolution stay bounded at one set per session even though the function is called from five sites and re-runs each render. The Caddyfile @no-cache matcher now covers the bare `/` path, fixing the latent bug where the SPA root request picked up the immutable cache header because Caddy's path matcher evaluates the request URI before try_files rewrites it. The Caddyfile COPY pins --chmod=0644 to guard against host-umask drift (safe now that the explicit `mkdir --parents /etc/caddy` runs first, so BuildKit no longer propagates the file mode to the implicitly-created parent dir).

PR C: drops the second docker login that was clobbering the prior login's auth on the same registry host; the mirror step now reuses the existing private login. The PSA_SYSTEMS_PRIVATE_PACKAGE_PAT must hold write access to both the private and the public package owners - documented in env: comments. Compose example pins :latest with a note recommending a :vX.Y.Z pin for production, and drops the redundant PORT env (already set by the Dockerfile).

PR D: hooks (use_resource, use_signal) moved above the is_admin early return so the hook set per render stays stable when a user flips between admin and non-admin (tenant switch, late hydration). version_resource read switched from read_unchecked() to read() so the banner re-renders on the Loading -> Ready transition. SystemVersion serialisation strips a leading `v` from semver strings so an OCI tag (`v0.2.0`) from the server compares equal to the SPA's clean CARGO_PKG_VERSION (`0.2.0`); covered by three new tests in modules::system::tests. Dismiss button gains aria_label. SYSTEM_VERSION_PATH extracted as a const.

Smoke: cargo check + cargo test --lib modules::system clean. Docker build (amd64) produces a working image whose / and /index.html both serve no-cache, /_mokosh_config.js renders from MOKOSH_* env vars, and /assets/* keeps the immutable cache.
Signed-off-by: nrupard <natrsmith11@gmail.com>
fix(update-banner): gate version fetch on admin status
Some checks failed
Check / clippy + fmt + tests (pull_request) Failing after 3s
Create release / Create release from merged PR (pull_request) Has been skipped
1ef686c6c8
Addresses the review-of-review blocker. After moving hooks above the is_admin early return, the unconditional use_resource was firing GET /api/v1/system/version on every non-admin layout mount and burning a backend round-trip the user could not act on. The fix moves the admin check into the use_resource outer closure: the hook still runs unconditionally so per-render ordering stays stable, but the async body short-circuits with Err("not admin") before calling get_version() while the user is not an admin. Reading auth in the outer closure also keeps the resource reactive to auth flips (login, tenant switch).

Signed-off-by: nrupard <natrsmith11@gmail.com>
nrupard deleted branch fix/milestone-1-review-findings 2026-05-15 18:22:46 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-apps!24
No description provided.