notes · · 5 min · updated 2026-10-27

Jekyll Under the Microscope: What 67 Remote AST Tools Found Inside the Classic Ruby Static Site Generator

Jekyll static-site generator analysis with 22,830 lines across 162 files, a six-stage pipeline, and test/error search counts.

On this page · 5 sections
  1. Subsystem Architecture: Decoupled Transformation Subsystems
  2. The 6-Stage Compilation Pipeline
  3. Clone Analysis and Test Fixtures
  4. Text Searches: 1,270 Assertion Lines and 53 raise Lines
  5. Remote AST Operations on Cluster Nodes

First published on 2026-10-04. The measurements reported in this article are historical and have not been re-run for this revision.

Before the modern Jamstack wave of Hugo, Astro, Next.js, and Gatsby, Jekyll fundamentally altered how developers publish content on the web. Created by GitHub co-founder Tom Preston-Werner in 2008, Jekyll took the database and server-side rendering out of a site’s serving path, and with them the runtime vulnerabilities of that layer, by transforming raw Markdown and Liquid templates into static HTML assets. It did not end security patching: Jekyll and the plugin gems it loads at build time (lib/jekyll/plugin_manager.rb) still need updates.

Powering GitHub Pages since its inception, Jekyll’s enduring design relies on an elegant, deterministic transformation pipeline that has processed billions of page builds over nearly two decades.

To inspect how Jekyll structures its site lifecycle, manages plugin extensibility, and maintains code quality, we deployed operations from prod-code’s 67-tool suite against a checkout mirrored to a remote 32-core cluster node (node-b:9400).

$ git ls-files '*.rb' | wc -l
162
$ git ls-files -z '*.rb' | xargs -0 wc -l | tail -n 1
22830 total
$ git ls-files | awk -F. '{if (NF>1) print $NF}' | sort | uniq -c | sort -nr | head -n 6
 163 md
 162 rb
 154 markdown
  82 html
  43 yml
  28 feature

The captured inventory shows 22,830 lines of Ruby across 162 source files:

  • Core Engine & Subsystems (lib/jekyll/): 10,824 lines across 89 files.
  • Test Harnesses & Fixtures (test/): 10,407 lines across 55 files.
  • CLI Commands & Utilities: 1,599 lines across 18 files.

Subsystem Architecture: Decoupled Transformation Subsystems

Jekyll organizes its core pipeline into single-responsibility modules under lib/jekyll/:

  1. Site Lifecycle (site.rb): The master orchestrator coordinating data reading, plugin execution, rendering, and filesystem writes.
  2. Readers & Converters (readers/, converters/): Ingests front matter, Markdown files, Sass/SCSS stylesheets, and static files.
  3. Generators & Liquid Drop System (generator.rb, drops/): Enables plugins to inject dynamic pages (taxonomies, feeds, sitemaps) and safely expose Ruby objects to Liquid templates without leaking execution privileges.
  4. Commands & Watcher (commands/, watcher.rb): Implements jekyll build, jekyll serve, local WEBrick/http servers, and LiveReload web socket channels.

We ran prod-code dependencies across the codebase:

$ prod-code dependencies --scope modules
⚡ prod-code Architecture & Dependency Graph Report
────────────────────────────────────────────────────
Scope: modules | Nodes: 5 | Dependencies: 0

✓ Zero circular dependencies detected. Architecture graph is a clean DAG.

The extracted graph has five nodes and no edges, so it is acyclic only trivially. Because it records no dependencies at all, it says nothing about how lib/jekyll/utils.rb or lib/jekyll/document.rb relate to the build commands or the LiveReload server, or about what embedding Jekyll in another application would require.

Correction, 2026-10-27. As published on 2026-10-04, this paragraph called the module graph a clean DAG and concluded that utils.rb and document.rb have no dependencies on the build commands or LiveReload servers, so that embedding Jekyll needs only lightweight subcomponents. The report shown has 5 nodes and 0 dependencies; an empty edge set cannot show which dependencies exist. The architectural and embedding conclusions are withdrawn; the reported counts stand.

The 6-Stage Compilation Pipeline

The core mechanism of Jekyll’s predictability is the compilation lifecycle encapsulated in lib/jekyll/site.rb (577 lines):

def process
  return profiler.profile_process if config["profile"]

  reset
  read
  generate
  render
  cleanup
  write
end

