fix(gateway): apply cargo fmt and ship ui/ dashboard in the gateway image - #1598
Conversation
main's Gateway (stable/beta/1.88) CI jobs have been failing the `cargo fmt -- --check` gate (lib/policy/src/cedar.rs, compiler.rs, lib.rs; lib/storage/src/db/decisions.rs, playbooks.rs, tenant.rs; tenant_bloom.rs; src/src/routes/policy.rs). Re-run cargo fmt --all with a real toolchain and commit the result — no behavioral changes.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
|
Warning Review limit reached
More reviews will be available in 39 minutes and 15 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughPure formatting refactor across Formatting Cleanup
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request consists entirely of code formatting and style adjustments across multiple files, likely generated by an automated formatter like cargo fmt. The changes include wrapping long lines, aligning function calls, and reordering imports and module declarations alphabetically. There are no functional changes or review comments, so no further feedback is required.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Dashboard E2E (Playwright) has been failing on main since at least 2026-06-24: every /dashboard/* request 404s because src/Dockerfile only ever built the Rust gateway binary — it never built or copied the ui/ frontend. serve_dashboard_index/serve_dashboard_static (src/src/routes/dashboard.rs) read a static-exported Next.js build from the relative path `ui/dist` at runtime (ui/next.config.ts sets `output: "export", distDir: "dist"` for exactly this), but that directory never existed in the image. Add a node:20-bookworm build stage that runs `npm ci && npm run build` inside ui/, and copy the resulting ui/dist into the final distroless image at /app/ui/dist (matching the gateway's WORKDIR /app and the relative path it reads from).
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
Semgrep (rust.lang.security.temp-dir.temp-dir) flags both call sites as insecure: std::env::temp_dir() is a shared, world-writable directory, and joining a predictable-ish filename onto it is an insecure-temp-file pattern even though the name includes a UUID. Switch to tempfile::Builder, which atomically creates a uniquely-named file with restricted permissions and removes it on drop, matching the existing tempfile::tempdir() idiom already used in src/src/policy_watcher.rs.
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
Summary
Four fixes for the long-standing CI breakage on
main(failing since at least 2026-06-24, worsened by #1596/#1597):cargo fmtdrift (Gateway stable/beta/1.88): pure formatting inlib/policy/src/{cedar.rs,compiler.rs,lib.rs},lib/storage/src/db/{decisions.rs,playbooks.rs,tenant.rs},lib/storage/src/tenant_bloom.rs,src/src/routes/policy.rs.src/Dockerfilenever built/copied theui/frontend, so/dashboard/*404'd. Added anode:20-bookwormbuild stage that runsnpm ci && npm run buildagainstui/(static-exported Next.js,next.config.ts→dist/) and copies the result into the final image at/app/ui/dist, matching whatserve_dashboard_index/serve_dashboard_staticread.rust.lang.security.temp-dir.temp-dir): cherry-picked an orphaned fix from an abandoned branch (the PR it was pushed to had already auto-merged before the commit landed) — swapsstd::env::temp_dir().join(predictable-name)fortempfile::Builderinlib/policy/src/compiler.rsandsrc/src/routes/policy.rs.require_approval/redactexpected, gotdeny): fix(gateway): repair fixture fallout from restored unknown-MCP-tool deny rule #1597's fixture-registration fix only covered tests routed throughcreate_pending_approval. Many other tests buildgithub/merge_pull_requestorsecrets/rotate_credentialrequests directly — registered both in the centralizedregister_default_test_fixtures()too.Bonus: addresses issue #900 (DB query timing instrumentation) — wrapped all 9
db::*query*macros inlib/storage/src/db/mod.rswith adb_querytracing span (sql + backend), the single funnel point for all ~170 query functions across the module, flowing into the existing OTel layer for per-query duration.I could not fully build/test this locally — this sandbox's Docker daemon and
cargo's network access to crates.io are both unreliable/timing out here — so this is verified by careful manual tracing (cargo fmt --check did run successfully locally) plus CI, which has real network.Test plan
cargo fmt --all -- --checkpasses locally.