docs(spec): add a C4 component diagram and record Mermaid as the diagram tooling#112
Merged
Merged
Conversation
…ram tooling Closes the last open item of the specification review (#105): the C4 component diagram of the pool internals. The diagram is authored in Mermaid and embedded in spec §4.2; ADR-0041 records Mermaid as the in-repo diagram tooling — C4 levels are drawn as flowcharts with subgraph boundaries, and PlantUML, checked-in images, and Mermaid's experimental C4Component DSL were considered and rejected. Also cross-links the new §4.2 in the §7 spec→ADR map, un-defers the C4 item in §7.1 (now pointing at §4.2), and adds the #111 tracking ref to the benchmark-extension deferred bullet. Documentation-only; no code or API change; no version bump (rides the next release). The zh-Hans/ja spec translation rows stay stale pending the re-sync follow-up already owed from #110. Refs #105 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
9 tasks
danielPoloWork
added a commit
that referenced
this pull request
Jul 7, 2026
…e) (#113) ## Summary Adds `it::d4np::memorypool::PoolMemoryResource`, a `std::pmr::memory_resource` Adapter that binds one `Pool` behind the runtime `std::pmr` interface — so a **single** resource can back any `std::pmr` container (via `std::pmr::polymorphic_allocator`) **without** the per-type `PoolAllocator<T>` rebind. This is the "door left open" in ADR-0018. **Header-only and purely additive** — the frozen C ABI and the existing C++ types are unchanged, so this is a SemVer **MINOR** (`v1.2.0` candidate). It opens roadmap **Milestone 9**. ## Motivation `PoolAllocator<T>` (ADR-0018) bakes the pool into a container's *type*; `std::pmr` chooses the storage policy at *run time* by handing a container a `memory_resource*`. ADR-0018 recorded the `pmr` resource as *deferred, not rejected*. Issue #107 / Milestone 9 opens it. ## Changes - **`pool_memory_resource.hpp`** — `PoolMemoryResource : public std::pmr::memory_resource`. A non-owning back-reference to a `Pool` plus a configurable upstream resource. Deterministic `(bytes, alignment)` routing (mirroring ADR-0018 §2): fitting requests come from the pool (throwing `std::bad_alloc` on exhaustion — **never** falling back, so `do_deallocate` routes deterministically); over-sized / over-aligned requests go upstream (`std::pmr::get_default_resource()` by default). `do_is_equal` by `(pool, upstream)` identity. Gated behind `PBR_MEMORY_POOL_HAS_PMR` (a `__cpp_lib_memory_resource` feature-test) so the header is a no-op where `<memory_resource>` is unavailable. - **ADR-0042** — records the decision (routing, non-owning shape, exhaustion-throws-not-falls-back, configurable upstream, availability gate) and the rejected alternatives; ADR index row added. - **Dedicated doctest** `pool_memory_resource_test` — gated like the header; proves pool routing + exhaustion + reissue, upstream routing (via `null_memory_resource`), `is_equal`, and an end-to-end `std::pmr::list` / `std::pmr::vector` / `polymorphic_allocator` round-trip. - **Spec** — §5.2 lists the type, §7 maps it to ADR-0042, §7.1 no longer defers it. - **ROADMAP** — Milestone 9 created (ADR-0037) with this as item 9.1; #109/#108/#111 listed as 9.2–9.4. - **Doxyfile** — predefines `__cpp_lib_memory_resource` so the gated class appears on the API site. - **CHANGELOG** — `[Unreleased]` *Added* entry. ## Design Patterns - **Adapter** — a second realisation of the already-catalogued Adapter (ADR-0018), bridging the pool to the runtime `std::pmr::memory_resource` interface. No new pattern is introduced. ## Verification - [x] MSVC build clean; `pool_memory_resource` doctest **5 cases / 33 assertions pass**. - [x] `clang-format` (22.x) clean; `clang-tidy` clean on the header + test (the `(bytes, alignment)` `bugprone-easily-swappable-parameters` findings are the fixed `std::pmr` override signature — suppressed with rationale). - [x] `python tools/consistency_lint.py` → **OK**. - [ ] Full toolchain matrix / ASan / UBSan / TSan — via CI (the adapter runs under the existing test matrix; no threading added). ## Documentation Impact - [x] ADR added (ADR-0042) + index row. - [x] Spec updated (§5.2, §7 map, §7.1). - [x] ROADMAP Milestone 9 created (ADR-0037). - [x] CHANGELOG `[Unreleased]` entry. - [x] PR metadata — assignee, `feat` label, `v1.2.0` milestone. - **Deferred to the `v1.2.0` release PR** (to keep this feature PR off the *translated* docs surface — editing them trips the `i18n-freshness` gate): the `README.md` Milestone-9 table row (a release-time refresh per M8.8) and the `docs/patterns/README.md` Adapter-row refinement (the Adapter pattern is already catalogued; the pmr application is fully documented in ADR-0042 and the spec §7 map). The release PR refreshes both and re-syncs the `zh-Hans` / `ja` translations in one pass. The spec rows remain `stale` (already flagged since #110/#112). Closes #107. --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the C4 component diagram of the pool internals to the specification and records
Mermaid as the repo's diagram tooling. This closes the last open item of the
specification review (#105) — the documentation-drift scope of #105 already landed in #110.
No code or API change; no version bump (rides the next release).
Motivation
#110 reconciled the spec with the as-built system but explicitly left the C4 diagram out,
because the repo had no diagram-tooling convention (a mermaid-vs-plantuml decision was
owed). This PR makes that decision (ADR-0041) and delivers the diagram, finishing #105.
Changes
surface, the core engine (behind the Pimpl / C ABI), and the OS backing store; it makes
the realized patterns (Pimpl, Strategy, Template Method, Composite, Decorator, Adapter,
Iterator) and the C-ABI ↔ core ↔ OS boundaries visible at a glance.
as Mermaid flowcharts with
subgraphboundaries; PlantUML, checked-in SVG/PNG, andMermaid's experimental
C4ComponentDSL were considered and rejected. Indexed indocs/adr/README.md.deferred bullet is un-deferred (now points at §4.2), and the benchmark-extension bullet
gains its
#111tracking reference.Addedline under[Unreleased].Design Patterns
None introduced — ADR-0041 is a tooling decision, not a design-pattern adoption. (The
diagram documents the patterns already catalogued in
docs/patterns/.)Verification
python tools/consistency_lint.py→ OK (all invariants hold).#42-component-diagram-c4anchor follows thesame slug rule as the spec's existing
#53-error-semanticsreference.markdownlintclean by inspection (MD013/MD040/MD033are disabled repo-wide, sothe Mermaid fence and long node labels pass).
src/**-filtered CI jobs are skipped).Documentation Impact
[Unreleased]line added.documentationlabel,v1.1.3milestone.i18n note
The
zh-Hans/jaspec rows indocs/i18n/translation-status.mdare alreadystale(flipped by #110) and stay
stale; thei18n-freshnesslint exempts stale rows. Re-syncingthose two spec translations is the follow-up already owed from #110 — this PR adds to that
same debt rather than creating a new one.
Closes #105.