What a Small Datasette Plugin Says About Extension Design
A small Datasette chart plugin points to a bigger engineering issue: where to draw the line between core features and extensions. For AI and blockchain systems, plugin boundaries shape maintainability, data quality, and security.
Small extensions often expose bigger design choices. A new plugin, datasette-charts-pie 0.1a0, noted by Simon Willison, adds pie charts to Datasette. The fact worth taking from the source is simple: a small visualization layer was packaged as an extension rather than folded into the core. That pattern matters well beyond Datasette.
If you build AI or blockchain systems, you already deal with tools that need to stay narrow, inspectable, and easy to replace. Reporting, trace views, wallet activity summaries, model evaluation dashboards, and operator consoles all drift toward bloat when every new display need lands in the main codebase. A plugin boundary is one way to resist that drift.
The useful question is not whether a pie chart belongs in a given product. It is how you decide which features stay core, which move to extensions, and how you keep those extensions from turning your system into a security and maintenance burden.
Treat plugins as product boundaries
A plugin system is a technical decision with product effects. It decides where experimentation happens, who owns change, and how fast your base system grows.
For practitioner teams, a good plugin boundary has three traits:
- The core remains small and stable.
- Extensions solve narrow, optional needs.
- Failure in an extension does not break the main workflow.
This matters in AI systems. You might have one service for prompt evaluation, another for transcript review, and several ways to render results. If every chart type, export path, or annotation widget lands in the main app, release risk climbs. Testing scope expands. So does upgrade pain.
The same pattern shows up in blockchain operations. A block explorer, forensic dashboard, validator console, or bridge monitor often needs extra views for one network, one contract family, or one customer workflow. Those needs are real, but they should not always expand the core surface area.
A practical test helps here. Ask four questions before you add a feature to the base product:
- Does almost every user need it?
- Does it affect core data integrity or access control?
- Does it need tight performance coupling with the main request path?
- Would removing it break the main job of the system?
If the answer is no across most of these, an extension point is often the cleaner design.
Inspect the extension contract before the feature itself
Teams often focus on what a plugin does. The bigger risk sits in how it plugs in.
A weak extension contract causes long-term pain. It leaks internal types, relies on undocumented side effects, or gives broad runtime access because it is easier in the short term. Then every plugin becomes a hidden dependency on internals.
Inspect these points first:
- Registration model. Is plugin discovery explicit or implicit. Explicit registration tends to age better because load order and ownership stay visible.
- Data contract. Does the extension receive a narrow, versioned payload, or direct access to internal objects. Narrow payloads reduce breakage.
- Capability scope. What resources does the plugin touch. Filesystem, network, secrets, database handles, and template context should all be deliberate.
- Failure mode. What happens if the plugin throws, times out, or returns malformed output. Isolation matters.
- Version compatibility. Is there a declared API version, feature flag, or compatibility matrix.
In Go, this often means resisting clever dynamic systems when a stable interface plus clear registration does the job. A plain interface and a constrained context object beat broad access to application state.
For example, a chart renderer for an AI evaluation console does not need your raw database transaction object. It needs a dataset, labels, formatting rules, and perhaps a color policy. That is a contract you can test.
type ChartPlugin interface {
Name() string
Supports(kind string) bool
Render(ctx context.Context, input ChartInput) (ChartOutput, error)
}
type ChartInput struct {
Labels []string
Values []float64
Meta map[string]string
}
This looks simple because it should be. Simplicity at the boundary is what keeps plugin ecosystems alive.
Read visualization features as data-model tests
A new chart type is rarely only a UI change. It often exposes assumptions in your data model.
Pie charts are a good example. They assume part-to-whole data, limited category counts, and sensible aggregation. If teams add a visualization without checking those assumptions, they end up with misleading output and support burden.
The lesson applies to AI and blockchain dashboards alike.
In AI operations:
- A chart of model error classes needs stable category definitions.
- A latency share view needs a clear time window and percentile policy.
- A token-usage breakdown needs one source of truth for accounting.
In blockchain systems:
- A contract event breakdown needs normalized event names.
- A gas-use distribution needs unit consistency.
- A bridge status panel needs explicit handling for delayed, reverted, and pending states.
Before you approve a new visualization path, verify four things:
- Aggregation rules are defined. Sum, count, mean, and percentile are not interchangeable.
- Null and missing values are handled. Silent drops distort charts.
- Category limits exist. Some views stop making sense after a small number of segments.
- Time semantics are explicit. Block time, wall time, and ingest time often differ.
Many reporting bugs are data-contract bugs wearing a UI mask.
Keep extension ecosystems safe by default
A plugin system widens your attack surface. This is true even for low-risk display features.
The risk is not only malicious code. It is also stale dependencies, template injection, cross-site scripting in rendered labels, excessive data access, and unexpected outbound calls from third-party packages.
For internal platforms, teams often wave this through because the first plugins are written in-house. That trust model ages badly. Ownership changes. Contractors rotate in. Forks multiply. The plugin interface outlives the original team.
Set default controls early:
- Signed or pinned dependencies. Know what code you load.
- Escaped output paths. Treat chart labels and tooltips as untrusted data.
- No secret inheritance by default. A renderer should not receive API keys unless required.
- Resource limits. Bound memory, CPU time, and response size.
- Outbound network policy. Block network access for display plugins unless a use case is approved.
- Audit logging. Record which extension handled which request.
If your platform is web-facing, review plugin HTML and JavaScript with the same care you apply to any other user-controlled surface. Security headers help at the application edge. Security Headers Grader is useful if you need a quick read on whether your front end leaves easy gaps around framing, content types, or script policy.
For blockchain teams, this point is easy to miss when the plugin only “reads chain data.” Read-only still touches high-value context. Wallet labels, case notes, sanctions tags, and incident annotations all need tighter controls than a generic widget suggests.
Plan for removal on day one
The hardest part of extension systems is not adding plugins. It is removing them.
Every extension should have an exit path:
- How do you deprecate its API hooks?
- How do you migrate saved configurations?
- How do you replace dead dependencies?
- How do you show users that a feature is unsupported?
This matters for long-lived operator tools. A blockchain monitoring console built for one rollup or one bridge often outlives the original stack choices. An AI review tool tied to one model vendor often needs a fast shift after API changes. If your plugin architecture has no deprecation story, temporary additions become permanent liabilities.
A good removal plan includes:
- semantic versioning for the plugin API
- a deprecation window with logs or UI notices
- fixture-based compatibility tests
- a fallback renderer or no-op path
- migration scripts for stored settings
Teams that skip this end up freezing the core because one old extension still depends on private behavior.
What to watch next
More small extensions will keep appearing across data, AI, and blockchain tools. The useful signal is not the feature itself. It is whether the host system has a narrow extension contract, clear data semantics, and safe defaults.
When you review the next plugin proposal in your stack, start with the boundary. Ask what data it needs, what privileges it gets, how it fails, and how you remove it later. If those answers are clean, the feature has a fair shot of staying useful without swelling the core.