Skip to content

AST-aware code compression silently disabled in desktop builds (tokenjuice-treesitter dropped) #4918

Description

@CodeGhost21

Summary

The desktop app is built without the core's default tokenjuice-treesitter feature, so AST-aware code compression silently falls back to the brace-depth heuristic in every shipped build. Same root cause as #4901, but it fails soft — no error, no Sentry signal, just quietly worse output.

Problem

app/src-tauri/Cargo.toml declares the core with default-features = false. That line predates the core having any defaults (written 2026-05-16, when [features] had no default list), so it silently drops each default the core later gained. #4901 fixed voice; tokenjuice-treesitter — the core's other default — is still dropped.

What happens: tokenjuice-treesitter = ["tinyjuice/tinyjuice-treesitter"] is never enabled for the shipped binary, so tinyjuice uses the brace-depth heuristic instead of tree-sitter grammars.

What's expected: the desktop app compresses code with the AST-aware path, as default = ["tokenjuice-treesitter", "voice"] intends.

Steps to reproduce (same probe + control that diagnosed #4901):

# Shell (what ships) — tree-sitter ABSENT
cd app/src-tauri && cargo tree -i tree-sitter
#   error: package ID specification `tree-sitter` did not match any packages

# Control: root crate (tokenjuice-treesitter default-ON) — tree-sitter PRESENT
cd ../.. && GGML_NATIVE=OFF cargo tree -i tree-sitter
#   tree-sitter v0.26.10
#   └── tinyjuice v0.2.1 → openhuman v0.61.2

Version/platform: verified on upstream/main @ 0e86b85c9 (macOS). Affects all desktop platforms and every release since the feature became a default.

Unlike #4901 this is not user-visible as an error — it degrades output quality silently, which is why it has gone unnoticed.

Solution (optional)

Likely one line — add tokenjuice-treesitter to the openhuman_core feature list in app/src-tauri/Cargo.toml:

openhuman_core = { path = "../..", package = "openhuman", default-features = false, features = [
    "voice",
    "tokenjuice-treesitter",
] }

Decide first whether the drop is intentional. The shell separately declares tinyjuice = { version = "0.2.1", default-features = false }, which hints the tree-sitter C build may be avoided deliberately (build time / cross-compilation). If so, the fix is to document that on the default list rather than enable it. This is exactly why it was excluded from #4917 instead of bundled in.

Enabling it adds tree-sitter's C grammar build to the desktop build — measure the build-time and binary-size cost before merging.

Acceptance criteria

  • Decision recorded — confirm whether shipping without tree-sitter was intentional; if so, document it and close.
  • Repro gonecargo tree -i tree-sitter from app/src-tauri resolves the crate (or the intentional-drop decision is documented).
  • Regression safety — covered by the feature-forwarding CI guard (see Related); no silent drop possible.
  • Cost measured — build-time / binary-size delta from the tree-sitter C build noted on the PR.
  • Diff coverage ≥ 80% — the fix PR meets the changed-lines coverage gate.

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions