mjdi

Search documentation

Search the mjdi v0.10.0 documentation

mjdi docsv0.10.0latest

Changelog

The canonical changelog lives at the repository root:

Source: mjdi/docs/changelog.md

The canonical changelog lives at the repository root: CHANGELOG.md.

0.10.0 — P2: advanced capabilities and ecosystem expansion (2026-11-24)

The advanced-composition release — keyed/qualified registrations, multi-bindings, optional dependencies, provider decorators, assisted injection, registry bundles, conditional provider selection, named and child scopes, and declared factory dependency metadata, plus the ecosystem set (playground, expanded MCP tools, documentation quality gates, the 0.7 → 0.8 migration guide, distribution integrity, and the security posture). All implemented and executed against mojo 1.2.0 (2016d0cd); the authoritative inventory reports 114/114 suite checks, 814/814 (100%) library and 166/166 (100%) example API-surface coverage, 55 diagnostic catalog entries, 54 Python tooling tests. Full entry in the root changelog.

  • P2-01 / P2-02 — named/keyed registrations: register_keyed[T, K]() family with the Keyed[T, K] provider kind; Inject[T, K] selects a qualified provider (Inject[T] stays Inject[T, DefaultKey] and is fully backward compatible); duplicates and missing providers fail the build with keyed diagnostics.
  • P2-03 / P2-04 — All[T] multi-bindings (registration order, empty is legitimate, count_all[T]()) and OptionalInject[T] optional dependencies (absence is a runtime flag, never a validation failure).
  • P2-05 — provider decorators: the ProviderDecorator trait wrapping any supported provider via register_decorated[...] with started/succeeded/failed hooks.
  • P2-07 — assisted injection: register_assisted[T, P, factory](), the Assisted[P] field marker, and container.assisted[T](/docs/0.10.0/param).
  • P2-08 / P2-09 / P2-10 / P2-12 — registry bundles (add_provider[H, R]()), compile-time conditional provider selection (comptime if patterns), named and child scopes (create_scope(name) / child_scope() with copy-inherit ownership), and declared factory dependency metadata (register_factory_with_deps[...]).
  • P2-06 / P2-11 (deferred with compiler evidence) — async factories and borrowed providers: the compiler experiments (experiments/exp11/exp12) document what the toolchain supports today and why shipping them now would be unsafe; see async factories and borrowed providers.
  • P2-13 … P2-18 — the docs playground (precomputed, provenance-labeled examples), the expanded read-only MCP tools (diagnostics lookup, symbol lookup, example search, release notes, graph validation), the documentation quality gate, the 0.7 → 0.8 migration guide, the reproducible source-install path with SHA256SUMS + SBOM, and the security posture.

0.9.0 — P0 hardening: trust, correctness, and release readiness (2026-11-21)

The trust, correctness and release-readiness release — all implemented and executed against mojo 1.2.0 (2016d0cd); the authoritative inventory reports 84/84 suite checks, 491/491 (100%) library and 115/115 (100%) example API-surface coverage, 54 Python tooling tests. Full entry in the root changelog.

  • P0-01 — release/manifest.json as the single source of truth, scripts/validate_metadata.py + scripts/release_update_docs.py, the CI metadata job, and tag verification in the release workflow.
  • P0-02 — the evidence-based compiler compatibility matrix (docs/compiler-compatibility.md): verified / ci-verified / experimental / unsupported tiers with recorded evidence.
  • P0-03 — opt-in lifecycle safety diagnostics (debug_tracking=True): the DebugLog, debug_report()/was_closed(), and the destructor-time unclosed-resource diagnostics MJDI-D001/D002 (golden-output pinned).
  • P0-04 — deterministic close semantics documented and test-pinned (docs/close-semantics.md): idempotent close, reverse-registration release order, re-constructing post-close resolution, value slots surviving, owner independence.
  • P0-05 — the lifecycle failure policy (docs/lifecycle-failure-policy.md): non-raising pre_destruct, exactly-once cleanup, release walks that never stop halfway, and the post_construct failure contract.
  • P0-06 — pinned stable diagnostic IDs embedded in every message; the catalog grew to 30 entries with whole-library drift detection in scripts/gen_diagnostics.py (docs/validation-output-contract.md).
  • P0-07 — the authoritative test inventory (tests/INVENTORY.md, derived from the runners), the four coverage categories, and the 54/55 reconciliation (docs/test-inventory.md).
  • P0-08 — consistent runtime errors with stable IDs, causes, and remediation (docs/runtime-error-reference.md), including the real MJDI-R004 factory-failure wrapper.
  • P0-09 — alias semantics pinned (docs/alias-semantics.md): lifetimes not instances, per-context cache ownership, precedence, chains impossible by construction.
  • P0-10 — the provider/lifetime/scope behavior matrix (docs/scope-behavior-matrix.md), every row test-pinned.
  • Release engineering — scripts/release_gate.sh and the updated CI jobs (docs/release-checklist.md).

Compatibility: additive except two message-text clarifications (diagnostic IDs appended; factory failures wrapped with the cause preserved). No API, semantics, or failure-mode change; full classification in docs/migration-notes.md.

