---
title: "A Packwerk Retrospective"
description: "Packwerk, Shopify's static analysis gem for enforcing package boundaries in Rails monoliths via constant references, works best as a dependency-graph tool rather than an API-privacy tool, which is why privacy checks were removed in 3.0."
url: "https://swe.quest/articles/a-packwerk-retrospective-b9d1167fd6021459"
canonical: "https://shopify.engineering/a-packwerk-retrospective"
source: "Shopify Engineering"
published: "2024-02-07"
difficulty: "medium"
kind: "Case study"
reading_minutes: 14
tags: ["ruby","static-analysis","refactoring","system-design"]
---

# A Packwerk Retrospective

A post on [Shopify Engineering](https://swe.quest/sources/shopify.md), published 2024-02-07, 14 min read, Case study. Original: [https://shopify.engineering/a-packwerk-retrospective](https://shopify.engineering/a-packwerk-retrospective)

## Summary

Packwerk, Shopify's static analysis gem for enforcing package boundaries in Rails monoliths via constant references, works best as a dependency-graph tool rather than an API-privacy tool, which is why privacy checks were removed in 3.0. Its blind spots are significant: it relies on developer-drawn package graphs that often follow naming semantics rather than runtime behaviour, it gives no guidance on fixing violations, and it ignores constants loaded outside Zeitwerk as well as routes, initializers and fixtures. Isolating a zero-dependency 'Platform Essentials' package took months. Reaching zero violations was not enough, and real isolation also needed booting the package alone and running its tests in CI. Domain-based package boundaries fit poorly with how code actually runs, while function-based layering proved more workable.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Ruby](https://swe.quest/tags/ruby.md) (Languages)
- [Static analysis](https://swe.quest/tags/static-analysis.md) (Engineering practices)
- [Refactoring & migrations](https://swe.quest/tags/refactoring.md) (Engineering practices)
- [System design](https://swe.quest/tags/system-design.md) (Architecture & design)

## Prerequisites

- Ruby on Rails ([easy posts on Ruby](https://swe.quest/tags/ruby.md?difficulty=easy))
- Zeitwerk autoloading
- dependency management concepts ([easy posts on Engineering management](https://swe.quest/tags/engineering-management.md?difficulty=easy))

## Keywords

Packwerk, Shopify, Rails, Zeitwerk, Rails engines

## Related posts

- [How We Fixed the Dependency Confusion Vulnerability in Over 600 Ruby Applications](https://swe.quest/articles/how-we-fixed-the-dependency-confusion-vulnerability-in-over-600-ruby-14f9a0a0836510b2.md): Shopify Engineering · 2022-01-27 · Medium · 9 min read · Supply chain security, Ruby, Refactoring & migrations, CI/CD
  Shopify closed a dependency confusion hole across roughly 600 Ruby applications by migrating each \`Gemfile.lock\` to Bundler's newer format, which pins every gem to an explicit source.
- [Dependency prefixes are a supply chain risk: let's fix them](https://swe.quest/articles/dependency-prefixes-are-a-supply-chain-risk-let-s-fix-them-9228bb37d2c90199.md): Sourcegraph · 2026-05-22 · Medium · 5 min read · Supply chain security, JavaScript, Build systems, Refactoring & migrations
  SemVer range prefixes like ^, ~ and wildcards in package.json act as a trust policy that lets compromised or hijacked packages flow into CI and production on the next install.
- [Ruby2Shell (CVE-2026-132825): find vulnerable Ruby across your repos](https://swe.quest/articles/ruby2shell-cve-2026-132825-find-vulnerable-ruby-across-your-repos-943808a4d97a4f48.md): Sourcegraph · 2026-11-20 · Medium · 5 min read · Ruby, Vulnerability research, Supply chain security, Developer tools
  Ruby2Shell (CVE-2026-132825) is a critical heap overflow in Ruby's string case conversion that researchers say default Rails and classic Sinatra apps expose without authentication, with remote code execution proofs of concept known.
- [Making Open Source Safer for Everyone with Shopify’s Bug Bounty Program](https://swe.quest/articles/making-open-source-safer-for-everyone-with-shopify-s-bug-bounty-program-48c56c4f3d09ee13.md): Shopify Engineering · 2022-06-15 · Medium · 5 min read · Application security, Ruby, Open source
  A Shopify bug bounty report showed that a leaked Rails development secret could be escalated to remote code execution because ActiveSupport's MessageEncryptor deserialized data with Marshal by default.
- [Package managers have an integrity problem](https://swe.quest/articles/package-managers-have-an-integrity-problem-ecf30aa0bc2c3af8.md): Trail of Bits · 2026-10-14 · Medium · 21 min read · Supply chain security, Build systems, Cryptography
  An experiment across 25 popular package managers tested whether each detects a compromised repository injecting malicious code into legitimate packages.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