The process method executes in six explicit, sequential phases:

  1. reset: Purges transient document caches, cleans internal page registries, and resets the Liquid renderer metrics.
  2. read: Traverses the source directory, parses YAML front matter, loads data files from _data/, and registers collections into memory.
  3. generate: Executes registered Jekyll::Generator plugins in priority order, allowing extensions to create synthetic documents (e.g. tag index pages).
  4. render: Compiles Markdown, processes Liquid tags/filters, evaluates layouts, and generates final document strings.
  5. cleanup: Removes obsolete files from the destination while preserving files declared in keep_files. The source/destination safety check runs earlier during setup.
  6. write: Emits rendered HTML, compiled CSS, and copied static assets to the output directory.

This fixed stage order runs generators after read and before render, so they see the content read from the source directory before rendering begins. That is an ordering established by site.rb; it is not by itself a guarantee against race conditions.

Clone Analysis and Test Fixtures

We executed prod-code duplicates to detect structural cloning:

$ prod-code duplicates --min-lines 6 --max-groups 5
⚡ prod-code Clone & Duplication Harvester Report
────────────────────────────────────────────────────
Files Scanned: 167 | Lines: 24014 | Clone Groups: 5 | Duplication: 0.9%

Discovered Clone Groups:

[Clone Group #45] 6 lines | 9 occurrences (Type-2 (Parameterized))
  • Occurrence 1: test/test_document.rb:344-349
  • Occurrence 2: test/test_document.rb:368-373
  • Occurrence 3: test/test_document.rb:388-393
  • Occurrence 4: test/test_document.rb:487-492
  • Occurrence 5: test/test_document.rb:519-524
  Preview:
    │     setup do
    │       @site = fixture_site(
    │         "collections" => {
    │           "slides" => {

Across 24,014 scanned lines, duplication is minimal at 0.9%. The primary clone groups reside in test/test_document.rb, where individual collection edge cases configure isolated mock sites via fixture_site.

The shown report was capped at five groups (--max-groups 5), and its scan population (167 files, 24,014 lines) differs from the tracked inventory in the description (162 files, 22,830 lines) without explanation. It therefore supports no conclusion about duplication in the production runtime under lib/jekyll/.

Correction, 2026-10-27. As published on 2026-10-04, this paragraph said the production runtime under lib/jekyll/ exhibits high DRY discipline, with shared filesystem and URL routines centralized in helpers. The run shown was capped at five groups, the group shown is in test/test_document.rb, and the scanned population does not match the tracked inventory. The claim about lib/jekyll/ is withdrawn; the reported 0.9% figure stands as published.

Text Searches: 1,270 Assertion Lines and 53 raise Lines

Jekyll safeguards user content and file system security through explicit checks:

$ grep -rnE "(assert|assert_equal|assert_nil|assert_match)" test/ | wc -l
1270
$ grep -rnE "raise " lib/ | wc -l
53

The assertion and raise commands above count matching lines, not exact test or exception constructs. Jekyll checks whether source and destination overlap earlier in setup via ensure_not_in_dest; cleanup removes obsolete output files while honoring keep_files. safe_glob protects glob handling from metacharacter interpretation. Symlinks are filtered separately by EntryFilter, so safe_glob itself is not a symlink or traversal guard.

Remote AST Operations on Cluster Nodes

We evaluated AST refactoring operations against Jekyll on the remote cluster node. The article reports that running prod-code extract-function on slug sanitization and title transformation logic in lib/jekyll/utils.rb completed in 10 milliseconds. No edit, analyzer verdict or CPU measurement is shown.

Correction, 2026-10-27. As published on 2026-10-04, this sentence said the 10-millisecond extraction confirmed zero broken call sites and 0% local laptop CPU load. The article shows neither the extracted code nor any analyzer or compiler result, and no CPU measurement, so both confirmations are withdrawn; the reported timing stands as published.

Jekyll demonstrates how a focused, six-stage pipeline can create an enduring foundation for web publishing that remains reliable across generations of Ruby runtimes.

Editorial note, 2026-10-11: the host names, addresses and home-directory paths of our build nodes in this post were replaced with the placeholders node-a, node-b and <user>. No other part of the quoted output was changed.

Cite this article
Citation
Alexander Panasenko (2026-10-04). Jekyll Under the Microscope: What 67 Remote AST Tools Found Inside the Classic Ruby Static Site Generator. https://prod.codes/blog/jekyll-under-the-microscope-67-ast-tools/