0.8.0 — the P1 enhancements (2026-11-20)

The complete P1 enhancement set: dependency-graph intelligence, developer experience, testing and registry composition, diagnostics and IDE tooling, resource safety, observability, performance, and linear-resource ergonomics — all integrated, all tested (75/75 suite checks, 100% API-surface coverage, 29 Python tooling tests).

Added — dependency graph intelligence (EPIC A)

  • graph_json[registry]() (mjdi/graph.mojo) — a deterministic, versioned (mjdi.graph/1), machine-readable export of the compile-time dependency graph: nodes carry the service type, provider kind, registration source, effective lifetime, alias target, linear and copyable flags, scope requirement, and validation status with a machine-readable problems list; edges carry consumer, dependency, relation (inject/alias), provider kind, lifetime, and provided status. Registration order, byte-for-byte determinism, and no validation: invalid graphs export with problems marked so tooling can display them before the composition root compiles (P1-01).
  • graph_dot[registry]() — the same graph as Graphviz DOT (per-kind fill colors, dashed alias edges, hexagonal linear nodes, red invalid borders).
  • explain_resolution[registry, T]() — the "why is T resolved this way?" explanation: selected provider, registration source, effective lifetime, dependency chain with each dependency's kind/lifetime, construction path per provider kind, cache ownership, scope requirement (with the why), copyability constraint, and validation problems — all derived from the same chain lookups resolution dispatches through (P1-04). registry_summary[registry]() reports the provider count.
  • The interactive graph viewer in the documentation website (/graph-viewer): zoom, pan, search, node selection with dependency inspection, provider/lifetime filters, alias visualization, cycle and invalid-node highlighting, dependency path highlighting, SVG/PNG/DOT export, responsive layout, dark/light themes — consuming real mjdi.graph/1 exports (P1-02).
  • tools/graph_export.mojo + scripts/export_graph_fixtures.sh — the export runner and fixture regeneration for the showcase, before, and after graphs; the website fixtures are the same bytes.
  • scripts/graph_diff.py — the graph comparison utility (P1-03): added/removed services and dependencies, provider-kind, lifetime, alias-target, edge-relationship, and copyable changes; text and JSON output, --strict/--warn modes, --ignore categories, --summary, and CI-friendly exit codes (0 clean / 1 drift / 2 usage). Checked-in before/after fixtures are real exports; tests/python/test_graph_diff.py pins every category.

Added — developer experience (EPIC B)

  • templates/ — four complete composition-root starter templates (standard application, CLI application, long-running service, test application), each self-testing and runner-gated, each with a README documenting structure, wiring decisions, build/run instructions (P1-05).
  • Value-provider inventory (P1-06): Container.value_inventory(), missing_values(), missing_value_count() — every registered value provider with its set/MISSING status, in registration order, without constructing a service or running a factory.
  • Container.validate_runtime() / Scope.validate_runtime() (P1-07) — the structured RuntimeValidation (valid flag, problem count, report): missing runtime values (typed) and resolution-in-progress detection; never resolves, never runs factories.

Added — testing and registry composition (EPIC C)

  • mjdi/testing.mojo — the assertion family (P1-08): assert_missing_values, assert_value_inventory, assert_validate_runtime, assert_resolve_fails_with, assert_trace_count, assert_trace_last, assert_stats_line, and the _scope companions.
  • The typed override family (P1-09): Registry.override[T, scope](), override_value[T](), override_factory[T, factory, scope]() — explicit override semantics with compile-time duplicate and invalid override detection (compile-fail fixtures cf_override_missing_target, cf_override_then_register_duplicate), clear head-first precedence (the override wins every lookup and resolution; set_value follows the override), and unchanged alias override semantics.
  • examples/testing_patterns — the runnable, tested catalog of the test-container/test-registry/override/scope-isolation/statistics patterns.

