Keeping Decidim overrides and monkey patches working after upgrades

Overrides and monkey patches are the most common reason a Decidim upgrade stalls. This page explains how to audit them before each minor version step, move them into modules, and test them so breakage surfaces in staging.

On this page

Why Decidim overrides break during upgrades and how to keep them working

Overrides survive a Decidim upgrade only when they are inventoried, justified and tested at every step of the upgrade path. A team carrying custom views, decorators or patched classes needs to know what each one changes, why it exists, and which release it was written against. Without that record, each minor version quietly invalidates some of them, and the failures often appear only in pages that nobody checks until a participant reports them.

The upgrade path is sequential. Decidim's update guide asks implementers to move one minor version at a time, for example 0.29 to 0.30 before 0.31, and to follow each release's upgrade instructions because some changes alter database structures. Only the 0.32.x and 0.31.x lines receive security updates today, while 0.30.x and earlier are not supported. An installation on an older line therefore has to pass through intermediate releases, and every intermediate step is a point where overrides must be re-checked. Confirm the current supported lines in Decidim's SECURITY.md before you plan the sequence.

Start with an inventory. List every file under app/views that overrides a Decidim view, every decorator, every prepend or reopened class, and every initializer that changes behavior. For each entry, record the Decidim file it replaces, the release it was copied from, and the reason it exists. Entries without a clear reason are candidates for removal before the upgrade begins, because each one adds work at every minor version.

Then decide, for each remaining override, whether it stays, moves into a module, or is replaced by a configuration option. Overrides that touch core Decidim classes are the highest risk, since internal method signatures change between releases. Ask your team to confirm, from the release notes of each intermediate version, which of those files and methods changed. Record the result in the same inventory so the next upgrade starts from a known state.

What changes in the 0.31 and 0.32 releases that affects customizations

This table compares the runtime and routing changes in the 0.31 and 0.32 lines against the customizations they can affect, such as overridden views, patched classes and hard-coded paths. Read each row as a question to answer from the release notes for your target version before you start the upgrade. The main takeaway is that the Rails 8.1 move and locale-prefixed URLs are the changes most likely to break overrides, so they need the earliest audit.

ChangeImpact on overrides and patchesAction needed
Ruby 3.3.4 (v0.31)Patched core or gem methods may rely on behavior changed in the newer Ruby runtime, and gems pinned to older Ruby versions may fail to load.Confirm the Ruby requirement in the 0.31 release notes, then run your patched classes under Ruby 3.3.4 in a staging environment.
Ruby 3.4.7 and Node 22.14.x (v0.32)Overrides that depend on Ruby 3.3 behavior, and any custom asset or JavaScript build steps, may behave differently or fail to build.Confirm both versions in the 0.32 notes, then rebuild assets and run the full test suite on the new runtime.
Ruby on Rails 8.1 (v0.32.0)Overridden controllers, views, helpers and concerns copied from older Decidim code can break when Rails changes APIs or rendering behavior.Diff each overridden file against the upstream version for the target release and confirm Rails 8.1 changes in the release notes.
Locale-prefixed URLs (v0.32.0)Overridden views and custom links that build paths without the locale segment may point to wrong or unreachable pages, and redirects may loop or miss.Search overrides and modules for hard-coded paths, use route helpers, and test links and redirects in each supported locale.
Patch releases v0.31.7 and v0.32.1Fixes may touch files you have overridden, so a patched file in your code may conflict with the new upstream version.Read both release notes, compare the changed files with your overrides, and decide which fixes to apply before the minor upgrade.

What to inventory and back up before touching an override

Before any Decidim minor version step, the team produces a short set of written artifacts: a verified database backup, an inventory of every customization, a staging copy that matches production, and a map of community modules. Each card below is one of those artifacts, and together they tell you what can break and how to get back if it does.

Verified database backup per step

Take a full PostgreSQL backup immediately before each minor version step, then confirm it restores into a scratch database. Upgrade instructions for each release can change database structures, so the backup must be the state the release notes expect. Record the backup time, the Decidim version it was taken on, and the restore test result. A backup that has never been restored is not a rollback plan. Confirm retention with your own backup policy.

Decidim update docs

Overridden view register

List every view that Decidim renders from an application-level override, with its path, the upstream Decidim version it was copied from, and the reason it was copied. Compare each copy against the upstream template for the target release to see which changes it will miss. Views copied years ago and never reviewed are the most common source of silent layout breakage after an upgrade. Assign an owner to each entry.

Decorator and monkey-patch catalog

Record each decorator, prepended module, reopened class and monkey-patched method, including the class name, the method it changes, and the file that loads it. Patches that depend on private method names or internal call order are the highest risk, because minor releases can rename or reorder them without a deprecation. Note which patches exist only to fix an upstream bug, since those may be unnecessary after an upgrade.

