Skip to content

fix: import AppContext for release-profile cx.new() in use_query_manual - #11

Open
hmziqagent wants to merge 1 commit into
freeoxide:masterfrom
hmziqagent:fix/appcontext-release
Open

fix: import AppContext for release-profile cx.new() in use_query_manual#11
hmziqagent wants to merge 1 commit into
freeoxide:masterfrom
hmziqagent:fix/appcontext-release

Conversation

@hmziqagent

Copy link
Copy Markdown
Contributor

Bug

No published version of gpui-query (0.1.4, 0.2.0) — nor current master — compiles in the release profile with the hook feature enabled:

error[E0599]: no method named `new` found for mutable reference `&mut gpui::Context<'_, C>`
  --> src/hook/query_hooks.rs:187:16
    |
187 |            cx.new(|_| QueryResource::new(key, cache_policy, request_policy))
    |               ^^^ method not found
help: trait `AppContext` which provides `new` is implemented but not in scope

use_query_manual's no-QueryClient fallback lives inside #[cfg(not(debug_assertions))] and calls cx.new() without importing gpui::AppContext. Dev builds never compile that branch — which is why every green dev/test run masked it. Anything downstream doing cargo build --release / cargo check --release fails inside this crate.

Fix

One cfg-gated import (unconditional would warn as unused in dev):

#[cfg(not(debug_assertions))]
use gpui::AppContext as _;

Found while repairing gpui-starter's CI (freeoxide/gpui-starter#4); that repo currently carries the same fix via a [patch.crates-io] git pin to a v0.1.4-based branch. Once this lands and ships in a release, the patch there can be dropped.

🤖 Generated with Claude Code

The #[cfg(not(debug_assertions))] fallback calls cx.new() without the
AppContext trait in scope, so the crate fails to compile in any release
build (cargo check/build --release). Dev builds never compile the branch,
which masked it. Published 0.1.4 and 0.2.0 both carry this — any app
taking gpui-query with the hook feature cannot build --release.
hmziqagent added a commit to hmziqagent/gpui-starter that referenced this pull request Aug 22, 2026
…lint drift

master CI has been red since 2026-07-21 (runs 29828508874, 30356195053):
every job died at workspace-manifest load because Cargo.toml pointed the
seven gpui-form* deps at absolute local paths (/Users/hmziq/fo/form/...),
which exist on no runner or other dev machine.

gpui-form -> git deps (no vendoring, no absolute paths)
- All seven crates from freeoxide/gpui-form @ 8a373a9 (one checkout).
  That repo pins the identical zed gpui (1d217ee) + gpui-component
  (e416af7) revs as this workspace -> single unified graph; resolves to
  0.5.2, the exact version master's Cargo.lock always carried. crates.io
  is not an option: only the older 0.5.1 architecture is published there
  and the -schema/-component*/-codegen crates were never published.

gpui-query release build (second blocker hiding behind the first)
- cargo check --release fails INSIDE published gpui-query 0.1.4 (also
  0.2.0 and upstream master): the release-only #[cfg(not(debug_assertions))]
  fallback in hook/query_hooks.rs calls cx.new() without importing
  gpui::AppContext. Dev builds never compile that branch, which masked
  it; no release build of this pinned graph had ever run. Patch to
  hmziqagent/gpui-query @ f84eac4 (v0.1.4 + the one-line cfg-gated
  import fix; PRred upstream as freeoxide/gpui-query#11 - drop the patch
  once a fixed release ships).
- scripts/toggle-gpui-query.sh: marker block now holds exactly one
  active line (default git rev <-> standalone Mac checkout); two active
  gpui-query keys would be a TOML duplicate-key error.

Clippy / fmt (audit-sweep drift, never validated by CI)
- #[allow(clippy::double_must_use)] on NotificationBackend - new nightly
  lint on #[async_trait]'s generated must_use wrappers.
- cargo fmt --all over 20 files of drift.

Release pipeline (ships broken artifacts; not exercised by CI runs)
- gen-pkgbuild.sh: bake the releasing repo into the PKGBUILD's
  ${REPO:-...} default. release.yml's REPO env was dead code (heredoc
  escaping), so fork-cut releases ship PKGBUILDs whose source URL 404s.
- gen-pkgbuild.sh package(): prefix paths with gpui-starter/ to match
  the tarball's nested layout (install hit the directory; lib/ silently
  skipped).

Validation (local, nightly 2026-08-16, mirrors every CI job): check /
check --release / clippy -- -D warnings / fmt --all --check /
test -p gpui-starter --lib (187 passed) - all green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant