Skip to content
This repository was archived by the owner on May 13, 2026. It is now read-only.

Fix handler inconsistencies and deduplicate patterns - #31

Merged
shiba4life merged 1 commit into
mainfrom
fix-handler-inconsistencies
Mar 14, 2026
Merged

Fix handler inconsistencies and deduplicate patterns#31
shiba4life merged 1 commit into
mainfrom
fix-handler-inconsistencies

Conversation

@shiba4life

Copy link
Copy Markdown
Collaborator

Summary

  • Convert 3 log handler response structs to handler_response! macro for consistency with all other handler files (schema, query, mutation, system, ingestion)
  • Export LOG_LEVELS as pub const and reuse in routes/log.rs instead of duplicating the array inline
  • Consolidate duplicated perform_smart_folder_scan_with_progress call in smart_folder_routes.rs — extract optional node guard before a single call instead of two identical 6-line call sites

Net -6 lines (31 added, 37 removed).

Test plan

  • cargo clippy --workspace --all-targets -- -D warnings passes
  • cargo check --workspace --features aws-backend passes
  • cargo test --workspace --all-targets — all tests pass
  • CI passes on PR

🤖 Generated with Claude Code

- Convert 3 log handler response structs to handler_response! macro
  for consistency with all other handler files (schema, query, mutation,
  system, ingestion)
- Export LOG_LEVELS as pub const and reuse in routes/log.rs instead of
  duplicating the array inline
- Consolidate duplicated perform_smart_folder_scan_with_progress call
  in smart_folder_routes.rs — extract optional node guard before the
  single call instead of two identical 6-line call sites

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shiba4life
shiba4life enabled auto-merge (squash) March 14, 2026 05:42

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e23998643

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ingestion/smart_folder_routes.rs
@shiba4life
shiba4life merged commit 5f87947 into main Mar 14, 2026
4 checks passed
@shiba4life
shiba4life deleted the fix-handler-inconsistencies branch March 14, 2026 05:48
shiba4life added a commit that referenced this pull request May 1, 2026
…ee to .tsx

Make Rust↔TS shape mismatches in the React UI a compile error rather than a
runtime React #31. Three coordinated pieces:

1. **Strict TypeScript typecheck.** New `tsconfig.json` (strict, JSX, allowJs
   for transitional .jsx imports), `npm run typecheck` script, and a
   `Typecheck (tsc --noEmit)` step in the `frontend-tests` CI job. 16
   pre-existing `.ts` files have real type bugs (wrong return types, missing
   names, modifier mismatches) — fixing them is out of scope for this PR, so
   they self-opt-out via `// @ts-nocheck — pre-existing strict-mode debt;
   remove this directive after fixing.` Grep for that string to find the
   cleanup queue. Eslint's `ban-ts-comment` rule is configured to allow
   `@ts-nocheck` only with a description ≥10 chars so the directive can't be
   sprinkled silently in new code. `jsconfig.json` removed (replaced by
   tsconfig.json).

2. **OpenAPI drift check.** New steps at the end of `rust-fast` that run
   `cargo run --bin openapi_dump > target/openapi.json`, regenerate
   `src/types/openapi.ts`, and `git diff --exit-code`. Backend route or
   schema changes that don't update the TS types now fail PR CI with a
   one-line fix command. Also pinned `generate:api` to use the
   locally-installed `openapi-typescript` (was `npx -y`) for deterministic
   CI runs.

3. **Settings tree converted to .tsx.** `SettingsTab`, `AiConfigSettings`,
   `DatabaseSettings`, and a shared `components/settings/types.ts` for
   `SaveStatus` / `SettingsPanelProps`. The bug that prompted this work — a
   JSX consumer rendering `{success, message}` as a React child — is now a
   compile error: `Type 'SaveStatus' is not assignable to type 'ReactNode'`.

The conversion also surfaced two real shape gaps in `ingestionClient.ts` —
`OllamaConfig` was missing `vision_model` / `ocr_model` even though the Rust
struct serialises them, and `IngestionConfig` was missing the legacy
dual-written `query: UseCaseOverride` field. Added both. The OpenAPI spec is
also missing them (utoipa annotation drift) — tracked as a separate finding
in the audit feeding gbrain projects/api-typegen-unification.

Verification: `npm run typecheck` clean. `npm test` 51 files / 650 tests
pass. Local `npm run lint` shows only 3 pre-existing errors in unrelated
test files. Reintroducing the original `<span>{configSaveStatus}</span>` bug
deliberately produces the expected typecheck error, confirming the guard.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant