Skip to content

task-026: Shrink monitor property dual-map in bun-sqlite-store - #26

Merged
Igloczek merged 1 commit into
masterfrom
task/026-redbean-simplify-monitor-mapping
Jun 30, 2026
Merged

Igloczek merged 1 commit into
masterfrom
task/026-redbean-simplify-monitor-mapping

Conversation

@Igloczek

@Igloczek Igloczek commented Jun 30, 2026 •

Copy link
Copy Markdown
Collaborator

Implements tasks/026-redbean-simplify-monitor-mapping.md from the ponytail audit backlog.

Goal

Reduce camelCase↔snake_case translation complexity in bun-sqlite-store.ts without breaking the API.

Scope

  • Audit which monitor fields still need dual-property mapping vs can use one convention end-to-end.
  • Shrink MONITOR_* maps and normalizeMonitorRow / normalizeRowForStore (target ≥30% LOC reduction in mapping code).
  • Prefer snake_case in DB reads; convert at API boundary only if frontend still expects camelCase.
  • Add or extend backend tests for monitor CRUD round-trip.

Acceptance criteria

  • Monitor create/update/read via socket API returns the same field names as before (contract test or e2e).
  • Mapping block in bun-sqlite-store.ts measurably smaller (document before/after line count in PR).
  • bun run test:backend passes.
  • bun run test-e2e passes monitor edit flow.

Depends on

Task 025.

Verification

bun run test:backend
bun run test-e2e
wc -l src/server/bun-sqlite-store.ts

Audit reference

Finding #1 — RedBean monitor dual-map (phase 3).

@Igloczek

Copy link
Copy Markdown
Collaborator Author

/ponytail-review

Mapping block 181 → 67 LOC (−63%). Metadata derived from column types instead of hand-written dual-map.

Lean already. Ship.

3 files changed, 161 insertions(+), 140 deletions(-)

Move monitor camelCase↔snake_case mapping to column-metadata.ts as a
single source of truth derived from monitorColumnTypes. Shrink the
bun-sqlite-store mapping block (~181 → ~67 LOC, 63% reduction) with a
shared resolveMonitorField helper. Add monitor CRUD round-trip backend
test for socket API field contract.
@Igloczek
Igloczek force-pushed the task/026-redbean-simplify-monitor-mapping branch from 43bb5a0 to 262a2bc Compare June 30, 2026 12:01
@Igloczek
Igloczek merged commit 00a4e1c into master Jun 30, 2026
1 check passed
Igloczek added a commit that referenced this pull request Jun 30, 2026
Merge duplicated getResBaseURL() and getDevApiBaseURL() logic into a
single cached helper in src/util/dev-base-url.ts. Update consumers to
import the canonical function and reduce dev-api-base.ts to re-exports.

Task 019 — audit finding #26.
@Igloczek
Igloczek deleted the task/026-redbean-simplify-monitor-mapping branch June 30, 2026 12:58
Igloczek added a commit that referenced this pull request Aug 8, 2026
…r-mapping

task-026: Shrink monitor property dual-map in bun-sqlite-store
Igloczek added a commit that referenced this pull request Aug 8, 2026
Merge duplicated getResBaseURL() and getDevApiBaseURL() logic into a
single cached helper in src/util/dev-base-url.ts. Update consumers to
import the canonical function and reduce dev-api-base.ts to re-exports.

Task 019 — audit finding #26.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant