From 8c8e3b73747bb81922ccf98db6d590324ebe075c Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Wed, 11 Nov 2026 21:03:31 -0500 Subject: [PATCH] Versions: year.month.release (VERSION) plus build (commit); What's new from CHANGELOG.md Shown on Admin -> About, in the software history, records package, procedures and sam:doctor; release notes in the app under Help. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 38 +++++++++++++++++++ README.md | 4 ++ VERSION | 1 + app/models/app_revision.rb | 1 + app/models/help_guide.rb | 4 +- app/models/system_info.rb | 11 +++++- app/services/records_audit.rb | 2 +- app/services/records_package.rb | 4 +- app/services/system_doctor.rb | 2 +- app/views/admin/about/show.html.erb | 10 ++--- app/views/admin/procedures/_document.html.erb | 4 +- config/brakeman.ignore | 6 +-- ...1111030000_add_version_to_app_revisions.rb | 6 +++ db/schema.rb | 3 +- docs/guide/administration.md | 2 +- test/integration/versioning_test.rb | 31 +++++++++++++++ 16 files changed, 110 insertions(+), 19 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 VERSION create mode 100644 db/migrate/20261111030000_add_version_to_app_revisions.rb create mode 100644 test/integration/versioning_test.rb diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2612933 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,38 @@ +# What's new + +Each release has a **version** (year.month.release, e.g. 2026.11.0) and a **build** (the exact source commit, shown on Admin → About). The newest release is first. + +## 2026.11.0 + +The first numbered release. Highlights of what Simple Aircraft Manager does as of this version: + +### Records and signatures (AC 120-78B) + +- Electronic signatures on logbook entries: the signer picks their certificate, re-enters their password (and authenticator code) or signs in again, and certifies a statement. Signed entries are locked; mistakes are fixed with a signed correction. +- Outside mechanics can sign an entry from an emailed, one-time invitation. +- Every change to the maintenance records is kept, hash-chained and checked nightly, including ADs and inspection types applied to or removed from an aircraft (a removed one can be restored). +- Nightly verified database backup, optional off-site copy to Google Drive, and a restore test. +- Recordkeeping procedures document (with suggested text) and periodic records audits. +- Records package for the FAA or a buyer: entries with signatures, history, status report, procedures and the data archive, with a ready-to-run viewer. + +### Maintenance tracking + +- Airworthiness status from ADs, inspections, squawks, components and documents, with Part 91 rules (annual as 100-hour, overruns, IFR and transponder limits). +- ADs: FAA DRS import with an AD baseline per model, and a weekly search for newly published ADs covering the aircraft, engine, propeller and every installed component. +- Logbook: templates, engine and propeller times, sub-components (a new entry can also record them serviced or replaced), printable entries for the paper logbook, and AI transcription of scanned pages. +- Calendar feed of everything coming due, with dates projected from recent flying for hour-based items. +- Weight and balance with a loading calculator (CG envelope in inches or lb-in/1000). + +### Flying + +- Flight log grouped by day with the route and totals; long logs load as you scroll. +- Engine monitor data charts, GPS tracks, AirTrail sync, spreadsheet import, and oil and fuel trends. + +### Accounts and security + +- Single sign-on (OpenID Connect), sign-in links, account lockout, breached-password check and optional authenticator codes. +- Command-line account recovery and maintenance commands (health report, records check, restore). + +### Help + +- A user guide for every area, in the app under Help. diff --git a/README.md b/README.md index 9af8776..8d70291 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,10 @@ The port aims to be **easy to host**. It runs as one process with one SQLite dat - Authentication uses the Rails 8 built-in generator (sessions plus password reset), emailed sign-in links, and optional OpenID Connect single sign-on (OmniAuth). - Prawn renders the printable logbook entries; Commonmarker renders Markdown notes and the user guide. +## Versions + +Releases are numbered **year.month.release** (`2026.11.0`, `2026.11.1`, … restarting each month) in [`VERSION`](VERSION), and identified exactly by the **build**: the commit they were built from. Both show on Admin → About; [`CHANGELOG.md`](CHANGELOG.md) has the release notes (in the app: Help → What's new). Each release is tagged `v` in git and on Docker Hub. + ## User guide The [user guide](docs/guide/README.md) explains how to use the app, for pilots, owners, mechanics and admins. The same pages are shown in the app under **Help**. diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..d6484a6 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +2026.11.0 diff --git a/app/models/app_revision.rb b/app/models/app_revision.rb index 357b4df..df42530 100644 --- a/app/models/app_revision.rb +++ b/app/models/app_revision.rb @@ -10,6 +10,7 @@ class AppRevision < ApplicationRecord record = find_or_initialize_by(revision: revision) record.first_seen_at ||= now record.built_at ||= SystemInfo.new.built_at + record.version ||= SystemInfo.new.version record.last_seen_at = now record.save! rescue ActiveRecord::ActiveRecordError => e diff --git a/app/models/help_guide.rb b/app/models/help_guide.rb index 31ef44f..b19a81b 100644 --- a/app/models/help_guide.rb +++ b/app/models/help_guide.rb @@ -3,7 +3,7 @@ class HelpGuide DIR = Rails.root.join("docs/guide") ORDER = %w[README getting-started profile aircraft flights squawks oil-and-fuel components logbook records - inspections ads documents major-records sharing administration].freeze + inspections ads documents major-records sharing administration changelog].freeze OPTIONS = { parse: { smart: true }, render: { hardbreaks: false, unsafe: false }, @@ -18,7 +18,7 @@ class HelpGuide def self.find(slug) return unless ORDER.include?(slug.to_s) - path = DIR.join("#{slug}.md") + path = slug.to_s == "changelog" ? Rails.root.join("CHANGELOG.md") : DIR.join("#{slug}.md") return unless path.file? markdown = path.read Page.new(slug: slug.to_s, title: markdown[/\A# (.+)$/, 1] || slug.to_s.titleize, markdown: markdown) diff --git a/app/models/system_info.rb b/app/models/system_info.rb index 262acd0..d8f57c7 100644 --- a/app/models/system_info.rb +++ b/app/models/system_info.rb @@ -12,7 +12,16 @@ class SystemInfo DATABASES = { "Main" => :primary, "Cache" => :cache, "Jobs" => :queue, "Cable" => :cable }.freeze - # Set by the Docker build (see Dockerfile); in development, read from git. + # The release version, YYYY.MM.N (the repository's VERSION file). + def version + @version ||= Rails.root.join("VERSION").then { _1.exist? ? _1.read.strip.presence : nil } || "unreleased" + end + + # "2026.11.0 (build 87e3094)" + def version_label = "#{version} (build #{revision})" + + # The build: the commit it was made from. Set by the Docker build (see + # Dockerfile); in development, read from git. def revision @revision ||= ENV["APP_REVISION"].presence || (Rails.root.join(".git").exist? && `git -C #{Rails.root} rev-parse --short HEAD 2>/dev/null`.strip.presence) || diff --git a/app/services/records_audit.rb b/app/services/records_audit.rb index 8391948..14fc3a4 100644 --- a/app/services/records_audit.rb +++ b/app/services/records_audit.rb @@ -38,7 +38,7 @@ class RecordsAudit Item.new("certificates", "No active user is relying on an expired certificate", true, true, expired.any? ? "Expired (can't sign until renewed): #{expired.map { "#{_1.user.display_name} #{_1.short_label}" }.join(', ')}" : "None expired"), Item.new("versions", "Software versions since the last audit", true, true, - versions_since.map(&:revision).join(", ").presence || "No changes") + versions_since.map { [ _1.version, "build #{_1.revision}" ].compact.join(" ") }.join(", ").presence || "No changes") ] end diff --git a/app/services/records_package.rb b/app/services/records_package.rb index 682a882..22b79f5 100644 --- a/app/services/records_package.rb +++ b/app/services/records_package.rb @@ -51,7 +51,7 @@ class RecordsPackage check = IntegrityCheck.latest <<~TXT Maintenance records for #{@aircraft.tail_number} (#{[ @aircraft.make, @aircraft.model ].compact_blank.join(' ')}, S/N #{@aircraft.serial_number.presence || 'not recorded'}) - Prepared #{@generated_at.utc.strftime('%Y-%m-%d %H:%M UTC')} by Simple Aircraft Manager (#{@source}), software version #{SystemInfo.new.revision}. + Prepared #{@generated_at.utc.strftime('%Y-%m-%d %H:%M UTC')} by Simple Aircraft Manager (#{@source}), software version #{SystemInfo.new.version_label}. Electronic records since: #{@aircraft.electronic_records_since&.iso8601 || 'not stated'}. Earlier records are the paper logbooks#{' (scans marked "legacy record" are in the archive)' if @aircraft.documents.where(legacy_record: true).exists?}. @@ -106,7 +106,7 @@ class RecordsPackage # Simple Aircraft Manager on your own computer, to browse #{@aircraft.tail_number.downcase}.sam.zip. # docker compose up -d then open http://localhost:3000, create an account, # and import #{@aircraft.tail_number.downcase}.sam.zip (Fleet -> Import). Stop: docker compose down - # Prepared with software version #{SystemInfo.new.revision}.#{" Source: #{repository}" if repository} + # Prepared with software version #{SystemInfo.new.version_label}.#{" Source: #{repository}" if repository} services: web: #{image ? "image: #{image}" : "build: . # no published image known: build from the source code"} diff --git a/app/services/system_doctor.rb b/app/services/system_doctor.rb index 8a2d0b8..e0e0967 100644 --- a/app/services/system_doctor.rb +++ b/app/services/system_doctor.rb @@ -16,7 +16,7 @@ class SystemDoctor doctor = new list = doctor.checks lines = list.map { |c| "#{{ ok: ' ok ', warn: ' WARN', fail: ' FAIL' }[c.status]} #{c.name.ljust(22)} #{c.detail}" } - [ "Simple Aircraft Manager #{SystemInfo.new.revision} (#{Rails.env})", *lines ].join("\n").then { [ _1, list ] } + [ "Simple Aircraft Manager #{SystemInfo.new.version_label} (#{Rails.env})", *lines ].join("\n").then { [ _1, list ] } end private diff --git a/app/views/admin/about/show.html.erb b/app/views/admin/about/show.html.erb index f0d25be..d895ce4 100644 --- a/app/views/admin/about/show.html.erb +++ b/app/views/admin/about/show.html.erb @@ -8,10 +8,10 @@

Version

-

- <%= info.revision_url ? link_to(info.revision, info.revision_url, class: "link", target: "_blank", rel: "noopener", title: "This commit on GitHub") : info.revision %> -

- <% if info.repository_url %>

<%= link_to "Source code", info.repository_url, class: "link", target: "_blank", rel: "noopener" %>

<% end %> +

<%= info.version %>

+

Build + <%= info.revision_url ? link_to(info.revision, info.revision_url, class: "link font-mono", target: "_blank", rel: "noopener", title: "This commit on GitHub") : tag.span(info.revision, class: "font-mono") %>

+

<%= link_to "What's new", help_page_path("changelog"), class: "link" %><% if info.repository_url %><%= link_to "Source code", info.repository_url, class: "link", target: "_blank", rel: "noopener" %><% end %>

Built
<%= info.built_at ? l(info.built_at.in_time_zone, format: :short) : "—" %>
@@ -108,7 +108,7 @@

Software versions

<% revisions = AppRevision.latest_first.limit(20) %> <% if revisions.any? %> - <%= render "pairs", pairs: revisions.map { |r| [ r.revision, "#{l(r.first_seen_at, format: :short)} – #{l(r.last_seen_at, format: :short)}" ] } %> + <%= render "pairs", pairs: revisions.map { |r| [ [ r.version, "build #{r.revision}" ].compact.join(" · "), "#{l(r.first_seen_at, format: :short)} – #{l(r.last_seen_at, format: :short)}" ] } %> <% else %> <%= empty_state "No versions recorded yet." %> <% end %> diff --git a/app/views/admin/procedures/_document.html.erb b/app/views/admin/procedures/_document.html.erb index 55225c8..afc5754 100644 --- a/app/views/admin/procedures/_document.html.erb +++ b/app/views/admin/procedures/_document.html.erb @@ -31,7 +31,7 @@

3. System description

    -
  • Software: Simple Aircraft Manager, version <%= info.revision %> (Ruby <%= RUBY_VERSION %>, Rails <%= Rails.version %>, SQLite <%= SQLite3::SQLITE_VERSION %>).
  • +
  • Software: Simple Aircraft Manager, version <%= info.version_label %> (Ruby <%= RUBY_VERSION %>, Rails <%= Rails.version %>, SQLite <%= SQLite3::SQLITE_VERSION %>).
  • Hosting and network: <% if policy.hosting_description.present? %>
    <%= markdown(policy.hosting_description) %>
    <% else %>[describe the server, location and network]<% end %>

    <%= ProceduresTemplates.https? ? "Connections use HTTPS only: the system redirects plain HTTP and marks its cookies secure." : "The system is set not to enforce HTTPS itself (FORCE_SSL=false); how connections are protected is described above." %> <%= ProceduresTemplates.sign_in_sentence %>

  • @@ -78,7 +78,7 @@
  • Confidential information (3.2.3): records are visible only to the aircraft's users, and to share links an owner creates (scoped and optionally expiring).
  • Data corruption (3.2.4): nightly, the history chains and every signature's seal and fingerprint are checked; administrators are emailed on any problem.
  • Outages (3.2.5): entries are made on paper and signed in ink during an outage (section 13); the database is restored from the latest verified copy or the off-site backup.
  • -
  • Software revision control (3.2.6): the software is updated by deploying a new version built from its source repository; each version and when it ran is recorded by the system. Before an update that changes how records are entered, displayed or accessed, the responsible person reviews it, and these procedures are revised if they're affected.
  • +
  • Software revision control (3.2.6): the software is updated by deploying a new release built from its source repository. Each release has a version (year.month.release, e.g. 2026.11.0) and a build (the exact source commit), with release notes describing what changed (What's new); each version and when it ran is recorded by the system. Before an update that changes how records are entered, displayed or accessed, the responsible person reviews it, and these procedures are revised if they're affected.
  • Backups (3.2.7): see section 3.
diff --git a/config/brakeman.ignore b/config/brakeman.ignore index 50903ab..f313735 100644 --- a/config/brakeman.ignore +++ b/config/brakeman.ignore @@ -37,13 +37,13 @@ { "warning_type": "Cross-Site Scripting", "warning_code": 4, - "fingerprint": "85f8003e1ad00eeb2308faea3dd89e55db1b7a794b9c1a8b05c16466849038ac", + "fingerprint": "8a1a5b9527b7a486b508cfeedb365ccb784d3a0736e794ef2b9a81d95a2b669c", "check_name": "LinkToHref", "message": "Potentially unsafe model attribute in `link_to` href", "file": "app/views/admin/about/show.html.erb", - "line": 12, + "line": 13, "link": "https://brakemanscanner.org/docs/warning_types/link_to_href", - "code": "link_to(SystemInfo.new.revision, SystemInfo.new.revision_url, :class => \"link\", :target => \"_blank\", :rel => \"noopener\", :title => \"This commit on GitHub\")", + "code": "link_to(SystemInfo.new.revision, SystemInfo.new.revision_url, :class => \"link font-mono\", :target => \"_blank\", :rel => \"noopener\", :title => \"This commit on GitHub\")", "render_path": [ { "type": "controller", diff --git a/db/migrate/20261111030000_add_version_to_app_revisions.rb b/db/migrate/20261111030000_add_version_to_app_revisions.rb new file mode 100644 index 0000000..18b03e8 --- /dev/null +++ b/db/migrate/20261111030000_add_version_to_app_revisions.rb @@ -0,0 +1,6 @@ +class AddVersionToAppRevisions < ActiveRecord::Migration[8.1] + def change + # The release version (YYYY.MM.N) that build was, next to its commit. + add_column :app_revisions, :version, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 6cfb345..e9450a8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.1].define(version: 2026_11_11_020000) do +ActiveRecord::Schema[8.1].define(version: 2026_11_11_030000) do create_table "active_storage_attachments", force: :cascade do |t| t.string "name", null: false t.string "record_type", null: false @@ -293,6 +293,7 @@ ActiveRecord::Schema[8.1].define(version: 2026_11_11_020000) do t.datetime "built_at" t.datetime "first_seen_at", null: false t.datetime "last_seen_at", null: false + t.string "version" t.index ["revision"], name: "index_app_revisions_on_revision", unique: true end diff --git a/docs/guide/administration.md b/docs/guide/administration.md index d71a98d..57da0b9 100644 --- a/docs/guide/administration.md +++ b/docs/guide/administration.md @@ -46,7 +46,7 @@ If single sign-on is broken and `PASSWORD_LOGIN=false` is set, remove that setti ## About -**About** shows the running version, features and storage, and has tools: +**About** shows the running version (year.month.release, e.g. 2026.11.0) and build (the exact source commit), with a link to **What's new** (the release notes, also under Help), and the features and storage. It has tools: - **Send test email** and **Send me this week's reminder** check that email works. - **Records integrity**: the last nightly backup, off-site copy and records check. **Back up and check now** runs the backup and check straight away. diff --git a/test/integration/versioning_test.rb b/test/integration/versioning_test.rb new file mode 100644 index 0000000..e8b6cf1 --- /dev/null +++ b/test/integration/versioning_test.rb @@ -0,0 +1,31 @@ +require "test_helper" + +# Releases: version (YYYY.MM.N, from VERSION) plus build (the commit), and +# release notes (CHANGELOG.md) as "What's new". +class VersioningTest < ActionDispatch::IntegrationTest + test "the version comes from VERSION; About shows version, build and What's new" do + version = File.read(Rails.root.join("VERSION")).strip + assert_match(/\A\d{4}\.\d{1,2}\.\d+\z/, version) + info = SystemInfo.new + assert_equal version, info.version + assert_equal "#{version} (build #{info.revision})", info.version_label + + sign_in create_user("admin@example.com", admin: true) + get admin_about_path + assert_select "[data-version]", text: version + assert_select "[data-revision]", text: /Build/ + assert_select "a[href='#{help_page_path('changelog')}']", text: "What's new" + + get help_page_path("changelog") + assert_response :success + assert_select "h1", text: /What.s new/ + assert_select "h2", text: version # the current version has release notes + end + + test "each recorded software build remembers its version" do + AppRevision.touch_current! + revision = AppRevision.find_by(revision: SystemInfo.new.revision) + skip "no git revision in this environment" unless revision + assert_equal SystemInfo.new.version, revision.version + end +end