Skip to content

docs: correct the release claims that measurement disproved - #178

Merged
nao1215 merged 2 commits into
mainfrom
docs/release-corrections
Aug 12, 2026
Merged

nao1215 merged 2 commits into
mainfrom
docs/release-corrections

Conversation

@nao1215

@nao1215 nao1215 commented Aug 12, 2026 •

Copy link
Copy Markdown
Owner

Refs #133. Three claims in the release prep did not survive being measured. All three are about v1.0.0 rather than about the code, which is why they matter now rather than later.

1. The upgrading note was wrong

It said documents differ from v0.13.0 "only where the old output did not render". They do not.

I checked out v0.13.0's sample generators unchanged, ran them against this tree, and diffed against v0.13.0's committed output — which separates "the sample's options changed" from "the library's output changed":

change affects
every document now ends with a line ending every document, every caller
a front matter title is quoted: title: Checkout → title: "Checkout" every diagram with a title
a block title moves from a statement into the front matter block diagrams with a title
a class annotation moves inside the class body class diagrams using <<Interface>>
the label escaping from #146 only labels holding the punctuation concerned

The first one was not broken before and changes every file. It is deliberate (MD047, and appending two documents to one writer), but a caller reading "only where the old output did not render" would not expect a diff in every file they regenerate. The note is now a table of the measured differences.

2. The concurrency contract did not exist

Nothing said whether a builder may be shared between goroutines, and tagging v1.0.0 would have frozen that silence into a promise nobody wrote.

It cannot be shared: every builder appends to an ordinary slice. SPEC.md now says so, with the reason it will not change in v1.x — a lock would slow the one-goroutine case every caller has to fix a case nobody has asked for. A test pins the shape the contract points callers at, one builder per goroutine, and it passes under -race.

There is deliberately no test that shares a builder: that test is a data race, and under -race it would fail on purpose, which is a promise to break the build rather than a test.

3. mermaid/er implied a safety it does not have

It carried a sync.Map while every other builder used a plain slice, so er read as the one concurrency-safe builder. It is not: Relationship appends to the body slice in the same call. Confirmed with the race detector — sixteen goroutines calling Relationship on one builder gives WARNING: DATA RACE.

It is a plain map now. Output is byte-for-byte identical — no golden file and no generated sample moves.

4. "Feature complete" was overstated

The markdown side is complete by design. The mermaid side is not, and is not meant to be: mermaid 11.16.1 ships seven diagram types this library does not build (info, ishikawa, cynefin-beta, railroad-beta, swimlane-beta, venn-beta, wardley-beta), which I confirmed by putting each keyword through mermaid.parse. The README now says which half is finished and which is not, and the gaps are being filed as issues.

Verification

  • go test ./... and go test -race . pass; golangci-lint run ./... reports 0 issues.
  • No golden file or generated sample changes: the sync.Map swap is output-neutral.
  • Every committed diagram renders: 64 blocks, 0 failed.

Summary by CodeRabbit

  • Documentation
    • Updated v1.0.0 upgrade guidance, including compatibility notes for existing call sites and function-value assignments.
    • Clarified expected formatting differences in regenerated documents.
    • Distinguished the completed Markdown feature set from the ongoing Mermaid roadmap.
    • Documented that builders should be used independently during concurrent work.
  • Bug Fixes
    • Fixed zero-value Mermaid diagrams so they render without panicking.
  • Tests
    • Added coverage for concurrent builder usage and zero-value diagrams.

Three things were wrong, and all three were about v1.0.0 rather than
about the code.

The upgrading note said documents differ from v0.13.0 only where the old
output did not render. That is false. Running the v0.13.0 sample
generators unchanged against this tree shows the real set, and the widest
member of it was working before: every document now ends with a line
ending, which is a one line diff in every file every caller regenerates.
Front matter titles are quoted now, a block title moved into the front
matter, and a class annotation moved inside the class body. The note is a
table of the measured differences, with the reason for the trailing line
ending given rather than implied.

Nothing said whether a builder may be shared between goroutines, and
v1.0.0 would have frozen the silence. It cannot be shared: a builder
appends to an ordinary slice, and two goroutines calling it race, which
the race detector reports. SPEC.md says so, and a test pins the shape the
contract points callers at instead, one builder per goroutine.

mermaid/er carried a sync.Map, which read as a promise the package does
not keep: Relationship appends to the body slice in the same call, so two
goroutines racing on it race whatever that field is, which -race
confirms. It is a plain map now, and the output is byte for byte
identical.

