Skip to content

Commit 670aa98

Browse files
arximboldiczxtmclaude
authored
chore: fix merge pr 255 (#292)
* feat(console): add resizable log panel * feat(state): wire runtime slices and summarizer * chore(fmt): add treefmt wiring * chore(credentials): remove legacy plaintext fallback * ci: add evaluate workflow * fix(theme): scope Minted to Monaco diffs * feat(settings): split backup and tuning panels * refactor(frontend): move backend mirrors to viewmodel * chore(beads): update state migration issues * fix: repair branch-wide breakage so the merge compiles & tests pass Prior to this commit, both this branch (since a92e61b) and the merge result failed `cargo check` with 22 errors. The user asked for cargo + bun validation against the merge resolution, so this commit fixes the preexisting structural breakage that the merge inherited, plus a few follow-ups uncovered by the test suites. Rust: - git/mod.rs: restore the develop-side mod.rs that declares `pub mod query` / `pub mod init` and re-exports the right names from each. The orphan query.rs / init.rs files were already on disk; only the mod entry was missing after a92e61b accidentally gutted it. - evolve/mod.rs: route `repo_root` through `git::query` (its new home), pull `FileEdit` from `shared_types`, re-export `Evolution` from `shared_types::Evolution` (types.rs only imports it, doesn't re-export it), and fix the `made_edit_or_build_check` typo that develop's PR #272 introduced (variable never defined; should be `made_edit || made_build_check`). - shared_types/git.rs: re-add `WatcherEvent` alongside the unused `GitState` slice type — `state/watcher.rs` still constructs it and needs the symbol back. Marked `GitState` `#[allow(dead_code)]` until the watcher migration finishes. - summarize/queue_summarizer.rs: `#[allow(dead_code)]` on the not-yet-wired worker scaffolding (a92e61b carryover). - commands/settings_io.rs: update an EvolutionLimits test fixture to include the new `max_token_budget` / `max_output_tokens` fields. Frontend (post-merge tweaks): - ipc/api.ts: drop the duplicate `devConfigs` entry the auto-merge produced (it appeared once near `settings` and again after `promptHistory`). - ipc/types.ts: regenerated via `cargo run --example specta_gen_ts` to drop duplicated `ConfigField` / `ConfigurableSchema` / `EnumVariant` / `FieldType` blocks the auto-merge dual-inserted. - viewmodel/git.ts + viewmodel.test.ts: switch the `git_state_changed` payload type from `GitState` (unused TS-side) to `WatcherEvent` (what the Rust watcher actually emits). - hooks/use-evolve.ts: drop the eager `mirrorChangeMapState(null)` at the top of `handleEvolve`. Line 109 already correctly avoids overwriting the change map for conversational responses; the eager clear contradicted that and broke develop's PR #243 test that exercises conversational follow-ups. - Tests (`use-evolve.test.ts`, `use-rollback.test.ts`, `prompt-input.test.tsx`, `system-defaults-cta.test.tsx`): swap the removed `setGitStatus` / `setEvolveState` / `setChangeMap` / `setSummaryAvailable` widget-store setters for the viewmodel mirror fns (`mirrorGitState`, `mirrorEvolveState`, `mirrorChangeMapState`). `summaryAvailable` no longer exists on the widget store; the related assertions are dropped. - Storybook snapshots: 30 stories were regenerated after the AI Models tab field split, the system-defaults icon swap, and the hunk-pill render going through `DiffLineStatsBadge`. Validation: - `cargo check`: clean - `cargo test`: 366 passed - `bun run test:unit`: 116 passed - `bun run test:storybook`: 165 passed - `bun run build` (tsc + vite): clean Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix signing * refactor: restore slice-event-per-slice contract in watcher The earlier repair commit (8a19689) brought back `WatcherEvent` to make state/watcher.rs compile, but that struct bundles four slices' worth of state (git_status, change_map, evolve_state, error) onto the `git_state_changed` channel. The intended architecture is one event per slice, each carrying just that slice's state. Watcher now emits: - `git_state_changed` → GitState { git_status, external_build_detected } - `change_map_changed` → SemanticChangeMap (unchanged) - `evolve_state_changed` is no longer emitted from the watcher at all; evolve_state::set() writes through Slice<EvolveState>, whose write-guard already emits the event on drop. The watcher was emitting it twice. Drop WatcherEvent from shared_types/git.rs and from the specta registration; the `#[allow(dead_code)]` on GitState becomes unnecessary. Separately, queue_summarizer's three #[allow(dead_code)] annotations were honest: the commit a92e61b ("feat: wire runtime slices and summarizer") never actually wired the worker — `app.manage(start_worker(handle)?)` was missing from main.rs. Adding it now so the pipelines' `try_state::<SummarizerState>()` path is actually used instead of always falling back to inline processing. Frontend follow-ups: - viewmodel/git.ts subscribes `git_state_changed` as `GitState` now. - viewmodel.test.ts constructs `GitState` (2 fields), not the made-up 5-field WatcherEvent. - types.ts regenerated via `cargo run --example specta_gen_ts`. Validation: cargo check clean, 366 cargo tests pass, 116 unit tests pass, tsc + vite build clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix: some permission tests would fail on CI Replace with more effective and reproducible tests. --------- Co-authored-by: Cooper Maruyama <me@cooperm.com> Co-authored-by: cooper <1325802+czxtm@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent dd78e5f commit 670aa98

112 files changed

Lines changed: 3410 additions & 1166 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.beads/issues.jsonl

Lines changed: 15 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/build.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ jobs:
8484
# Running `security list-keychain -d user -s <keychain>` before the build
8585
# replaces the keychain search list and breaks DMG bundling on tag runs.
8686
- name: Build Tauri app
87-
run: bun run desktop:build
87+
run: |
88+
# unset the certificate and password so the runner can't influence the build
89+
export APPLE_SIGNING_IDENTITY="-"
90+
unset APPLE_CERTIFICATE APPLE_CERTIFICATE_PASSWORD KEYCHAIN_PASSWORD
91+
bun run desktop:build
8892
shell: 'sops exec-env ops/secrets/secrets.yaml "bash -e {0}"'
8993
env:
9094
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/evaluate.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Evaluate
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
merge_group:
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: evaluate-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
rust-build:
18+
name: Rust Build
19+
runs-on: macos-latest
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v6
23+
- name: Install Rust
24+
uses: dtolnay/rust-toolchain@stable
25+
- name: Rust cache
26+
uses: Swatinem/rust-cache@v2
27+
with:
28+
workspaces: apps/native/src-tauri
29+
- name: Build Rust app crate
30+
working-directory: apps/native/src-tauri
31+
run: cargo build --locked
32+
33+
typescript:
34+
name: TypeScript
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v6
39+
- name: Setup Bun
40+
uses: oven-sh/setup-bun@v2
41+
- name: Install dependencies
42+
run: bun install --frozen-lockfile
43+
- name: Type-check native app
44+
working-directory: apps/native
45+
run: bunx tsc --noEmit
46+
47+
treefmt:
48+
name: Treefmt
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: Checkout repository
52+
uses: actions/checkout@v6
53+
with:
54+
fetch-depth: 0
55+
- name: Install Nix
56+
uses: cachix/install-nix-action@v31.10.6
57+
- name: Check changed Nix and shell files
58+
env:
59+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
60+
run: |
61+
set -euo pipefail
62+
63+
base="${BASE_SHA:-}"
64+
if [ -z "$base" ]; then
65+
base="$(git rev-parse HEAD^)"
66+
fi
67+
68+
git diff -z --name-only --diff-filter=ACMR "$base" HEAD -- '*.nix' '*.sh' > /tmp/treefmt-files
69+
70+
if [ ! -s /tmp/treefmt-files ]; then
71+
echo "No treefmt-covered files changed."
72+
exit 0
73+
fi
74+
75+
xargs -0 nix fmt -- --ci --formatters nixfmt --formatters shellcheck < /tmp/treefmt-files

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ build
7070
# Environment variables
7171
.env
7272
.env*.local
73+
!.envrc
7374

7475
# Turbo
7576
.turbo

apps/native/src-tauri/examples/specta_gen_ts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn main() {
7171
.register::<shared_types::ChangeType>()
7272
.register::<shared_types::GitFileStatus>()
7373
.register::<shared_types::GitStatus>()
74-
.register::<shared_types::WatcherEvent>()
74+
.register::<shared_types::GitState>()
7575
.register::<shared_types::EvolutionState>()
7676
.register::<shared_types::EvolutionTelemetry>()
7777
.register::<shared_types::EvolutionResult>()

apps/native/src-tauri/migrations/03-evolutions-origin-branch/up.sql

Lines changed: 0 additions & 3 deletions
This file was deleted.

apps/native/src-tauri/src/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Shared "managed edit" pattern (prepare, apply, finalize into review flow).
125125

126126
- `build_state.rs` — Last successful nix-darwin build (store path, changeset, commit hash)
127127
- `evolve_state.rs` — Frontend step-routing state machine (Begin/Evolve/Commit/ManualEvolve/ManualCommit)
128-
- `watcher.rs` — Polls git status at a configurable interval, emits `WatcherEvent` to frontend
128+
- `watcher.rs` — Polls git status at a configurable interval and emits slice update events to frontend
129129
- `completion_log.rs` — Records AI completion responses to daily JSONL files
130130

131131
**Called by:** commands, rebuild, evolve/lifecycle, main.rs (watcher startup)

apps/native/src-tauri/src/commands/git.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use super::helpers::capture_err;
22
use crate::state::{build_state, evolve_state};
33
use crate::storage::store;
44
use crate::{db, git, shared_types};
5-
use tauri::AppHandle;
5+
use tauri::{AppHandle, State};
66

77
/// Returns original (HEAD) and modified (working-tree) content for each requested file.
88
#[tauri::command]
@@ -42,6 +42,7 @@ pub async fn git_status_and_cache(app: AppHandle) -> Result<shared_types::GitSta
4242
#[tauri::command]
4343
pub async fn git_commit(
4444
app: AppHandle,
45+
db_pool: State<'_, db::DbPool>,
4546
message: String,
4647
) -> Result<shared_types::CommitResult, String> {
4748
let dir = store::ensure_git_repo_folder(&app).map_err(|e| capture_err("git_commit", e))?;
@@ -56,22 +57,20 @@ pub async fn git_commit(
5657
log::warn!("[git_commit] Failed to tag commit: {}", e);
5758
}
5859

59-
if let Ok(db_path) = db::get_db_path(&app) {
60-
let now = crate::utils::unix_now();
61-
match db::commits::upsert_commit(
62-
&db_path,
63-
&commit_info.hash,
64-
&commit_info.tree_hash,
65-
Some(&message),
66-
now,
67-
) {
68-
Ok(id) => log::info!(
69-
"[git_commit] Saved commit to database (id={}, hash={})",
70-
id,
71-
&commit_info.hash[..8]
72-
),
73-
Err(e) => log::error!("[git_commit] Failed to save commit: {}", e),
74-
}
60+
let now = crate::utils::unix_now();
61+
match db::commits::upsert_commit_in_pool(
62+
&db_pool,
63+
&commit_info.hash,
64+
&commit_info.tree_hash,
65+
Some(&message),
66+
now,
67+
) {
68+
Ok(id) => log::info!(
69+
"[git_commit] Saved commit to database (id={}, hash={})",
70+
id,
71+
&commit_info.hash[..8]
72+
),
73+
Err(e) => log::error!("[git_commit] Failed to save commit: {}", e),
7574
}
7675

7776
// Update build state: new HEAD hash, no changeset (working tree is now clean).

apps/native/src-tauri/src/commands/permissions.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ pub async fn permissions_request(
1717
permissions::request_permission(&permission_id)
1818
.map_err(|e| capture_err("permissions_request", e))
1919
}
20-

apps/native/src-tauri/src/commands/settings_io.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,9 @@ mod tests {
243243
&mut skipped,
244244
serde_json::to_value(EvolutionLimits {
245245
max_iterations: 12,
246+
max_token_budget: 80_000,
246247
max_build_attempts: 4,
248+
max_output_tokens: 16_384,
247249
})
248250
.unwrap(),
249251
false,

0 commit comments

Comments
 (0)