Skip to content

[codex] Extract marker detail editing workflows#456

Merged
elkimek merged 2 commits into
mainfrom
codex/extract-marker-detail-editing
May 30, 2026
Merged

[codex] Extract marker detail editing workflows#456
elkimek merged 2 commits into
mainfrom
codex/extract-marker-detail-editing

Conversation

@elkimek
Copy link
Copy Markdown
Owner

@elkimek elkimek commented May 30, 2026

Summary

  • Extract marker value editing, manual saves, per-value notes, marker notes, and reference-range mutations into marker-detail-editing.js.
  • Keep marker-detail-modal.js focused on rendering/detail modal form surfaces while re-exporting the existing inline handler API.
  • Add the new module to the service worker app shell, update source-shape tests, and bump version.js to 1.8.284.
  • Fix Greptile's insulin mirror cleanup finding by deleting the mirrored diabetes.insulin_d manualValues key when deleting hormones.insulin.

Validation

Initial extraction:

  • node --check js/marker-detail-modal.js
  • node --check js/marker-detail-editing.js
  • node tests/test-manual-entry-flow.js
  • node tests/test-marker-value-notes.js
  • node tests/test-provenance.js
  • node tests/test-multi-unit.js
  • node tests/test-audit.js
  • ./run-tests.sh

Greptile fix:

  • node --check js/marker-detail-editing.js
  • node tests/test-marker-value-notes.js
  • node tests/test-manual-entry-flow.js
  • git diff --check

@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
get-based Ready Ready Preview, Comment May 30, 2026 4:08pm

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 30, 2026

Greptile Summary

This PR refactors the marker detail editing logic out of marker-detail-modal.js into a new marker-detail-editing.js module, with marker-detail-modal.js re-exporting the full public API to keep call sites unchanged. The new module is added to the service-worker app shell and the verify-modules smoke test.

  • marker-detail-editing.js (476 lines) contains all value/note/range mutation workflows, using an injected-dependency pattern (configureMarkerDetailEditing) to avoid circular imports with the modal renderer.
  • Note-mutation functions (editValueNote, deleteValueNote) correctly handle bidirectional insulin mirroring via _insulinMirrorNoteKey; the value-mutation functions only cascade from hormones.insulin \u2192 diabetes.insulin_d and leave the reverse path unhandled.
  • editMarkerValue does not call _rememberManualOriginal for the diabetes.insulin_d mirror key the way saveManualEntry does, so the revert button is unavailable on the diabetes view after an inline edit via the hormones view.

Confidence Score: 4/5

The module split is clean and the re-export shim keeps all existing call sites intact; the main risk is in the insulin bidirectional handling inside marker-detail-editing.js.

Both value-mutation gaps (missing _rememberManualOriginal for the mirror key in editMarkerValue, and no diabetes.insulin_d to hormones.insulin cascade in save/edit/delete/revert) can leave the two insulin category views showing inconsistent data and disable the revert button on the diabetes side. Note operations already handle both directions, confirming the diabetes view is interactive, so these omissions affect real user flows.

js/marker-detail-editing.js — specifically the insulin cascade logic in editMarkerValue, saveManualEntry, deleteMarkerValue, and revertMarkerValue

Important Files Changed

Filename Overview
js/marker-detail-editing.js New module containing all value/note/range mutation workflows. Note operations correctly handle bidirectional insulin mirroring; value operations only handle the forward direction, and editMarkerValue skips _rememberManualOriginal for the mirror key.
js/marker-detail-modal.js Imports and re-exports all editing functions from marker-detail-editing.js; wires configureMarkerDetailEditing at module init.
service-worker.js Adds /js/marker-detail-editing.js to the APP_SHELL pre-cache list.
tests/verify-modules.js Adds SW smoke-test assertions for the new marker-detail-editing.js cache entry.
tests/test-manual-entry-flow.js Updated to read from marker-detail-editing.js; coverage is thorough for the happy paths tested.
version.js Patch bump to 1.8.284 to bust the service-worker cache.

Sequence Diagram

sequenceDiagram
    participant UI as Category UI
    participant MDE as marker-detail-editing.js
    participant MDM as marker-detail-modal.js
    participant State as state.importedData

    UI->>MDM: onclick handler (e.g. saveManualEntry)
    MDM->>MDE: re-exported call
    MDE->>State: write entry.markers[dotKey]
    alt "dotKey === 'hormones.insulin'"
        MDE->>State: mirror write to entry.markers['diabetes.insulin_d']
        MDE->>State: mirror manualValues['diabetes.insulin_d:date']
        MDE->>State: recalculateHOMAIR
    end
    Note over MDE,State: No reverse path implemented
    MDE->>MDM: configureMarkerDetailEditing callback
    MDM->>UI: showDetailModal / navigate
Loading

Reviews (2): Last reviewed commit: "Fix insulin manual mirror cleanup" | Re-trigger Greptile

Comment thread js/marker-detail-editing.js
@elkimek elkimek merged commit 48adcaa into main May 30, 2026
5 checks passed
@elkimek elkimek deleted the codex/extract-marker-detail-editing branch May 30, 2026 16:12
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