Regenerate diagram figures against 2.3.3, and make the generation reproducible - #273
Merged
Merged
Conversation
`gen_pipeline_diagrams.py --check` exists to catch renderer drift in CI, but it could not be trusted: one of the three figures disagreed with its own committed output about half the time, for reasons unrelated to the renderer. Two independent causes. `dj.Diagram` iterates sets of table-name strings on its emission path, so node and cluster order in the SVG follows `str.__hash__`, which Python salts per process. Two identical runs render the same picture — same coordinates, colors and edges — and emit it in a different order. The script now re-execs itself with `PYTHONHASHSEED=0` before importing datajoint, since that variable is only read at interpreter start. Filed upstream as datajoint-python#1551; the block comes out when that lands. `pydot` was unpinned, and its SVG writer changed between 3.x and 4.x — 4.0.1 drops the XML prolog and DOCTYPE, reorders `<svg>` attributes, drops cluster `<title>` elements, and emits literal spaces where 3.x emitted ` `. None of it changes the rendering, all of it rewrites the file. Pinned to 3.0.4. Also replaces the "one collapsed edge is traversal-order dependent" caveat in the module docstring. That described pre-#1545 behavior, where a collapsed edge inherited the style of whichever foreign key in its bundle was visited first; bundle edges render uniformly as of DataJoint 2.3.3.
One notation change, and it is the one datajoint-docs#266 anticipated: in `pipeline-modules-collapsed.svg` the `reference -> session` edge goes from dashed to solid. Before datajoint-python#1545 a collapsed edge took the style of an arbitrary member of its foreign-key bundle; now every bundle edge renders uniformly. #266 predicted `lab -> session` would be the visible one — the mechanism was right, the edge was not. Everything else is pydot serialization, not renderer drift. Verified rather than assumed: for all three figures the fill set, stroke set, node count, edge count and text labels are identical to the committed versions, and for the two unchanged figures the dasharray count matches too. The tier palette already matched released 2.3.3, so no colors moved. Regenerated with DataJoint 2.3.3 from PyPI, pydot 3.0.4 and graphviz 15.1.0. `--check` is now clean and stable across repeated runs.
MilagrosMarin
approved these changes
Sep 10, 2026
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.
Closes #266.
#266 exists to re-verify the diagram figures and the notation spec once the renderer changes ship in a release. 2.3.3 is that release (datajoint-python#1533, #1534, #1544, #1545). Doing it surfaced two reasons the check it relies on could not be trusted, so this PR fixes those first and then regenerates.
What #266 asked for, and what it found
Step 1 — re-verify § Visual Encoding against the released package. Already correct. All five tier rows in
reference/specs/diagram.mdmatch_DIAGRAM_THEMESin released 2.3.3 exactly, fill/stroke/text. The renamed-FK amber#C77D3Amatches too; its row label was corrected from "Orange line" in #272, which also noted it is deliberately distinct from the Computed tier's brand orange#FF5113.Step 3 — confirm the collapsed-view prose. Unchanged, as #266 expected. It attributes no meaning to weight or line style on a collapsed edge, which stays true.
Step 2 — regenerate. One real change, and it is the one #266 predicted:
pipeline-modules-collapsed.svgreference → sessionedge: dashed → solidpipeline-modules.svgimaging-schema.svgThat is datajoint-python#1545: a collapsed edge no longer inherits the style of an arbitrary member of its foreign-key bundle, so bundle edges render uniformly. #266 guessed
lab → sessionwould be the visible one — right mechanism, wrong edge.Why the diff is still large
The remaining ~440 lines are serialization, not the renderer. I verified that rather than assuming it: for all three figures the fill set, stroke set, node count, edge count and text labels are identical to the committed versions, and for the two unchanged figures the dasharray count matches as well. The tier palette already matched released 2.3.3, so no color moved.
The two reproducibility bugs this fixes
--checkcould not be relied on before this. One of the three figures failed against its own committed output about half the time.1. Node emission order is hash-seeded.
dj.Diagramiterates sets of table-name strings on its emission path (diagram.py:1210,:1251-1252), so node and cluster order followsstr.__hash__, which Python salts per process. Two identical runs render the same picture and emit it in a different order:PYTHONHASHSEED=0The script now re-execs itself with
PYTHONHASHSEED=0before importing datajoint, since that variable is only read at interpreter start. Filed upstream as datajoint-python#1551; the block is marked to come out when that lands. The real fix issorted()at those call sites.2.
pydotwas unpinned and its SVG writer changed between 3.x and 4.x — 4.0.1 drops the XML prolog and DOCTYPE, reorders<svg>attributes, drops cluster<title>elements, and emits literal spaces where 3.x emitted . Nothing visual, everything rewritten. Pinned to3.0.4. #266 flagged this ("nothing pins pydot") as a known non-signal; it is now a pinned one.After both,
--checkis clean and stable across repeated runs.Also
The module docstring's "one collapsed edge is traversal-order dependent" caveat described pre-#1545 behavior and is replaced with the hash-seed caveat that is actually true now.
Reviewing this
The mechanism and the regeneration are separate commits, so
0eebe6c8is readable on its own and389f611cis the generated output.Regenerated with DataJoint 2.3.3 from PyPI (not master), pydot 3.0.4, graphviz 15.1.0, PostgreSQL 15. To reproduce: