본문으로 건너뛰기

업데이트 기록

이 문서의 본문은 아직 한국어로 번역되지 않았습니다. 아래에 영어 원문을 제공합니다.

Mastodon 4.7.2 Upgrade

Overview​

Mastodon was upgraded from v4.7.1 to v4.7.2.

This was a relatively small patch release focused on bug fixes and security-related changes. No new database migrations were included.

During validation and deployment preparation, several issues specific to the fork and the upstream v4.7.2 release process were identified and resolved:

  • HEIF/AVIF-related RSpec failures caused by a mismatch between the v4.7.2 release tag and upstream main
  • OAuth application-related behavior adjusted in the fork
  • A dark-theme regression that had existed since the 4.7.1 upgrade
  • Server reboot performed after a kernel update

The service was verified as operational after the work was completed.


Versions​

  • Previous version: v4.7.1
  • Target version: v4.7.2

Build commit​

9b0c38e06e

Record the final main commit after all 4.7.2-related fixes are merged:

git rev-parse --short HEAD

Source update​

The upstream v4.7.2 tag was fetched and merged through an upgrade branch.

git checkout main
git pull --ff-only origin main
git fetch --tags upstream
git checkout -b upgrade-4.7.2
git merge --no-ff v4.7.2

The upstream merge completed without conflicts.

The initial merge changed 21 files:

21 files changed, 102 insertions(+), 22 deletions(-)

The changes were primarily bug fixes and the 4.7.2 version bump.


Database changes​

No new migrations were included between v4.7.1 and v4.7.2.

This was confirmed with:

git diff --name-status v4.7.1..v4.7.2 -- db/migrate db/post_migrate

The command returned no output.

As a result, this upgrade did not require the long-running database migration work that was necessary during the 4.7.1 upgrade.


Security change: HEIF support temporarily disabled​

Mastodon 4.7.2 temporarily disables HEIF support.

The upstream change removed VipsForeignLoadHeif from the allowed libvips operations in:

config/initializers/vips.rb

This affected both HEIC and AVIF processing through libvips.

The security change itself was kept unchanged.


CI failure: HEIC and AVIF media specs​

The first full RSpec run failed with two media attachment tests:

MediaAttachment avif behaves like static 600x400 image
MediaAttachment heic behaves like static 600x400 image

The errors were:

VipsForeignLoad: "...avif" is not a known file format
VipsForeignLoad: "...heic" is not a known file format

The full result was:

7673 examples, 2 failures, 2 pending

The two existing pending tests were the expected MLDSA Object Integrity Proof specs.

Investigation​

The GitHub Actions environment was checked.

Relevant environment details:

Ubuntu 24.04.5 LTS
libvips 8.15.1
libheif 1.17.6

The HEIF decoder packages were installed:

libheif-plugin-aomdec
libheif-plugin-libde265

Ruby-level libvips inspection confirmed that the HEIF loaders were available:

heifload: true
heifload_buffer: true
jpegload: true
pngload: true
webpload: true

This confirmed that the failure was not caused by missing system libraries.

Root cause​

The v4.7.2 release tag disabled HEIF loading in config/initializers/vips.rb, but the release tag still contained media specs expecting AVIF and HEIC processing to succeed.

Upstream main had already adjusted the tests to skip those cases:

describe 'avif', skip: 'HEIF temporarily disabled' do
describe 'heic', skip: 'HEIF temporarily disabled' do

Upstream CI therefore reported:

0 failures, 4 pending

while the v4.7.2 tag itself still caused the two failures when tested directly.

Resolution​

The upstream test-only change was backported to the fork.

Only the following file was modified:

spec/models/media_attachment_spec.rb

The HEIF security change itself was not reverted.

After the backport, CI completed successfully with the AVIF and HEIC specs marked as pending.


OAuth application changes​

Additional OAuth application-related changes were applied to the fork during the 4.7.2 maintenance work.

These changes were validated through the normal test and CI process before being merged into main.

The final production image was built only after these changes had been merged.


Dark theme regression​

A theme regression was identified after the 4.7.1 upgrade.

Symptom​

Selecting the Dark theme still resulted in the Light theme being displayed.

The issue had been present since 4.7.1.

Root cause​

The fork still contained an older customization in:

app/views/layouts/application.html.haml

The fork used:

%html{ lang: I18n.locale }

Upstream 4.7 uses:

%html{ html_attributes }

In Mastodon 4.7, html_attributes includes not only the language attribute but also theme-related attributes such as:

'data-contrast': contrast.parameterize,
'data-color-scheme': page_color_scheme.parameterize,

The old fork customization therefore prevented the expected data-color-scheme value from being added to the <html> element.

As a result, the theme selection script could not detect the configured dark color scheme correctly and fell back to the light theme.

Resolution​

The fork was restored to the upstream form:

%html{ html_attributes }

The locale behavior was preserved because html_attributes already includes:

lang: I18n.locale

This was treated as fork drift rather than an intentional customization.


Validation​

Validation performed during the upgrade included:

git diff --check
yarn lint:js --max-warnings 0

and the full RSpec suite through GitHub Actions.

The CI issue involving AVIF and HEIC was investigated against upstream behavior before any source changes were made.

The final test state matched upstream expectations:

0 failures
4 pending

The pending tests consisted of:

  • 2 MLDSA Object Integrity Proof tests
  • 1 HEIC media attachment test
  • 1 AVIF media attachment test

The HEIC and AVIF specs are intentionally skipped while HEIF support remains temporarily disabled upstream.


Build and deployment​

Custom Mastodon images were built from the final validated main branch.

Images:

mustardkim/mastodon-mustard:v4.7.2
mustardkim/mastodon-mustard:v4.7.2-streaming

The build commit should match the final main HEAD recorded above.

Before building, the source tree was checked with:

git status --short
git rev-parse --short HEAD

Server kernel reboot​

A pending Ubuntu kernel update was also applied during the same maintenance window.

The server was rebooted after package updates so the new kernel could be loaded.

Post-reboot checks included:

uname -r
6.8.0-139-generic
docker ps
systemctl --failed

and:

cd /opt/mastodon
docker compose ps

The Mastodon containers and host services were checked after the reboot.


Post-upgrade verification​

The following were checked after the upgrade and maintenance work:

  • Mastodon web interface available
  • Dark theme selection working again
  • Docker containers running
  • Web service operating normally
  • Sidekiq running
  • Streaming service running
  • Database service running
  • Redis running
  • Host reboot completed successfully
  • No unresolved CI failures

Any remaining problems should be investigated separately rather than by re-running migrations or rolling back unrelated parts of the upgrade.


Notes​

This upgrade highlighted two different maintenance risks.

First, an upstream release tag can occasionally differ from the state used by upstream CI shortly afterward. In this case, the v4.7.2 tag disabled HEIF support but did not yet contain the corresponding media-spec skips present in upstream main.

Second, old fork customizations can become incompatible with later upstream architecture changes even if they previously appeared harmless. The retained %html{ lang: I18n.locale } customization prevented Mastodon 4.7 theme attributes from being rendered and caused the dark-theme regression.

For future upgrades, customizations in shared layout and initialization files should be re-evaluated against upstream rather than automatically preserved.


Follow-up​

  • Monitor the instance after the 4.7.2 deployment
  • Keep HEIF/AVIF tests aligned with upstream while HEIF support remains disabled
  • Re-evaluate the temporary HEIF test skip when upstream restores HEIF support
  • Continue reviewing old fork customizations for accumulated drift
  • Remove temporary diagnostic CI changes once no longer needed