Initializers and custom locale files

Inventory every file under the initializers directory that touches Decidim configuration, and every custom locale file that overrides translation keys. Record which translation keys were changed and whether the upstream string still exists in the target release. Locale overrides can hide renamed or removed keys, so a page can look correct in English while showing a missing-translation placeholder in another language. Keep this list in the same repository as the overrides.

Staging environment that mirrors production

Maintain a staging environment with the same Ruby, Node, PostgreSQL and Rails setup as production, a recent anonymized copy of production data, and the same file storage and mail configuration. Run the full upgrade there first, then check the overrides against it. A staging stack that differs in hosting, Docker image or seed data will hide the failures you are trying to find. Ask who approves promotion from staging to production.

Community module dependency map

List each community module, the Decidim hooks, component registrations and helpers it depends on, and whether its maintainer has published support for the target version. Modules that extend the same views or classes as your overrides can conflict with them in ways neither codebase shows alone. Mark modules with no recent release as blockers to review before the step starts.

How to move overrides into a module without losing behavior

The main reason to move an override into a module is that a module keeps your change in its own codebase, with its own version history and tests, instead of scattering edits through the application that Decidim's upgrade process also touches. When a customization lives inside the application's views or classes, every upgrade becomes a merge exercise against files you did not write. When it lives in a module that hooks into the platform at documented extension points, the upgrade mostly means checking that those hooks still exist and still behave the same. Before moving anything, confirm which extension points the target release provides, and check them against the release code and upgrade notes for your version rather than relying on memory of an earlier release.

For each customization, the team has to choose between a decorator (a wrapper that adds or alters behavior around existing code) and a full view override (a copy of a template that replaces the original). A decorator is usually the safer choice because it keeps the upstream code running and changes only the part you need, so upstream fixes still reach your installation. A full view override is sometimes unavoidable, for example when the markup itself must change, but it freezes a copy of the template, so every upstream change to that template must be re-applied by hand at each upgrade. Record the choice for each customization in the module's documentation, along with the reason, the Decidim version it was built against and the owner who reviews it at upgrade time.

Whichever approach is chosen, the move is only complete when behavior is verified, not when the code has been relocated. Run the original customization and the module version side by side in staging, using the same data and the same user roles, and compare the results. Add automated tests for each relocated behavior so that a later upgrade that silently changes the hook or template fails in continuous integration instead of in front of participants. Confirm with your team which tests cover the moved code, who runs them after each minor version step, and what happens if a decorator no longer fits the upstream method it wraps.

The upgrade sequence for overrides, one minor version at a time

This sequence moves a customized Decidim install to the next minor version while every overridden view, patched class and custom module is checked before it reaches production. Each step ends with a check and a rollback point, so a failed upgrade can be reversed without guessing what changed.

  1. Freeze the custom code

    Before any upgrade work starts, the team stops merging changes to overrides, patches, custom modules and the Decidim version pin in the repository. The current deployed commit is tagged, and the Gemfile.lock and any community module versions are recorded alongside it. The check is that a fresh clone of the tag builds and boots in a local or staging environment. That tag is the first rollback point, since it lets the team return the code to exactly what runs in production.

  2. Run the override audit against the current version

    The team lists every overridden view, decorator, monkey-patched class and initializer hook, and compares each one with the source it replaces in the current Decidim release. Each entry is marked as still matching, changed upstream, or no longer needed. The output is a written audit file committed next to the tag, with an owner for each entry. The audit is complete when every customization appears in the list and no override points at a file that the current release has already removed.

  3. Back up the database first

    The update guidance says to back up the database before running anything else, because some releases change database structures. The team takes a full PostgreSQL dump, plus a copy of uploaded files in ActiveStorage, and confirms the backup restores into a separate database. The check is a successful test restore with row counts that match production. The verified backup is the second rollback point, and it is the one used if a schema change has to be reversed.

  4. Upgrade the staging copy to the next minor version

    In a staging copy seeded from the production backup, the team moves Decidim to the next minor version only, following that release's upgrade instructions. Ruby, Node and PostgreSQL requirements for that release are applied as the instructions state, and migrations and data migrations are run in the documented order. The step is done when the application boots and the release's upgrade steps are all recorded as complete. Skipping ahead to a later minor version is not part of this sequence.

  5. Run the test suite against the upgraded copy

    The team runs the project's own specs, the community module specs, and the end-to-end checks for pages that use overridden views, such as registration, proposal forms and component pages. Failures are sorted into three groups: overrides that break, tests that assert old markup, and unrelated environment issues. The check is a recorded test run with the results attached to the upgrade ticket. Any group still failing blocks promotion.

  6. Review and fix failing overrides

    For each failing override, the owner compares the customization with the new upstream source and chooses one of three outcomes: rewrite it against the new source, move it into a module with a defined extension point, or remove it if upstream now provides the behavior. Each decision is written into the audit file. The step is finished when the test run is green and a manual walk-through of the affected pages has been signed off by someone who did not write the fix.

  7. Promote and record the rollback point

    The team schedules the production upgrade using the same steps that succeeded on staging, starting again with the verified backup. After promotion, the new commit is tagged, the upgraded version and the audit file are recorded, and the previous tag and backup are kept until the team agrees the release is stable. The check is a smoke test of key public pages and admin functions. The new tag and retained backup form the rollback point for the next minor version.