The README called the library feature complete. The markdown side is;
the mermaid side is not and is not meant to be, because mermaid keeps
shipping diagram types and seven of the ones it already ships are not
built here. The claim is split in two and says which is which.

Refs #133
@github-actions

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 705dde96-92fa-4a5b-9a70-31559af284e3

📥 Commits

Reviewing files that changed from the base of the PR and between 9099987 and ecfa8f5.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • mermaid/er/entity.go
  • mermaid/er/entity_relationship.go
  • mermaid/er/entity_relationship_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • mermaid/er/entity.go
  • CHANGELOG.md

📝 Walkthrough

Walkthrough

The PR updates v1.0.0 upgrade and stability guidance, documents generated-output differences and single-goroutine builder use, adds concurrent independent-builder coverage, and replaces Mermaid entity storage with a regular map.

Changes

Builder stability and compatibility

Layer / File(s) Summary
Compatibility and output guidance
CHANGELOG.md, README.md
The documentation describes the variadic NewMarkdown API, generated-output differences, and Mermaid support status.
Single-goroutine builder storage and validation
SPEC.md, mermaid/er/entity.go, mermaid/er/entity_relationship.go, mermaid/er/entity_relationship_test.go, contract_test.go
Entity storage uses a regular map with lazy initialization for zero-value diagrams. The specification documents single-goroutine use. Tests cover zero-value diagrams and independent builders in parallel.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • nao1215/markdown#135 — Covers related regression testing for Markdown and Mermaid builder output.
  • nao1215/markdown#176 — Modifies the same Mermaid entity relationship implementation and adds related diagram behavior.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the documentation corrections, which are a central part of the pull request.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/release-corrections

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CHANGELOG.md`:
- Line 84: Update the affected-scope text in the changelog row describing quoted
Mermaid front matter titles to say “diagrams with a front-matter title,”
distinguishing it from title-statement diagrams.

In `@mermaid/er/entity.go`:
- Around line 97-105: Update Diagram.NoRelationship to lazily initialize
d.entities before writing, so registration works safely on a zero-value Diagram
without panicking. Preserve the existing entity assignment and fluent return
behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 13628d96-7e09-4244-97cb-4e6c578137d8

📥 Commits

Reviewing files that changed from the base of the PR and between 575a31c and 9099987.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • README.md
  • SPEC.md
  • contract_test.go
  • mermaid/er/entity.go
  • mermaid/er/entity_relationship.go

Comment thread CHANGELOG.md Outdated
Comment thread mermaid/er/entity.go Outdated
Replacing the sync.Map with a plain map took something away that the
sync.Map gave for free: er.Diagram{} accepted writes, because a zero
sync.Map does. A nil map does not, it panics, and nothing in this library
panics on how it is called. The map is made on first use now, and a test
pins the zero value so the next person to change that field finds out.

The changelog said front matter quoting affects every diagram with a
title. It affects the ones whose title goes in front matter; the types
writing a title statement were never touched by it.
@nao1215

nao1215 commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

Both right, and the second one is a regression I introduced rather than a nit.

The zero value. er.Diagram{} accepted writes because a zero sync.Map does; a nil map panics. Diagram is exported and nothing in this library panics on how it is called — a bad call records an error and the chain runs on — so swapping the field type quietly broke that. Confirmed:

PANIC: assignment to entry in nil map

The map is made on first use now, and TestZeroValueDiagramDoesNotPanic pins it so the next person to touch that field finds out from the build rather than from a user.

The changelog row. Correct — front matter quoting affects the diagram types whose title goes in front matter, not the ones writing a title statement (piechart, gantt, quadrant, userjourney, c4), which that change never touched. Scoped.

@github-actions

Copy link
Copy Markdown

Code Metrics Report

main (575a31c) #178 (e4545c4) +/-
Coverage 96.4% 96.5% +0.0%
Test Execution Time 11s 7s -4s
Details
  |                     | main (575a31c) | #178 (e4545c4) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          96.4% |          96.5% | +0.0% |
  |   Files             |             79 |             79 |     0 |
  |   Lines             |           3305 |           3304 |    -1 |
  |   Covered           |           3189 |           3189 |     0 |
+ | Test Execution Time |            11s |             7s |   -4s |

Code coverage of files in pull request scope (93.8% → 95.8%)

Files Coverage +/- Status
mermaid/er/entity.go 100.0% 0.0% modified
mermaid/er/entity_relationship.go 92.5% +3.3% modified

Reported by octocov

@nao1215
nao1215 merged commit e64f990 into main Aug 12, 2026
22 checks passed
@nao1215
nao1215 deleted the docs/release-corrections branch August 12, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant