# Bengal 0.4.1

URL: /bengal/releases/0.4.1/
Section: releases
Description: A focused correctness patch — valid JSON-LD on every doc page, the data_table template function wired up, working autodoc "View source" links, honored asset and render-isolation config, atomic health auto-fixes, a guaranteed build_complete teardown hook, and re-armed architectural guard tests.

---

> For a complete page index, fetch /bengal/llms.txt.

**Key theme:** Stop shipping wrong output. 0.4.1 is the first patch off 0.4.0 — eight backward-compatible correctness and data-safety fixes surfaced by a repo-wide audit right after the 0.4.0 cut. No new features, no breaking changes; everything here makes already-documented behavior actually work.

---

## What's fixed

### Output correctness

- **Valid JSON-LD on every doc page.** The default theme's article JSON-LD `@type` rendered an unquoted token (`| tojson` bound only to the `else` branch), emitting invalid structured data that search engines and AI crawlers reject. The conditional is now parenthesized so the value is always quoted (#442).
- **`{{ data_table(...) }}` works.** The `data_table` template function was implemented and unit-tested but never registered through the production path, so any template calling it raised `UndefinedError`. It's now wired into `register_all()` (#434).
- **Autodoc "View source" links resolve.** They previously always fell back to `#`; they now build a real GitHub blob URL when `github_repo` is configured, expanding `owner/repo` shorthand and honoring `github_branch` (#441).

### Configuration honored

- **Asset config respected.** Restored the documented `from bengal.assets import AssetManifest` import, and the asset orchestrator now reads the nested `[assets]` settings (`minify`, `optimize`, `fingerprint`) instead of deprecated flat keys — so `minify = false` under `[assets]` actually disables minification (#447).
- **Render-isolation options + section validation.** `build.render_isolation*` options are now read from config instead of being silently swallowed, and the config validator recognizes seven additional valid sections (`output_formats`, `structured_data`, `external_refs`, and more), eliminating spurious "unknown config section" warnings (#446).

### Reliability & data-safety

- **Atomic health auto-fixes.** `--auto-fix` now writes user content files with write-temp-then-rename instead of overwriting in place, so an interrupt mid-write can't truncate a source file (#440).
- **`build_complete` always fires.** The documented plugin teardown hook now runs exactly once even when a mid-build phase raises — so cleanup callbacks (closing connections, writing summaries) execute on failed builds. The original error still propagates afterward (#437).
- **Re-armed architectural guards.** The core composition-over-inheritance guard tests scanned a module that defines no page class and trivially passed; they now inspect the live `RuntimePage` and go red if it re-acquires a mixin base or hoists a rendering import to module scope (#433).

---

## Upgrading

```bash
uv pip install --upgrade bengal
# or
pip install --upgrade bengal
```

A pure patch release — drop-in for any 0.4.0 site. If you set `minify = false` under `[assets]` and noticed assets were still minified, or saw "unknown config section" warnings on a valid config, those now behave correctly.
