fireproof icon indicating copy to clipboard operation
fireproof copied to clipboard

Feat/fix 2304 lint errors

Open KodeSage opened this issue 3 months ago • 5 comments

Summary by CodeRabbit

  • Bug Fixes
    • More reliable CLI defaults, validation and env handling (token, storage, date parsing) and safer script updates.
    • Improved cloud/websocket/message error handling and more consistent publish/build sequencing.
  • Refactor
    • Simplified public typings and tightened null/undefined handling for more predictable behavior.
    • Increased immutability and clearer async flow in core services.
  • Chores
    • ESLint config updated with type-checked presets.
  • Tests
    • Extensive test adjustments to match stricter types and runtime behaviors.

KodeSage avatar Sep 18 '25 14:09 KodeSage

alright, awesome I will do just that now @mabels Thank you for the review.

KodeSage avatar Sep 18 '25 15:09 KodeSage

alright, awesome I will do just that now @mabels Thank you for the review.

Hi if you have question you could contact me in our Discord im 'fast&fear<'

mabels avatar Sep 18 '25 15:09 mabels

alright, awesome I will do just that now @mabels Thank you for the review.

Hi if you have question you could contact me in our Discord im 'fast&fear<'

@mabels please can I get your discord handle have some couple of questions to ask

KodeSage avatar Sep 18 '25 21:09 KodeSage

alright, awesome I will do just that now @mabels Thank you for the review.

Hi if you have question you could contact me in our Discord im 'fast&fear<'

@mabels please can I get your discord handle have some couple of questions to ask

my discord handle is fast&fear<

mabels avatar Sep 18 '25 21:09 mabels

Walkthrough

Large, cross-cutting refactor focused on stricter typings, nullish-coalescing and readonly usage, removal of some awaits/async in helpers, and test updates. Multiple public method/type arities were narrowed or adjusted across CLI, core, gateways, protocols, dashboard, and use-fireproof.

Changes

Cohort / File(s) Summary of changes
CLI – commands & tests
cli/build-cmd.ts, cli/build-cmd.test.ts, cli/cloud-token-key-cmd.ts, cli/pre-signed-url.ts, cli/set-scripts-cmd.ts, cli/tsc-cmd.ts, cli/write-env.ts
Typing tightenings, switch from
Cloud backend – core server & dispatch
cloud/backend/base/hono-server.ts, cloud/backend/base/msg-dispatch.ts, cloud/backend/base/msg-dispatcher-impl.ts, cloud/backend/base/pre-signed-url.ts, cloud/backend/base/types.ts, cloud/backend/base/connection.test.ts, cloud/backend/base/meta-merger/meta-merger.test.ts
Narrowed WS send types; register returns this; removed forced casts in request/ws decode; unified auth flow to always await validateAuth; nullish-coalescing for defaults; DrizzleDatabase generic arity reduced; tests adjusted for null-safety and optional chaining.
Cloud backend – CF / Node
cloud/backend/cf-d1/*, cloud/backend/node/*
Removed redundant casts, tightened readonly fields, adjusted token selection (one file changed to
Core – CRDT, ledger, indexer, versioning
core/base/* (crdt-clock.ts, crdt-helpers.ts, crdt.ts, indexer*.ts, ledger.ts, version.ts)
Replace
Core – Blockstore & loader
core/blockstore/* (attachable-store.ts, loader-helpers.ts, loader.ts, store.ts, transaction.ts, commitor.ts, commitor-related tests)
Removed casts, converted some async helpers to sync (parseCarFile), commitQueue/enqueue usage changed to void for fire-and-forget, seenMeta made readonly, commit signature concrete, error handling tightened, many type adjustments in commit/loader paths and tests.
Core – Device ID
core/device-id/*
Added readonly to private fields, replaced
Core – Gateways & IndexedDB
core/gateways/*, core/gateways/indexeddb/*
Consistent Promise.resolve wrapping in some serde helpers, decode adjustments to non-async helpers, removed <unknown> generics on IDBPDatabase, tightened method param unions by removing undefined, some gateway method return type changes (less error typing).
Core – Protocols (cloud)
core/protocols/cloud/*
Simplified generic arity on bind/send/request signatures, made some helpers synchronous/Promise.resolve-based, decoding adjustments, mutex readonly, many type-tightening changes affecting message shapes.
Core – Runtime & crypto
core/runtime/*
Broadened some queue/element types, allowed sync or async IV calc/verify, removed some runtime null checks, utility signature changes (hashObjectSync/Async), various nullish-coalescing swaps.
Core – Types
core/types/*
Simplified/ narrowed several public types (CIDBlock.cid → CID, reduce generics removed in many APIs, EnDeCoder encode/decode use unknown), adjust MapFn/DocLiteral and other type unions.
use-fireproof (hooks/strategies)
use-fireproof/*, use-fireproof/react/*
Swapped type casts to non-null assertions for WebCtx, removed some return values (updateDoc now void), doc mapping without explicit casts, introduced a syntax/brace issue in use-attach token reset path.
Dashboard – backend & frontend
dashboard/backend/*, dashboard/src/**/*
Strict issuer/JWKS HTTPS requirements, createHandler db type generic arity reduced, some token/JWKS flows refactored; frontend handlers converted to block bodies, minor typing narrowings.
Tests & test harness
core/tests/**/*, cloud/*/tests/**/*, cli/*test.ts
Wide test updates to reflect tightened types: removed many as casts in favor of non-null assertions/explicit types, replaced
Config & linting
eslint.config.mjs
Switch to type-checked presets, update parserOptions and ignore patterns, add TS rule overrides (prefer-readonly).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant CLI as CLI buildCmd
  participant FS as FileSystem / fs
  participant PKG as package.json
  participant PUBLISH as publish/pnpm/deno

  Note over CLI,FS: buildCmd orchestration changes (awaits and sync helpers)
  CLI->>FS: read package.json (await)
  CLI->>PKG: buildJsrConf(pj, version)  -- now synchronous call (no await)
  CLI->>FS: copy root to npm (await fs.copy(...))
  CLI->>PUBLISH: publish steps (await where added)
  Note right of PUBLISH: Timing of jsr.json generation changed because buildJsrConf is sync and may run without await when publishing

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

  • fireproof-storage/fireproof#1058 — Overlaps CLI build/publish logic and tests touching cli/build-cmd.ts and its tests.
  • fireproof-storage/fireproof#1066 — Related changes to CLI version extraction and tests in cli/build-cmd.*.
  • fireproof-storage/fireproof#1105 — Overlapping JWT/JWKS verification and createHandler changes in dashboard/backend/create-handler.ts.

Suggested reviewers

  • mabels
  • jchris

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive The title “Feat/fix 2304 lint errors” loosely describes resolving a large number of lint issues but uses an unconventional slash between “Feat” and “fix” and embeds a raw count that may confuse readers; it is related to the changes but not phrased as a clear, concise summary of the primary effort. Consider renaming the title to clearly reflect the main change, for example “Fix lint errors across the codebase (issue #2304)” to use a consistent verb, remove the slash, and reference the issue number rather than a raw error count.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

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 and usage tips.

coderabbitai[bot] avatar Sep 26 '25 17:09 coderabbitai[bot]