Skip to content

geom: map the package in its doc, with a matrix of what each mark reads - #99

Merged
timzifer merged 1 commit into
mainfrom
docs/geom-mark-matrix
Nov 20, 2026
Merged

timzifer merged 1 commit into
mainfrom
docs/geom-mark-matrix

Conversation

@timzifer

Copy link
Copy Markdown
Owner

Fixes #86 (steps 3 and 4 of ADR 0095 §5; the ADR itself is #96, the split #97).

Package doc — 7 lines → a guide: 46 marks by family, 102 options by group (all as [Name] links), and Which options a mark reads: per mark, the options it reads as a property.

One table, held to the encoder — internal/markprops.Reads (internal, no API):

  • spec TestTheMarkTableIsWhatTheEncoderWrites sets every property option to a non-default value, runs writeMarkProps per mark, maps the written JSON properties back to option names and compares with the table.
  • geom TestTheOptionMatrixIsCurrent renders the table into the doc (-update rewrites it); TestThePackageDocNamesEveryMarkAndOption requires every mark/option constructor exactly once in the guide; TestTheMarkTableCoversEveryBuiltInMark parses describe.go.

Bug found by the new test: MarkParallel had no case in writeMarkProps and fell into the third-party branch — writing fill, rows, curve and marker properties for a mark that draws straight strokes. It now writes stroke and opacity only (verified red without the fix).

Known limit, said in the doc: fill() writes the fill properties as a group, so e.g. Corner is listed for Scatter, which never draws one. Narrowing that is an encoder fix of its own: #98.

CONTRIBUTING's option checklist and spec/AGENTS.md name the new tests. ADR 0095's wording was adjusted in #96: the encoder keeps its switch, a test holds the table to it.

https://claude.ai/code/session_015BfhXWEPyCFY4fZhg5nzsh

The package doc was seven lines for 246 exported declarations. It now
lists the 46 marks by family and the 102 options by group, and ends with
a table of the options each mark reads as a property of itself.

The table is internal/markprops. spec's TestTheMarkTableIsWhatTheEncoderWrites
sets every property option to a non-default value, runs writeMarkProps for
each mark and fails if what the encoder writes differs from the table;
geom's TestTheOptionMatrixIsCurrent renders the table into the doc and
fails when it is stale (-update rewrites it), and two more tests fail if
a mark or option is missing from the guide or the table.

The new test found MarkParallel without a case of its own in
writeMarkProps: it fell into the third-party branch and wrote a fill,
rows, a curve and a marker for a mark that draws straight strokes. It
now writes its stroke and opacity only.

The fill options are written as a group, so a filled mark is listed
against all of them, Corner included where it does not draw one; the
doc says so, and narrowing the group is an encoder change of its own.

Refs #86

Claude-Session: https://claude.ai/code/session_015BfhXWEPyCFY4fZhg5nzsh
@timzifer
timzifer merged commit 3d61de8 into main Nov 20, 2026
18 checks passed
@timzifer
timzifer deleted the docs/geom-mark-matrix branch November 20, 2026 06:09
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.

geom: decide the v1 surface of the flat option namespace

1 participant