Skip to content

fix(cli): bind launchctl status string to a let so the macOS build compiles (E0716)#6203

Merged
houko merged 3 commits into
mainfrom
fix/6198-macos-cli-e0716
Jun 19, 2026
Merged

fix(cli): bind launchctl status string to a let so the macOS build compiles (E0716)#6203
houko merged 3 commits into
mainfrom
fix/6198-macos-cli-e0716

Conversation

@houko

@houko houko commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #6198main is red. The macOS Test lane fails to compile librefang-cli with two E0716 errors (temporary value dropped while borrowed) at crates/librefang-cli/src/commands/maintenance.rs:402 and :404.

This is not actually caused by the dependabot dashboard bump (#6183); the macOS lane is main-push-only, so a latent macOS-only borrow error only surfaced once that PR merged.

Root cause

// #[cfg(target_os = "macos")] block
ui::kv(
    &i18n::t("maintenance-status-label-loaded"),
    if running {
        &i18n::t("label-yes")          // String temporary, &'d here
    } else {
        &i18n::t("label-not-loaded")   // String temporary, &'d here
    },                                  // <- temporaries freed at end of the if-expression
);                                      //    but ui::kv borrows them -> E0716

i18n::t(&str) -> String, so each arm produces an owned String whose temporary is dropped at the end of the if-expression, before ui::kv uses the borrow.

Fix

Bind the chosen string to a let so it outlives the call (the resolution rustc itself suggests):

let loaded_status = if running {
    i18n::t("label-yes")
} else {
    i18n::t("label-not-loaded")
};
ui::kv(&i18n::t("maintenance-status-label-loaded"), &loaded_status);

Verification

The block is #[cfg(target_os = "macos")], so the Linux dev container does not compile it — this PR's macOS CI lane is the verifier. Type-checked by hand: i18n::t -> String, ui::kv(&str, &str); both arms yield String, &loaded_status lives through the call. A repo-wide scan confirms this is the only &i18n::t(...) used inside an if/match arm; every other occurrence is a direct call argument (temporary extended to end of statement, safe).

…mpiles

The macOS-only launchagent-status block passed `&i18n::t(...)` from inside an if/else expression to ui::kv, but each arm's i18n::t returns an owned String whose temporary is freed at the end of the if-expression, before ui::kv borrows it — a use-after-free the borrow checker rejects with E0716.
The macOS test lane is main-push-only, so this only turned main red after merge instead of failing the originating dependabot PR.
Bind the chosen string to a let so it outlives the ui::kv call.

Closes #6198
@github-actions github-actions Bot added area/docs Documentation and guides size/S 10-49 lines changed labels Jun 18, 2026
@github-actions github-actions Bot added the has-conflicts PR has merge conflicts that need resolution label Jun 18, 2026
# Conflicts:
#	.secrets.baseline
@houko
houko enabled auto-merge (squash) June 19, 2026 04:43
@github-actions github-actions Bot added ready-for-review PR is ready for maintainer review and removed has-conflicts PR has merge conflicts that need resolution labels Jun 19, 2026
@houko
houko merged commit 18a897b into main Jun 19, 2026
31 checks passed
@houko
houko deleted the fix/6198-macos-cli-e0716 branch June 19, 2026 05:31
GQAdonis pushed a commit to GQAdonis/librefang that referenced this pull request Jun 19, 2026
Merge upstream/main into the BossFang fork; origin/main was 15 commits behind.

Notable upstream changes:
- librefang#6225 scope the compaction-summary banner to the compacted session (adds canonical_sessions.compacted_summary_session_id).
- librefang#6196 deny WASM fs_write to the audit anchor via a capability deny-list.
- librefang#6226 / librefang#6227 add agent label and exit-reason metrics to the agent loop.
- librefang#6215 context-window usage indicator + honest quota-error classification.
- librefang#6217 per-instance sidecar secrets so each agent owns its own handle.
- librefang#6194 global Auto-Dream on/off switch on the Memory tab.
- librefang#6211 / librefang#6214 / librefang#6212 token/context cap fixes; librefang#6208 refuse to delete the active prompt version.
- librefang#6218 browser_tools.rs ToolError migration; librefang#6203 launchctl let-binding build fix; librefang#6224 docs dep bumps; librefang#6193 drop five orphaned email deps.

Conflict resolution:
- deny.toml: keep our RUSTSEC-2025-0141 (bincode 2.0.x) ignore entry (take ours).
- deny.toml: ignore three pre-existing unmaintained advisories newly tripped by the RustSec DB (all transitive via the UAR provider chain, none introduced by this merge): RUSTSEC-2024-0384 (instant), RUSTSEC-2024-0436 (paste), RUSTSEC-2025-0119 (number_prefix).

BossFang preservation (SurrealDB schema parity for upstream SQLite v46 / librefang#6225):
- Add crates/librefang-storage/src/migrations/sql/032_canonical_sessions_compacted_summary_session_id.surql declaring the new field on the SCHEMAFULL canonical_sessions table (SCHEMAFULL silently drops undefined fields on write), registered as version 32 in migrations/mod.rs.
- migrate/sqlite_to_surreal.rs: copy the new column so a SQLite to SurrealDB migration preserves the owning-session pointer rather than dropping it.
- backends/surreal_session.rs: preserve compacted_summary_session_id across canonical appends, since the upsert replaces the whole record.
- Cargo.lock: pick up the workspace version bump (beta.19 to beta.20) the merge introduced.

Verification:
- cargo check --workspace --lib — clean.
- cargo check -p librefang-storage -p librefang-memory -p librefang-uar-spec — clean.
- cargo test -p librefang-storage migration — ok (migration ordering / SurrealDB-3 flexible-syntax invariants).
- cargo test -p librefang-memory --lib session — 50 passed (incl. upstream's store_llm_summary round-trip test).
- cargo clippy -p librefang-storage -p librefang-memory — clean.
- python3 scripts/enforce-branding.py --check — clean; Tauri desktop audit and URL-drift scan both clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation and guides ready-for-review PR is ready for maintainer review size/S 10-49 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[main red] CI failure on PR #6183

2 participants