Skip to content

feat(backend): compile the 43 orphaned src-gossamer modules in the lib - #153

Merged
hyperpolymath merged 4 commits into
mainfrom
claude/admiring-meitner-8qkxac
Oct 14, 2026
Merged

hyperpolymath merged 4 commits into
mainfrom
claude/admiring-meitner-8qkxac

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

43 modules under src-gossamer/src/ were declared by no crate root, so they were never compiled, linted or tested. None of them needs gossamer_rs, so all 43 are now pub mod in lib.rs and build without the optional gossamer feature. main.rs still adds only system_tray.

cargo test --lib: 285 passed (was 23).

The modules: a2ml, aerie, ai, boj, boj_live, capture, clade_scanner, cloudguard, compat, dlc_workshop, echidna_live, error, farm, feedback, fleet, game_preview, governance, hypatia, k9, level_architect, minter, multiplayer_monitor, network_topology, observability, overlay, plaza, provenance, release_manager, repoloader, script_gist, security, system_update, typell, umoja, ums, ums_cartridge, valence_shell, verisim_live, vm_inspector, voicetag, watcher, wiring_inspector, workspace.

Commits (review them one at a time)

  1. style(backend): rustfmt …: formatting only, about 1,100 lines. cargo fmt had never reached these files. You can skip this one.
  2. feat(backend): compile …: the real change, mostly deletions:
    • 221 blank lines removed. Each sat between a doc comment and its fn, left behind when #[tauri::command] attributes were deleted (clippy::empty_line_after_doc_comments).
    • minter_mint_panel now takes a MintRequest instead of 12 positional arguments (too_many_arguments). That struct already derives Deserialize for exactly this payload, so IPC registration can do serde_json::from_value::<MintRequest>(payload) like llm_coding_spawn. generate_panel_manifest drops an unused parameter.
    • Small clippy fixes in a2ml, cloudguard, farm, script_gist and security, none of which change behaviour. The a2ml directory filter merges two identical branches; the new condition matches the rule in a2ml_list's doc.
    • Test fixes: single_match, an irrefutable if let, and an always-true len() >= 0 assert.
    • compat::AppHandle derives Default.
    • Two rustdoc lints fixed: a bare URL in watcher and an unescaped <id> in identity. The identity one already fails on main.
    • Tauri leftovers removed from compat, error (to_tauri_result → to_command_result), cloudguard::commands and ums_cartridge::commands.
  3. docs: …:
    • The Cargo.toml header claimed "All 103 command handlers are registered"; 36 are. It also said libgossamer is linked at runtime as a .so; it is linked statically.
    • EXPLAINME-new.adoc claimed "270 migrated commands" and linked src-tauri/; both now match the code.
    • docs/TECHNICAL_DEBT.adoc: the F1 census step is marked done.
    • CHANGELOG entry.

Not in this PR

  • IPC registration: the new modules' handlers are not yet in register_commands (main.rs). That is the follow-up.
  • Tauri mentions in prose elsewhere ("Tauri command handlers" in module docs) are left alone. So are functional src-tauri strings in minter and repoloader, which point at other repos' layouts or generated output, and the idaptik-ums/src-tauri/... path in ums_cartridge, which names a file in another repo.
  • cargo clippy --features gossamer --all-targets -D warnings fails on SystemTrayState dead code in the bin's test target. That failure already exists on main, and no CI job runs that command.

Verification (default features, local)

  • cargo check --locked --all-targets: clean
  • cargo clippy --locked --all-targets -- -D warnings: clean
  • cargo fmt --all -- --check: clean
  • cargo test --locked --all-targets: 285 passed. Five repeat runs and --test-threads=1 (as build-validation runs it) were also clean.
  • cargo test --locked: 285 passed, plus 2 doctests (both ignore)
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps: clean
  • cargo build --features gossamer --bin panll-gossamer: not verified here. The container has no Zig 0.15.2 and no GTK/WebKit. Instead I ran cargo check --features gossamer --bin panll-gossamer against the real pinned gossamer-rs, with GOSSAMER_LIB_DIR pointing at an empty libgossamer.a and stub .pc files. It type-checks clean. The e2e workflow will do the real build and link.

One side effect: feedback's test writes a report under ~/.panll/feedback/ and deletes the file, but leaves the empty directory. The other new tests write under /tmp/panll.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SJtjqoZaSQo7uBwvwVMA9G


Generated by Claude Code

These 43 modules were declared by no crate root, so `cargo fmt` never
reached them. Formatting only, no code changes, so the next commit's
diff (wiring them into the lib) carries only real edits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SJtjqoZaSQo7uBwvwVMA9G
43 modules under src-gossamer/src/ were declared by no crate root, so
they were never compiled, linted or tested. None needs gossamer_rs, so
all are now `pub mod` in lib.rs and build without the optional
`gossamer` feature. main.rs still adds only system_tray.

`cargo test --lib` now runs 285 tests (was 23).

Fixes needed once the code compiled (clippy -D warnings, rustdoc):
- 221 blank lines between a doc comment and its fn, left where
  #[tauri::command] attributes were deleted
- minter_mint_panel takes a MintRequest instead of 12 positional args
  (too_many_arguments); generate_panel_manifest drops an unused param
- a2ml, cloudguard, farm, script_gist, security: if_same_then_else,
  bind_instead_of_map, for_kv_map, wildcard_in_or_patterns,
  useless_format, manual_strip
- tests: single_match (a2ml), irrefutable let (valence_shell),
  always-true len() >= 0 assert (release_manager)
- compat::AppHandle derives Default (new_without_default)
- bare URL (watcher) and unescaped <id> (identity) in rustdoc

Tauri leftovers removed from compat, error (to_tauri_result is now
to_command_result), cloudguard::commands and ums_cartridge::commands.

The handlers are not yet registered in register_commands (main.rs);
that is follow-up work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SJtjqoZaSQo7uBwvwVMA9G
- Cargo.toml header claimed "All 103 command handlers are registered";
  36 are. It also said libgossamer.so is linked at runtime; gossamer-rs
  links libgossamer statically.
- EXPLAINME-new.adoc claimed "270 migrated commands" and pointed at
  src-tauri/; it now says 36 registered, with the rest compiled and
  tested in the lib but not registered.
- docs/TECHNICAL_DEBT.adoc: F1 census step done (43 modules, 285 lib
  tests).
- CHANGELOG entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SJtjqoZaSQo7uBwvwVMA9G
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 50 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: c4a77c08-00cb-4382-b308-7dee2400ebba
📥 Commits

Reviewing files that changed from the base of the PR and between 5f91b53 and 7fe428f.

📒 Files selected for processing: 72
  • CHANGELOG.adoc
  • Cargo.toml
  • EXPLAINME-new.adoc
  • docs/TECHNICAL_DEBT.adoc
  • src-gossamer/src/a2ml/commands.rs
  • src-gossamer/src/aerie/commands.rs
  • src-gossamer/src/ai/commands.rs
  • src-gossamer/src/ai/mod.rs
  • src-gossamer/src/ai/providers.rs
  • src-gossamer/src/ai/types.rs
  • src-gossamer/src/boj/commands.rs
  • src-gossamer/src/boj_live.rs
  • src-gossamer/src/capture/commands.rs
  • src-gossamer/src/capture/mod.rs
  • src-gossamer/src/capture/types.rs
  • src-gossamer/src/clade_scanner/commands.rs
  • src-gossamer/src/cloudguard/api.rs
  • src-gossamer/src/cloudguard/commands.rs
  • src-gossamer/src/cloudguard/config.rs
  • src-gossamer/src/cloudguard/diff.rs
  • src-gossamer/src/cloudguard/mod.rs
  • src-gossamer/src/cloudguard/trustfile.rs
  • src-gossamer/src/cloudguard/types.rs
  • src-gossamer/src/compat.rs
  • src-gossamer/src/dlc_workshop/commands.rs
  • src-gossamer/src/echidna_live.rs
  • src-gossamer/src/error.rs
  • src-gossamer/src/farm/commands.rs
  • src-gossamer/src/farm/mod.rs
  • src-gossamer/src/feedback/commands.rs
  • src-gossamer/src/fleet/commands.rs
  • src-gossamer/src/game_preview/commands.rs
  • src-gossamer/src/governance/commands.rs
  • src-gossamer/src/hypatia/commands.rs
  • src-gossamer/src/identity.rs
  • src-gossamer/src/k9/commands.rs
  • src-gossamer/src/level_architect/commands.rs
  • src-gossamer/src/lib.rs
  • src-gossamer/src/minter/commands.rs
  • src-gossamer/src/minter/mod.rs
  • src-gossamer/src/multiplayer_monitor/commands.rs
  • src-gossamer/src/network_topology/commands.rs
  • src-gossamer/src/observability/commands.rs
  • src-gossamer/src/overlay/commands.rs
  • src-gossamer/src/plaza/commands.rs
  • src-gossamer/src/plaza/mod.rs
  • src-gossamer/src/plaza/types.rs
  • src-gossamer/src/provenance/commands.rs
  • src-gossamer/src/release_manager/commands.rs
  • src-gossamer/src/repoloader/commands.rs
  • src-gossamer/src/repoloader/mod.rs
  • src-gossamer/src/repoloader/scanner.rs
  • src-gossamer/src/script_gist/commands.rs
  • src-gossamer/src/security/commands.rs
  • src-gossamer/src/security/mod.rs
  • src-gossamer/src/system_update/commands.rs
  • src-gossamer/src/typell/commands.rs
  • src-gossamer/src/umoja/commands.rs
  • src-gossamer/src/ums/commands.rs
  • src-gossamer/src/ums_cartridge/commands.rs
  • src-gossamer/src/valence_shell/commands.rs
  • src-gossamer/src/verisim_live.rs
  • src-gossamer/src/vm_inspector/commands.rs
  • src-gossamer/src/voicetag/commands.rs
  • src-gossamer/src/watcher/commands.rs
  • src-gossamer/src/watcher/mod.rs
  • src-gossamer/src/watcher/types.rs
  • src-gossamer/src/wiring_inspector/commands.rs
  • src-gossamer/src/workspace/commands.rs
  • src-gossamer/src/workspace/mod.rs
  • src-gossamer/src/workspace/sysinfo.rs
  • src-gossamer/src/workspace/types.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread src-gossamer/src/game_preview/commands.rs Fixed
Hypatia code scanning flagged the expect() (CWE-754) once rustfmt
re-wrapped the line. It could not fire, because an is_empty() check
returned first, but `let Some(latest) = recordings.last() else` covers
both cases with no panic path. The separate guard and its wrong "line
146" comment are gone. Behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SJtjqoZaSQo7uBwvwVMA9G
@hyperpolymath
hyperpolymath marked this pull request as ready for review October 14, 2026 11:23
@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath merged commit 5466ec2 into main Oct 14, 2026
43 checks passed
@hyperpolymath
hyperpolymath deleted the claude/admiring-meitner-8qkxac branch October 14, 2026 11:29
hyperpolymath added a commit that referenced this pull request Oct 19, 2026
## Summary

This PR changes docs only, in three files. It follows up on
#153.

**Rust test counts.** README said 12, EXPLAINME-new said 12, and
TEST-NEEDS said 267 "all passing". `cargo test --locked --lib` runs
**285** since #153. Before #153, only 23 of TEST-NEEDS' 267 tests
actually compiled. The rest lived in modules that no crate root
declared. TEST-NEEDS keeps its 267 figure as history and adds a dated
correction next to it.

**JS-suite claims.** README ("97 JS") and EXPLAINME-new ("CI enforces
both") described a JS suite that can't run today:
- 140 of the 143 files under `tests/` import compiled ReScript output
(`src/**/*.res.js`) that #107 removed.
- #108 removed `deno.json`.
- `build-validation.yml` runs only the Rust test gate.

The docs now say the JS suite waits on the AffineScript port (#148).
TEST-NEEDS gets the same note under its JS rows. README's `bun task
test` became `cargo test --locked --lib`, because there is no JS
manifest to define a `test` task.

Also: TEST-NEEDS said there are 116 Rust files; there are 112.

## Not changed

README's other build commands (`bun task res:buildbures`, "BuildBu", and
so on) look damaged too. They belong to the frontend port, so this PR
leaves them alone.

## Verification

- `cargo test --locked --lib` on `main` (9961333): 285 passed.
- `grep -c '#\[test\]\|#\[tokio::test\]'` finds 288 matches. 285 are
real tests. The other 3 are doc comments that mention `#[tokio::test]`.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01SJtjqoZaSQo7uBwvwVMA9G)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Oct 19, 2026
…r) (#157)

## Summary

This PR follows up on #153. That PR compiled 43
backend modules into the lib, but their handlers were never registered,
so the app can't call them. This PR registers them.

It is a **draft**. This first commit adds the bridge and the
`coprocessor` pilot (F2 in `docs/TECHNICAL_DEBT.adoc`). The other
modules follow in batches on this branch, using the same pattern.

## Design

The new GTK-free lib module `ipc` holds a command table, and `main.rs`
registers every entry with `App::command_async`. Each call therefore
runs on a Gossamer worker thread and never on the GTK main thread.
Because the table is in the lib, `cargo test --lib` checks every entry
without GTK.

The conventions below come from the old frontend's `invoke()` calls,
recovered from the ReScript sources deleted in #107. There were 382
distinct names across 75 `*Cmd.res` files.

| | Rule | Why |
|---|---|---|
| Argument keys | Look up the snake_case key first, then its camelCase
form. | Tauri renamed `providerId` → `provider_id` automatically; the
Gossamer bridge does not. The old frontend used both: 151 backend
functions match it exactly, and about 36 differ only in casing. |
| Missing argument | It reads as `null`. `Option` parameters get `None`;
a required one fails with ``missing argument `x` `` before the handler
runs. | Tauri rejected such calls too. Some old frontend calls omitted
arguments, for example `valence_shell_input` without `session_id`. |
| Struct parameters | Use the named key if present, otherwise the whole
payload. | `minter_mint_panel` was called with flattened fields and
`ai_send_message` with both shapes. |
| Response | `{"ok": true, "result": …}` / `{"ok": false, "error":
"…"}`, the envelope `main.rs` already uses. A result that isn't JSON
stays a string instead of becoming `null`. | It stays consistent for the
AffineScript frontend (#148). |
| `async fn` | `ipc::block_on` on one shared multi-thread Tokio runtime.
Sync handlers are called directly. | Spawned tasks outlive the call,
which AI streaming needs. Several sync handlers use `reqwest::blocking`,
which must not run inside a runtime. I checked that no `async` command
file calls the blocking modules. |

## Progress

- [x] Bridge, conventions and tests (`src-gossamer/src/ipc.rs`)
- [x] Pilot: `coprocessor`, 10 commands
- [ ] Remaining modules, 223 commands, in batches
- [ ] Event pump: drain `compat`'s event bus to the webview through
`gossamer_emit`, which is thread-safe. This lands in the same batch as
`ai_send_message_streaming` and `watcher_start`, the two handlers that
emit events.
- [ ] Docs: the `Cargo.toml` header count, EXPLAINME-new,
`TECHNICAL_DEBT` F1/F2, CHANGELOG

Not registered: `ums_cartridge::validate_level_data`, which is a helper
that returns a `ValidationResult`. The 10 `llm_coding` commands were
already registered in `main.rs`, and a test keeps the table and
`main.rs` from registering the same name twice.

## Verification (local)

- `cargo fmt --check`, `cargo clippy --locked --all-targets -- -D
warnings`, and `RUSTDOCFLAGS="-D warnings" cargo doc`: all clean.
- `cargo test --locked`: 293 passed (285 + 8 new `ipc` tests), plus 2
ignored doctests.
- `cargo clippy --locked --features gossamer --bin panll-gossamer -- -D
warnings`: clean, type-checked against the real gossamer-rs
`command_async`. This used an empty `libgossamer.a` and stub `.pc`
files, because the container has no Zig or GTK. The e2e job does the
real build.

`governance / *`, `scan / *` and Hypatia will fail at job setup with
`invalid lockfile pin`, as they do on every PR right now.
#156 fixes that.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01SJtjqoZaSQo7uBwvwVMA9G)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Oct 19, 2026
## Summary

`cargo clippy --locked --features gossamer --all-targets -- -D warnings`
failed on `main` in the `panll-gossamer` test target with two errors:

- `struct SystemTrayState is never constructed`
- `associated function new is never used`

These are plain rustc dead-code warnings, which `-D warnings` turns into
errors. The state was built inside `lazy_static!`'s generated
initializer, and dead-code analysis doesn't count that as a use in test
builds. The non-test bin and the default-feature targets were clean. No
CI job runs this command, so it never showed up in CI.
#153 noted it as an issue that predates that PR.

**Fix:** `SYSTEM_TRAY_STATE` is now a `static Mutex<SystemTrayState>`
built by a `const fn new()`. `Mutex::new` is `const`, so the code needs
neither `lazy_static` nor the `Arc`. Behaviour doesn't change: the
initial values are the same, `new()` has no side effects, and every
caller still uses `SYSTEM_TRAY_STATE.lock()`.

`system_tray` was the only user of `lazy_static`, so the dependency is
dropped. `Cargo.lock` was regenerated by cargo and loses only the
`lazy_static` entry.

## Verification (local)

The default-feature gates:
- `cargo fmt --all -- --check`: clean
- `cargo clippy --locked --all-targets -- -D warnings`: clean
- `cargo test --locked`: 285 passed, plus 2 doctests (both `ignore`)
- `RUSTDOCFLAGS="-D warnings" cargo doc --no-deps`: clean

The `gossamer` feature: this container has no Zig or GTK/WebKit. I
pointed `GOSSAMER_LIB_DIR` at an empty `libgossamer.a` and added stub
`.pc` files. This setup type-checks without linking, so the e2e job
remains the real build and test.
- `cargo clippy --locked --features gossamer --all-targets -- -D
warnings`: **clean**. On `main` it shows the 2 errors above.
- `cargo check --locked --features gossamer --all-targets`: clean

---
_Generated by [Claude
Code](https://claude.ai/code/session_01SJtjqoZaSQo7uBwvwVMA9G)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

3 participants