Which tests catch override breakage early and how to roll back

Overridden views fail in the browser before they fail anywhere else, so request and feature specs are the first net. A feature spec drives the rendered page the way a participant or administrator would, which catches a partial that no longer matches the template it replaces, a missing local variable, or a changed helper signature. Request specs are faster and check status codes, redirects and the presence of key elements, which is useful for pages that an upgrade may move or rename.

  • Cover every overridden view: Keep one spec per overridden template that renders it with realistic records, including an empty state and a locale other than the default.
  • Exercise the path, not just the page: Include a form submission, a vote or a filter in the feature spec, because overrides often break on the action, not the markup.
  • Assert on stable anchors: Target data-* attributes or semantic elements you added yourself, so a harmless upstream markup change does not produce noise.
  • Run them against the target release: Check the Decidim version in the lockfile and the test helpers it provides before you trust a green run.

Before each upgrade, confirm the test commands and helper names against the documentation for the Decidim version you are moving to, because test tooling changes between minor versions.

What makes an override-heavy Decidim upgrade take longer

This table lists the factors that stretch an override-heavy Decidim upgrade and explains why each one adds work. Read each row as a question to answer about your own install before you estimate the upgrade with a team or a partner. The main takeaway is that overrides, patches and community modules compound, so reducing them before the first upgrade step usually shortens every step after it.

Effort driverWhy it adds workHow to reduce it
Number of overridden viewsEach overridden view is a copy of core markup that must be compared with the new release, so every release can change it and require a manual merge.Inventory every override, remove copies that only differ by a few lines, and move remaining changes into a module or decorator where possible.
Monkey patches on core classesPatches to core classes can break silently when upstream methods are renamed, reordered or called differently, and they often load in an order that is hard to predict.List each patched class and method, replace patches with decorators or hooks where the framework allows, and cover each remaining patch with a test.
Community modules with their own overridesA module that overrides core views or classes must be checked against the target release, and it may be abandoned, which blocks the upgrade path.Confirm the target version support for each module before starting, and record which modules override what so conflicts show up in review.
Custom locale and brandingTranslation keys and theme files can change between releases, and custom strings may hide missing or renamed keys until a page renders in production.Keep custom translations in a dedicated locale file, track keys that core has changed, and check each language on the staging copy.
Database sizeBackups, restores and schema changes take longer on a large database, and each minor step needs its own backup before the migration runs.Confirm current database size with the team, test restore time on a copy, and plan retention so old backups do not accumulate during the upgrade.
Minor versions between the current install and 0.31 or 0.32Decidim asks for one minor version at a time, so each skipped or missed step adds a full cycle of overrides review, migrations and testing.Confirm the current version against the supported 0.31 and 0.32 lines, then sequence the steps and rehearse each one on staging before production.
Ruby and Node changes along the wayEach release can require a different Ruby and Node version, which can break patched gems and asset pipelines that worked on the older stack.Check the required runtime for each target release in the update notes and test custom asset and gem changes under each runtime.

Questions teams ask before upgrading Decidim overrides

What drives the cost of an override audit before a Decidim upgrade?

The main driver is how much of the platform you have changed, and how far those changes reach into Decidim's internals. A few overridden views with clear owners cost far less to review than dozens of patched classes that hook into callbacks, authorization logic or data models. Cost also rises with the number of target versions, because each minor version can change the code you touched. Ask any partner to price the audit from a written inventory of overrides, monkey patches, community modules and their owners, not from a headline estimate. Confirm whether the quote covers only the audit or also the fixes, retest and staging rehearsal, since those are separate line items.

How long does an override audit and fix usually take?

Duration depends on the size of the customization surface, the number of minor versions between your install and your target, and how well the existing code is documented. Decidim's update guide asks you to upgrade one minor version at a time and to follow each release's upgrade instructions, so an audit that covers a multi-step path repeats per step. Teams with a current test suite that exercises overridden screens usually find breakage faster than teams relying on manual clicks. Ask for a timeline that separates inventory, fixes, staging upgrade and acceptance testing, and confirm which of those depend on your change approval process and on access to a staging environment that mirrors production data.

What does the work need from our team?

The work needs three things from your side: access, a staging environment and named decision owners. Access means read access to the codebase, the deployed configuration and the database schema, plus a way to run the current and target versions side by side. A staging copy that resembles production is needed to catch breakage that tests miss. Decision owners must approve whether each override is kept, moved into a module or retired, because those choices affect policy text, workflows and branding that business staff care about. Also confirm who signs off on the upgrade window and who handles rollback if a release goes wrong.

Can our internal team audit and upgrade overrides on its own?

Yes, if the team has Ruby on Rails experience, can read Decidim's source for the versions involved, and has time to run a staged upgrade with proper backups. Decidim's update guide requires a database backup before upgrading and asks you to follow each release's instructions, so the process is learnable but not trivial. The harder part is often judgment: knowing which patched method will break silently, and which deprecation only affects logging. Teams that do this alone usually benefit from writing an override register, adding tests around every customized screen and classes, and asking an outside reviewer to check the audit before production. Confirm your team's capacity against the number of minor steps on your path.

How do we decide between keeping an override and moving it into a module?

Keep an override only when it is small, tied to one installation and unlikely to be touched by upstream changes. Move the change into a module when it adds behavior, needs its own tests, must survive upgrades cleanly or could be reused by another organization. Monkey patches are the riskiest category because they replace behavior without a stable seam, so they usually deserve the most attention in the audit. A useful test is to ask whether the change would still make sense if Decidim renamed the method it touches. Record the decision, the owner and the test that covers it in your override register so the next upgrade starts from evidence rather than memory.

What happens if a community module we depend on is abandoned?

If a community module stops receiving updates, you carry the compatibility risk yourself. Check its last release, its supported Decidim versions and whether its issues and pull requests still get responses before you plan the upgrade. Your options are to pin the current version and accept the risk, fork and maintain it internally, replace its function with a module your team owns, or drop the feature. Keep in mind that Decidim supports only the last two minor versions with security updates until version 1.0, so a module that blocks an upgrade can also leave you on an unsupported release. Decide early, because the choice often changes the audit scope.

Which tests catch override breakage before production?

Tests that exercise each overridden view, decorated class and patched method catch most breakage before users see it. Start with request or system specs for the screens you changed, then add unit tests for patched methods with the inputs and edge cases your organization relies on. Run the suite against the target version in a branch before upgrading production, and keep the tests in your own module or application repository so they survive the next upgrade. Ask whether the audit includes writing these tests or only identifying what needs them, because missing coverage is the most common reason a fix looks finished and still fails in production.

How each customization moves through every minor version step

The path starts with an audit of every overridden view and patched class against the target release. Each item is then classified as a module, a decorator or a retirement candidate. Changes go to staging, where the test suite and the release's upgrade instructions are run, before promotion. A failed check rolls the change back, and the same loop repeats for the next minor version, because Decidim expects one minor step at a time. The database backup comes before any change is applied.

Decision path for each customization, repeated at every minor version step.

How DeployOpen scopes and delivers an override-safe Decidim upgrade

DeployOpen approaches overrides and monkey patches as a dependency inventory, not a one-off code fix. We scope the audit, move customizations into maintainable modules where the platform allows, and leave your team with tests and runbooks that flag breakage before each minor-version step. Engagements are fixed-scope, with the deliverables agreed in writing before work starts.

How we scope

  • Inventory every overridden view, patched class and initializer in your Decidim codebase against the current and target minor versions.
  • Record which customizations are on the path of each planned upgrade step, so the written scope names the exact files and classes covered.
  • Agree in writing whether community modules that touch overrides are in scope, and who confirms their compatibility with each target release.

How we build

  • Move suitable view overrides and class extensions into a dedicated custom module, reducing direct edits to core Decidim files.
  • Write regression tests for each overridden view and patched method, so a failing test points to the customization that broke after an upgrade.
  • Rehearse each minor-version step on a staging copy of your database and code, running your tests before any production change.

How we hand over

  • Deliver an override register listing each customization, its purpose, its owner and the upgrade step where it was last verified.
  • Document the upgrade checklist, including the database backup step, the release-specific upgrade instructions and the test commands to run.
  • Walk your developers through the module layout and test suite so your team can add or retire customizations without starting over.

How we support

  • Ongoing upgrades, patch application and continuous testing are available as a retainer after the initial engagement ends.
  • Retainer work can cover security patch review, given the Decidim security disclosure process, so overrides are rechecked when a fix lands.
  • Confirm with DeployOpen before the engagement starts which environments, release branches and support windows the retainer will cover.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.