Skip to content

feat(reflow): add in-memory history tracking for Flow edits#4984

Open
abdelaziz-mahdy wants to merge 2 commits intodevelopmentfrom
flow-history-dao
Open

feat(reflow): add in-memory history tracking for Flow edits#4984
abdelaziz-mahdy wants to merge 2 commits intodevelopmentfrom
flow-history-dao

Conversation

@abdelaziz-mahdy
Copy link
Copy Markdown
Collaborator

Problem

Reflow flows have no visible change history. Once a flow is saved, prior versions and property-level diffs are lost from the UI — reviewers can't see who edited a flow, when, or what fields changed.

Solution

Wrap HistoryDAO inside the flow journal so JDAO replay passes each persisted put through history on startup. Store history records in an in-memory MDAO keyed by a SequenceNumberDAO so the composite id (objectId, seqNo) stays unique across multiple edits of the same flow. Expose the history per flow via a transient DAOProperty and render it with a new FlowHistoryView.

Because history lives in memory, it rebuilds from the flows journal on every boot — no separate history journal, no unbounded growth. Live edits after boot append normally.

Changes

  • services.jrl — add flowHistoryDAO CSpec (in-memory MDAO wrapped in SequenceNumberDAO); rewire flowDAO to construct HistoryDAO(flowHistoryDAO, new MDAO(Flow)) and pass it to EasyDAO.setMdao(...) so JDAO wraps around history rather than around the bare MDAO.
  • Flow.js — add foam.mlang.Expressions to implements, import flowHistoryDAO?, add a historySection and a transient history DAOProperty that filters flowHistoryDAO by objectId and orders by seqNo desc.
  • FlowHistoryView.js — new view rendering each history record as a collapsible row: timestamp, user, summary of changed property names, and an expandable diff grid showing property | old | new with semantic colour tokens. Mixes in foam.u2.util.ClipboardAccess and adds a hover copy button per value cell.
  • pom.js — register FlowHistoryView.

Wrap HistoryDAO inside the flow journal so journal replay on startup
rebuilds per-edit history records. Add FlowHistoryView to render the
history as expandable accordion rows with colour-coded old/new diffs
and clipboard copy per value.
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