Skip to content

Complete History Design

Ed Mozley edited this page Nov 24, 2026 · 1 revision

Complete history for tasks and tickets - design (#430)

Status: design, waiting for @Dr4inder to confirm before anything is built. Proposed 24 November 2026. Questions for him are in section 9; decisions taken with Ed are in section 8.

The request, from @Dr4inder on issue #430:

"A task's History does not show that a comment was added or its description changed... Please extend the existing History/Audit views with concise activity entries, preserving the separate Comments/Notes and Time sections for their full contents."

The report lists exactly what is missing, checked against the code, with acceptance criteria. This design takes it as written and adds one structural fix it points towards.

In plain words

  • A task gets a History button that opens a full timeline of everything that happened to it, newest first, with a filter to narrow it to one kind of change (Status, Description, Comments, Time...). It replaces the History section at the bottom of the task window, which would get very long once everything is recorded. Tickets already work this way (the Audit button); both will use the same timeline, so they look and behave alike.
  • What was missing gets recorded: task comments, task title / description / priority / effort / tags / link changes, task and ticket time entries, ticket notes.
  • Comments, notes and time entries are read into the timeline, not copied. They already have a time and an author, so every existing task and ticket gets its complete history straight away - nothing is backfilled, nothing is duplicated - and each entry links to the original, which keeps internal and shared visibility exactly as it is.
  • Everything is recorded on the server, in the same save as the change itself. For tickets this means moving most of today's audit writing out of the browser, which is the biggest piece of work here and the one that makes the history trustworthy.

1. What is there today

Tasks Tickets
Where it is shown A History section in the task window (TaskHistory::forTask(), api/tasks/history.php) An Audit button that opens a modal (showAuditHistory() in assets/js/inbox.js, api/tickets/get_ticket_audit.php)
Stored in task_events - event type, actor (analyst / API / workflow / system), from / to, detail_json ticket_audit - field name, old / new value, analyst
Recorded now status, completion, reopening, start / due dates, assignment, checklists, forms, procedures, follow-ups, recurring runs (#181) subject and most classification / assignment fields
How ticket audits are written - From the browser: after its own save, the inbox sends each changed field to api/tickets/log_ticket_audit.php as a separate request. The REST API writes them on the server instead.

The last row matters. A change saved from the inbox is audited only if the browser gets as far as the second request: close the tab, lose the connection, or have a script error in between, and the change is saved with no audit row. The same change made through the API or a workflow takes a different path again. That is exactly what the request's "use the common server-side write paths... a successful audited change and its record should be saved together" asks to put right.

2. The timeline

One component, used by tasks and tickets alike: a modal, newest first, opened from a History button (tasks) or the existing Audit button (tickets).

Each entry is one line:

  • What happened, in words - "Priority: Normal β†’ High", "added a comment", "logged 1 h 30 m for 23 Nov", "Description changed Β· View"
  • Who - the person, or API: <key name>, Workflow: <name>, System
  • When it happened - and for a time entry, its work date shown separately from when it was logged, since work is often logged afterwards

Above the list, a filter built from what is actually in this record's history - All Β· Status Β· Assignment Β· Description Β· Comments Β· Time Β· ... - so it never offers an empty choice. Picking one narrows the list to it; that is how you home in on "everything that happened to the due date".

3. Read in, not copied: comments, notes, time entries

These already live in their own tables with a time and an author:

Source Becomes Links to
task_comments "Ed added a comment" the comment, in the task's Comments
ticket_notes "Ed added an internal note" / "...a shared note" the note in the ticket
task_time_entries, ticket_time_entries (active ones) "Ed logged 1 h 30 m for 23 Nov" the entry in Time

The history reader merges them in when it builds the timeline, alongside the stored events. So:

  • Every existing record is complete immediately. No backfill, no invented events, the original timestamps (the request's acceptance point 5).
  • No duplicates. The comment is stored once; the timeline only points at it.
  • Visibility is automatic. The entry is a link to the real note, which shows (or not) under the rules it already has. The timeline line itself names the note's kind but never shows its text - the full content stays in Comments / Notes and Time, as the request asks.

What reading cannot give: removals and edits. A deleted time entry is gone from the active list, and an edited one only has its new value. So those two are recorded when they happen (section 4).

4. Recorded when they happen

All written by the service that makes the change, in the same database transaction, so the change and its record succeed or fail together - and an unchanged save writes nothing.

Tasks - in TasksService::updateTask() and the comment / time services, as task_events rows:

Change Entry Old / new
Title, priority, estimated effort, tags "Priority: Normal β†’ High" both values
Ticket / change / contract / parent link "Linked to change #312" / "Unlinked from..." the reference
Scheduled work time "Scheduled: 25 Nov 09:00 β†’ 26 Nov 14:00" both values
Description "Description changed Β· View" a full copy of each version, compared on demand (below)
Comment edited / deleted (where the screen allows it) "edited a comment" / "deleted a comment" -
Time entry edited "changed time logged for 23 Nov: 1 h β†’ 1 h 30 m" duration, work date
Time entry removed "removed 1 h 30 m logged for 23 Nov" duration, work date, entry reference

The description is HTML and can be long, so it is not squeezed into an old / new column (the request: "do not silently truncate the evidence"). Each edit keeps the whole text as a revision; the timeline line has a View button that opens a before / after comparison. Changes already do exactly this for their long text fields (ChangeRevisions, change_text_revisions, the compare viewer) - tasks reuse that pattern rather than inventing a second one. Only descriptions edited after this ships have a "before": earlier versions were never kept, and none will be invented (acceptance point 5).

Tickets - in TicketsService:

Change Entry
Every field the inbox audits today (department, status, owner, team, type, priority, category...) as today - but written by the service, in the save, not by the browser afterwards
Time entry edited / removed as for tasks
Note added read in (section 3) - no extra row

Moving ticket auditing into the service means the inbox, the REST API and workflows all record the same thing the same way. log_ticket_audit.php then has nothing left to do and can be retired.

5. Who did it

Every entry says who: an analyst by name, or API with the key's name, Workflow with the workflow's name, or System. Tasks already store this (actor_kind, actor_name); ticket audit rows written by the service gain the same, so a workflow's change no longer reads as if a person made it.

6. What stays as it is

  • Existing history rows are kept and shown unchanged.
  • Comments / Notes and Time keep their full contents; the timeline only points at them.
  • Notifications and workflows are not changed.
  • Viewing, typing, panel layout and other non-changes are not recorded.

7. Not in this design

  • Participants and documents (the request's suggested additions). Worth adding the same way afterwards - attach / detach and participant add / remove as recorded events - but kept out so the confirmed gaps ship first.
  • Old description versions - never kept, so never shown.
  • Problems, changes, assets - changes already have their own full history; the others can use the same timeline component later.

8. Decisions

  • 24 November 2026 (Ed): a History button with a filterable timeline modal, rather than a longer section in the task window. Tasks and tickets share the component.
  • 24 November 2026 (Ed): comments, notes and time entries are read into the timeline, not copied into the history tables.
  • 24 November 2026 (Ed): ticket auditing moves into the service, so every path records the same way in the same save.

9. Questions for @Dr4inder

  1. Does the timeline as described (section 2) - one line per event, a filter, links to the original comment / note / time entry - give a reviewer what they need, or is there a view you would expect that this misses?
  2. For the task window: is replacing the inline History section with a History button right for the way you use it, or do you rely on seeing recent history without opening anything?
  3. Time entries: is edit and remove (with the duration change and work date) the right granularity, or do you also need the note text of a time entry in the history?
  4. Is moving ticket auditing to the server (section 4) the fix you had in mind for "saved together"?

10. Build order

  1. The timeline: the shared modal with its filter; the History button on tasks; comments and time entries read into task history; notes and time entries read into ticket Audit. Visible at once, for every existing record.
  2. Tasks recorded on the server: field changes, links, description revisions with the compare view, time-entry edit / remove.
  3. Tickets recorded on the server: auditing moved into TicketsService; time-entry edit / remove; log_ticket_audit.php retired.

Each step ships with tests through the shared write paths (UI, API and workflow give the same history), including: one entry per real change, nothing for an unchanged save, nothing for a failed one, and visibility of internal notes respected.

FreeITSM

Getting Started

Modules

Multi-tenancy (planned)

Responses to feedback

Blue sky thinking

Bugs resolved

Pull requests

Links

Clone this wiki locally