Task: Grow HistoryDialogBase and migrate the six hand-rolled dialogs

Table of Contents

This page documents a task in the Consolidate history dialogs onto HistoryDialogBase story. It captures the goal, current status, acceptance, and any notes or results.

Goal

Move the duplicated history-dialog machinery into HistoryDialogBase (interim form) and migrate the six dialogs that hand-roll field diffs, eliminating the four competing idioms — the free function, per-call lambdas, the CHECK_DIFF_STRING macro, and inline if-blocks (including the anonymous-namespace alias pattern that broke GCC/AppleClang).

Status

Field Value
State DONE
Parent story Consolidate history dialogs onto HistoryDialogBase
Now Nothing.
Waiting on Nothing.
Next Nothing.
Last touched 2026-06-05

Acceptance

  • The six dialogs derive from HistoryDialogBase and implement only calculateDiff plus entity-specific labels.
  • No diff idiom remains outside the base helpers.
  • Full build green on GCC and Clang; behaviour visually unchanged.

Plan

  1. Base gains: DiffResult (ordered (field, (old, new)) rows); checkString / checkInt / checkBool formatting helpers; the changes-tab rendering flow calling an abstract calculateDiff(current, previous) template method; version-list population, QFutureWatcher async-load plumbing, and stale handling (an intermediate templated CRTP helper if the version types resist a common interface).
  2. Migrate dialog by dialog, one commit each: Account, SystemSetting, ChangeReason, ChangeReasonCategory, Country, Currency.
  3. Behaviour must be identical before/after; this phase is codegen-free.

Notes

  • Scope expanded by Marco during implementation: migrate all history dialogs with the same pattern, not just the six hand-rolled ones — first hand-crafted, then the generated family. Final tally: 6 hand-rolled + 58 generated-pattern dialogs (including the ZeroConvention exemplar and the original Workspace adopter) are on the base; 64 in total.
  • VersionRow became {version, ordered cell list} because version lists vary per dialog (3–6 columns: change reason, commentary, performed by, enabled).
  • Revert semantics were unified (Marco's decision): Revert restores the selected version as a new current version, after confirmation, and is disabled on the latest version. Previously the hand-rolled family reverted to the version older than the selection and the generated family reverted to the selection without confirmation. Recorded in the UX language knowledge doc.
  • The three event-log "history" screens are not version histories, so they stay off the base — instead they were renamed to Audit (Marco's decision) so history retains a single meaning in the codebase: SessionAuditDialog (login-session telemetry), PublicationAuditDialog (dataset publication log), JobDefinitionAuditDialog (job execution run log). User-visible titles, menu options and tooltips renamed alike; the distinction is recorded in the UX language doc ("History vs Audit").
  • Pre-existing AppVersion diff mislabelling preserved verbatim and captured separately: AppVersionHistoryDialog diff rows mislabelled.

PRs

PR Title
1080 Migrate all history dialogs onto HistoryDialogBase; rename event-log dialogs to Audit

Review

# Comment summary File Decision Notes
1 unique_ptr with forward-declared Ui needs out-of-line dtor (×4: Account, SystemSetting hpp+cpp) admin history dialogs Accepted Premise was wrong (headers included ui_*.h; build was green) but the forward-decl pattern is better; applied to all six hand-rolled dialogs in f09464d20
2 Wrap toolbar action names and tooltips in tr() HistoryDialogBase.cpp Accepted 282f9c518
3 Wrap load-failure error strings in tr() HistoryDialogBase.cpp Accepted 282f9c518
4 Wrap changes-table placeholders in tr() HistoryDialogBase.cpp Accepted 282f9c518
5 Wrap revert confirmation in tr() HistoryDialogBase.cpp Accepted 282f9c518
6 Wrap Yes/No boolean diff values in tr() HistoryDialogBase.cpp Accepted 282f9c518
7 Task doc must include * Review section task_grow-history-dialog-base.org Declined Section already present with the standard table; comment anchored on the adjacent empty PRs table

Result

Merged in PR 1080. HistoryDialogBase owns the full shared pipeline (toolbar, version list via ordered-cells VersionRow, changes-tab diff flow with placeholders, optional-aware diff helpers, async request plumbing, watcher cleanup). All 64 version-history dialogs migrated — the six hand-rolled diff dialogs plus the 58 generated-pattern ones — for a net reduction of ~10,600 lines. Revert semantics unified to revert-to-selected with confirmation; the three event-log screens renamed to Audit (Session, Publication, JobDefinition) with the History-vs-Audit distinction recorded in the UX language doc. One review round: six tr()/destructor-pattern fixes accepted, one declined with evidence.

Emacs 29.3 (Org mode 9.6.15)