Added — diagnostics and IDE tooling (EPIC D)

  • diagnostics/catalog.json — the machine-readable quick-fix catalog (P1-10): 19 diagnostics with stable IDs (MJDI-E###/R###/A###), severities, stages, message patterns, causes, quick fixes, docs links, and example bad/corrected snippets; generated from the library sources by scripts/gen_diagnostics.py, which also enforces that every errors.mojo message builder has an entry and that messages start with mjdi:.
  • IDE integration starter (P1-11): diagnostics/schema.json (the catalog's JSON Schema), ide/problem-matchers.json (GitHub Actions annotations), ide/vscode-example/tasks.json (the editor example), and the runtime messages embed their diagnostic IDs (MJDI-R003).
  • Generated API reference (P1-12): scripts/gen_api_reference.py regenerates docs/api-reference.md from the actual source declarations, organized into the P1-12 categories — signatures cannot drift; CI re-checks with --check.

Added — resource safety and lifecycle ergonomics (EPIC E)

  • with_scope(container, body) (P1-13) and with_container (P1-14) — the lexical guards: the body runs with the scope/container by mutable reference and returns a result the guard forwards; closing is guaranteed on normal completion and every error path.
  • ScopeGuard / ContainerGuard — the ownership variants: exactly-once close() (idempotent) with __deinit__ backstop that fires during error unwinding too (Mojo runs destructors while unwinding — verified by tests/test_guards.mojo); not Movable on purpose.
  • Lifecycle tracing (P1-15): Container[registry, traced=True] (and scopes it creates) record a bounded (256-event), ordered, deterministic event log — value-set, construct, post-construct, cache-miss/insert/hit, factory-run, scope-create, pre-destruct, scope/container-close, linear-destroy — read via trace_report(), trace_count(), trace_event(i), trace_overflowed(). Pull model; no logging dependency; disabled by default with the recording code compiled away.
  • Cache statistics (P1-16): Container[registry, False, True] — hits, misses, constructions, insertions, releases, factory_runs, scope_creations (stats_snapshot(), stats_report(), reset_stats()); per-owner (container/scope); disabled by default.

Added — performance and runtime correctness (EPIC F)

  • The benchmark suite (P1-17): benchmarks/bench_resolution.mojo (transient/singleton/scoped/factory/alias/nested resolution, cache hit and miss paths, scope lifecycle, with_scope guard) with @inline(.never)-guarded operations so the optimizer cannot eliminate the measurement, benchmarks/bench_compile_check.mojo + build timing for compile-time validation, scripts/run_benchmarks.sh (median of 3 runs), and recorded results with the v0.7.0 baseline comparison in benchmarks/RESULTS.md (nested wiring unchanged, compile-time validation unchanged, the guarded paths carry the documented ~7 ns/op re-entrancy-guard cost with the opt-out).
  • The construction ordering contract (P1-18), defined and tested: depth-first construction (pre-order entry, post-order completion — dependencies finish before consumers), innermost-first cache initialization, resolution-order factory execution, and reverse-registration release order with pre_destruct per instance; tests/test_construction_order.mojo pins the full sequence.
  • The concurrency contract (P1-19): documented — the supported compiler ships no threading primitives; containers/scopes are single-threaded per contract, separate containers per thread are the sanctioned shape, external synchronization makes sharing correct.
  • The re-entrancy guard (P1-20): runtime detection of recursive resolution (custom-create-mediated cycles, direct and indirect) on by default — per-service active flags plus a 32-entry index stack, the full path in the diagnostic (MJDI-R003), guard-state cleanup after errors, scope-level tracking, and the reentrancy_guard=False opt-out; the cross-container factory recursion boundary is documented (thin factories cannot capture the resolving container; detecting their own-container recursion would require forbidden mutable global state).

Added — linear resource improvements (EPIC G)

  • examples/linear_resources (P1-21) — the resource showcase: a transaction (nested shared pool that survives), a failing file lease (error-path cleanup), and a lock token — with the traced linear construction/destruction sequence.
  • Linear destruction diagnostics (P1-22): the failure-mode matrix — compile-enforced exactly-once destruction (cf_linear_double_destroy), error-path visitor cleanup, half-wired constructor cleanup — documented in docs/linear-patterns.md.

Changed

  • Container/Scope gained three defaulted comptime parameters — traced: Bool = False, collect_stats: Bool = False, reentrancy_guard: Bool = True — so existing Container[registry] spellings and behavior are unchanged.
  • Container.create_scope now takes mut self (it records scope creation when tracing); scopes inherit the container's tracing/statistics/guard configuration.
  • ProviderContext.singleton_copy is now mut self (it records cache hits); ProviderContext gained the note_factory_run observability hook (default no-op).
  • ProviderSpec.validate_with gained a rest parameter (the chain of providers registered before the node) so override descriptors can validate their target at container construction.
  • describe_value_slots (value inventory) and collect_cached_services (release accounting) joined the RuntimeChain contract; node_count/service_index joined ProviderChain (re-entrancy guard indices); graph_nodes/graph_edges/explain_service joined the chain's comptime surface (graph export).
  • The test suite is now 75 checks (32 unit-test programs, 22 compile-fail fixtures, 3 crash-expected fixtures, the e2e walkthrough, 12 golden example runs, 4 template runs, and the Python tooling checks); library API-surface coverage is 491/491 (100%) and example coverage is 115/115 (100%).
  • The documentation set grew by 17 pages (graph export/visualization/diff, explain resolution, composition roots, runtime validation, registry overrides, scope/container guards, lifecycle tracing, cache statistics, performance, construction ordering, concurrency, re-entrancy, linear patterns, IDE integration, and the regenerated API reference); docs/index.md re-maps the set. llms.txt/llms-full.txt regenerated.
  • The website serves 0.8.0 as the latest version (144 doc pages) with 0.7.0 archived as a frozen snapshot, and ships the interactive graph viewer at /graph-viewer.

Fixed

  • docs/known-limitations.md no longer claims visitors' errors skip linear destruction — the implementation destroys on the error path and the tests pin it (the stale text predated 0.7.0's error-path discipline).
<!-- The full release history continues in ../CHANGELOG.md -->