openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

refactor(app/deps): move redux-logger to devDependencies (#2625)

Open oxoxDev opened this issue 6 months ago • 2 comments

Summary

  • Move redux-logger ^3.0.6 from app/package.json dependencies to devDependencies.
  • Auto-regenerated pnpm-lock.yaml reflects the move (3 insertions / 3 deletions in the importer block).
  • debug is deliberately untouched — it is the project's primary namespaced logger and is load-bearing in 10+ production code paths (CoreStateProvider, ChatRuntimeProvider, voice/mascot features, app/src/utils/tauriCommands/common.ts, etc.). Audit #2575 (M-2) overstated this; tracked in #2575's tracking comment.

Problem

app/package.json:104 listed "redux-logger": "^3.0.6" under dependencies. The actual consumer at app/src/store/index.ts:175-178 already gates createLogger behind if (IS_DEV) — so at runtime, production builds do not invoke redux-logger. Still, listing it under dependencies is an audit smell: the manifest advertises a runtime dependency on a dev-only logger. CWE-532 (Insertion of Sensitive Information into Log File).

Identified by audit #2575 (M-2). Supersedes #2623, which incorrectly bundled debug into the same change.

Solution

  1. Move "redux-logger": "^3.0.6" from dependencies to devDependencies in app/package.json (alphabetical slot between prettier and tailwindcss).
  2. Run pnpm install to regenerate pnpm-lock.yaml — the workspace root lockfile, NOT app/pnpm-lock.yaml which doesn't exist in this repo (single lockfile at root per pnpm workspaces convention).
  3. No source changes: app/src/store/index.ts:175-178 already has the IS_DEV runtime guard. Static import { createLogger } from 'redux-logger' at line 2 is unchanged.

Notable finding (out of scope, flagged for follow-up): grep -r 'redux-logger' app/dist/ returned 11 matches — the redux-logger runtime library is being bundled into production despite the IS_DEV gate. Vite isn't tree-shaking the static import. This is pre-existing on main, not caused by this PR; the deps move is correct as audit-smell cleanup, but the bundling concern is orthogonal and worth a separate ticket.

Submission Checklist

  • [x] N/A: Tests added or updated — dependency-block move; no source change. Existing app/src/test/setup.ts:208-209 already mocks redux-logger for tests and still passes.
  • [x] Diff coverage ≥ 80% — manifest + lockfile change; no source line coverage applies.
  • [x] N/A: Coverage matrix updated — build/dep configuration change
  • [x] N/A: All affected feature IDs from the matrix are listed in ## Related — dep management is not a matrix-tracked feature
  • [x] No new external network dependencies introduced — opposite, removes a runtime dependency advertisement
  • [x] N/A: Manual smoke checklist updated — no behaviour change
  • [x] Linked issue closed via Closes #NNN in the ## Related section

Impact

  • Security: closes CWE-532 surface in the dependency manifest. The bundled-bytes concern (Vite not tree-shaking the static import) remains and is flagged as a follow-up.
  • Build: no change to dev or prod build behaviour; pnpm install regenerates the lockfile without other dependency drift.
  • Tests: 3495 / 3500 pass (3 pre-existing failures in Conversations render + a port-selection flake, none related to redux-logger; same on main).
  • Compatibility: dev still gets the existing collapsed-groups redux logging via the IS_DEV branch in app/src/store/index.ts.

Related

  • Closes #2625
  • Supersedes #2623
  • Parent: #2575
  • Follow-up: separate ticket for Vite tree-shaking the static redux-logger import out of the production bundle (today the gated dead-code branch still ships the runtime library bytes).

AI Authored PR Metadata

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: refactor/2625-redux-logger-devdeps
  • Commit SHA: 053ad91c

Validation Run

  • [x] pnpm --filter openhuman-app format:check — PASS (no formatting changes)
  • [x] pnpm typecheck — PASS
  • [x] Focused tests: pnpm test 3495/3500 PASS (3 pre-existing failures unrelated to this PR — Conversations render + port-selection flake)
  • [x] Rust fmt/check: N/A — no Rust touched
  • [x] Tauri fmt/check: N/A

Validation Blocked

  • command: N/A
  • error: N/A
  • impact: N/A

Behavior Changes

  • Intended behavior change: none at runtime; dependency manifest reflects actual usage shape.
  • User-visible effect: none.

Parity Contract

  • Legacy behavior preserved: yes — IS_DEV guard at app/src/store/index.ts:175-178 keeps the existing dev-only redux logging path.
  • Guard/fallback/dispatch parity checks: N/A — dep management only.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): #2623 (closed as superseded)
  • Canonical PR: this PR
  • Resolution: superseded — #2623 incorrectly bundled debug into the same change; this PR is scoped to redux-logger only.

Summary by CodeRabbit

  • Chores
    • Updated development dependencies configuration for improved build optimization.

Review Change Stack

oxoxDev avatar May 25 '26 11:05 oxoxDev

📝 Walkthrough

Walkthrough

Redux-logger is relocated from production dependencies to devDependencies in app/package.json. The package is already guarded by an IS_DEV runtime check and only runs in development builds, making this reclassification more accurate for production packaging.

Changes

Dependency reclassification

Layer / File(s) Summary
Move redux-logger to devDependencies
app/package.json
Redux-logger is removed from dependencies at lines 103–104 and added to devDependencies at line 148, reflecting its development-only usage.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related issues

  • #2623: Superseded by this PR; that issue incorrectly bundled both redux-logger and debug migrations, whereas this PR moves only redux-logger while keeping debug in dependencies per its load-bearing production use.

Poem

🐰 A logger once lived in the main,
Guarded by IS_DEV's refrain.
Now to devDeps it hops away,
Where dev-time logs safely play!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive The PR substantially addresses issue #2625's core requirements: redux-logger moved to devDependencies, debug left in dependencies, and existing IS_DEV guard preserved. However, the acceptance criterion requiring production bundle verification (no redux-logger reference in app/dist) is not explicitly documented as completed. Clarify whether production bundle verification (pnpm build && grep app/dist) was performed to confirm no redux-logger references remain, as required by issue #2625's acceptance criteria.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: moving redux-logger from dependencies to devDependencies, which is the primary objective of the PR.
Out of Scope Changes check ✅ Passed All changes are directly related to moving redux-logger to devDependencies and regenerating the lockfile, with no unrelated modifications observed in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

coderabbitai[bot] avatar May 25 '26 11:05 coderabbitai[bot]

CI status (post body fix)

PR Submission Checklist: now passing after marking N/A items as [x] N/A: <text> per the parser regex in scripts/lib/checklist-parser.mjs.

Other failures all inherited, none caused by the redux-logger devDeps move:

  • test / Rust Core Tests + Quality: openhuman::memory::ops::documents::tests::envelope_memory_handlers_report_counts_and_statuses panics in the memory domain. This is the PII guard (safety::pii::has_likely_pii) added in PR #2574 / commit a47740d4 tripping on test namespaces. Memory-domain regression on main; this manifest-only PR doesn't touch any Rust path. Re-running the failed job.
  • e2e / E2E (Linux / Appium Chromium): same job failing on upstream/main (run 26391619635) — inherited.

Note that #2627 (sibling security-batch PR) passed test / Rust Core Tests + Quality on the same main snapshot, confirming the failure is order/selection-dependent and not coupled to this PR's diff.

oxoxDev avatar May 25 '26 12:05 oxoxDev