Records integrity: history, nightly backup and check, records package

AC 120-78B chapter 3:
- Every change to logbook entries, sub-components, signatures, inspection
  records, AD compliance, major records, W&B, components, squawks and
  documents is kept as a RecordVersion (who, IP, when, field changes),
  hash-chained per aircraft; versions can't be edited or deleted. Shown on
  each logbook entry and in Activity -> Record history
- Nightly job: SQLite online-backup copy to storage/backups, verified
  (integrity_check + record counts), pruned to the configured number; then
  an integrity check of the history chains and every signature's seal and
  fingerprint. Results on Admin -> About ("Back up and check now"); admins
  are emailed on failure
- Software versions recorded (first/last seen) on Admin -> About
- Records package (Access & Sharing): logbook entries PDF with signatures,
  signatures.csv, record-history.csv, self-contained status report HTML,
  the .sam.zip, and a README, for the FAA/NTSB or a buyer
- Legacy (paper) records: documents can be marked as legacy records;
  aircraft have an "electronic records since" date (status report, package)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-07 13:21:26 -05:00
1 parent d719f663bc
commit 68a1719db2
53 files changed
+750 -12

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
<%# Locals: versions. %>
<ul class="divide-y divide-slate-100 text-sm">
<% versions.each do |v| %>
<li class="px-4 py-2">
<div class="flex flex-wrap items-baseline justify-between gap-2">
<span><span class="font-medium"><%= v.item_type.underscore.humanize %> #<%= v.item_id %></span>
<span class="<%= { 'create' => 'badge-green', 'update' => 'badge-blue', 'destroy' => 'badge-red' }[v.event] %> ml-1"><%= { "create" => "created", "update" => "changed", "destroy" => "deleted" }[v.event] %></span></span>
<span class="text-xs text-slate-500"><%= v.created_at.utc.strftime("%Y-%m-%d %H:%M:%S UTC") %> · <%= v.user&.display_name || "system" %><%= " · #{v.ip_address}" if v.ip_address %></span>
</div>
<% if v.event == "update" %>
<dl class="mt-1 grid gap-x-3 text-xs text-slate-600 sm:grid-cols-[10rem_1fr]">
<% v.changes_hash.each do |field, (before, after)| %>
<dt class="text-slate-500"><%= field.humanize %></dt><dd class="break-words"><span class="line-through decoration-slate-400"><%= before.to_s.truncate(120).presence || "—" %></span> → <%= after.to_s.truncate(120).presence || "—" %></dd>
<% end %>
</dl>
<% end %>
</li>
<% end %>
</ul>
+14
View File
@@ -0,0 +1,14 @@
<% content_for :title, "#{@aircraft.tail_number} Record history" %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<section class="card">
<div class="card-header">
<div>
<h2 class="card-title">Record history</h2>
<p class="text-xs text-slate-500">Every change to the maintenance records, kept for good and chained so that removing or altering history shows in the nightly check.</p>
</div>
<%= form_with url: aircraft_record_versions_path(@aircraft), method: :get, class: "flex gap-2" do %>
<%= select_tag :type, options_for_select([ [ "All records", "" ] ] + @types.map { [ _1.underscore.humanize, _1 ] }, @type), class: "input w-48", data: { submit_on_change: true } %>
<% end %>
</div>
<% if @versions.any? %><%= render "record_versions/list", versions: @versions %><% else %><%= empty_state "No changes recorded yet." %><% end %>
</section>