Skip to content

Add SeqSee output format for charting#265

Open
JoeyBF wants to merge 4 commits into
SpectralSequences:masterfrom
JoeyBF:claude/seqsee-output-format-fbq98s
Open

Add SeqSee output format for charting#265
JoeyBF wants to merge 4 commits into
SpectralSequences:masterfrom
JoeyBF:claude/seqsee-output-format-fbq98s

Conversation

@JoeyBF

@JoeyBF JoeyBF commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Closes #191.

Summary

Adds a new charting backend that emits SeqSee-compatible JSON, alongside the existing SVG and TikZ backends. SeqSee is a generic spectral-sequence visualizer that consumes JSON conforming to its schema and renders a self-contained interactive HTML chart.

As #191 notes, this wasn't previously implementable because the Backend API drew lines from raw coordinates rather than naming source/target nodes. The API has since gained a node-aware structline(source, target, …) method, which this backend builds on.

Changes

  • crates/sseq/src/charting/seqsee.rs — new SeqSeeBackend<T: Write> implementing the Backend trait:
    • Buffers nodes and edges in memory and writes the JSON document on Drop, since the schema groups all nodes together and all edges together whereas the trait callbacks interleave them (this mirrors how the SVG/TikZ backends finalize output).
    • Node ids are "x,y,idx", shared between node creation and edge endpoints.
    • Grid lines and axis labels are no-ops, because SeqSee draws its own grid from the chart dimensions in the header.
    • Differentials (styles matching d<page>) are given a distinct color to match the other backends; every referenced style is registered as an attribute alias so the output validates against the schema.
  • crates/sseq/src/charting/mod.rs — export SeqSeeBackend.
  • examples/chart.rs — prompt for the output format (svg/tikz/seqsee) and dispatch to the corresponding backend.

Testing

  • cargo test -p sseq passes, including a new snapshot test of the emitted JSON and a unit test for the differential-detection helper.
  • cargo clippy -p sseq is clean.
  • The emitted JSON was validated against SeqSee's published input schema with jsonschema.

🤖 Generated with Claude Code


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added SeqSee JSON as a chart output format.
    • Chart generation now supports choosing between SVG, TikZ, and SeqSee formats at runtime.
    • SeqSee output includes chart dimensions, connections, and styling information.
  • Tests

    • Added coverage validating SeqSee style handling and generated JSON output.

Add a `SeqSeeBackend` implementing the charting `Backend` trait that emits
JSON conforming to the SeqSee schema
(https://github.com/JoeyBF/SeqSee). SeqSee is a generic spectral sequence
visualizer that consumes such JSON and renders a self-contained interactive
HTML chart.

The backend buffers nodes and edges in memory (since the JSON groups all
nodes and all edges, whereas the trait callbacks interleave them) and writes
the document on drop, mirroring how the SVG/TikZ backends finalize output.
Grid lines and axis labels are no-ops because SeqSee draws its own grid from
the chart dimensions. Differentials (styles matching `d<page>`) are colored to
match the other backends; every referenced style is registered as an attribute
alias so the output validates against the schema.

The `chart` example now prompts for the output format (svg/tikz/seqsee) and
dispatches to the corresponding backend.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CHkHh9W7nnkiM2Z6fhdHPw
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@JoeyBF, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 27 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7dc0dcf9-6e8f-4edf-95a1-9e5d3de895c2

📥 Commits

Reviewing files that changed from the base of the PR and between 3a1e2ae and b6a86eb.

📒 Files selected for processing (2)
  • ext/crates/sseq/src/charting/seqsee.rs
  • ext/examples/chart.rs
📝 Walkthrough

Walkthrough

The charting crate adds a SeqSeeBackend that produces SeqSee-compatible JSON, exposes it publicly, tests its output and style aliases, and updates the chart example to select SVG, TikZ, or SeqSee output at runtime.

Changes

SeqSee JSON charting

Layer / File(s) Summary
Backend contract and graph accumulation
ext/crates/sseq/src/charting/mod.rs, ext/crates/sseq/src/charting/seqsee.rs
Adds and exports SeqSeeBackend, which implements Backend, accumulates nodes and edges, ignores unsupported drawing operations, and records referenced styles.
JSON finalization and validation
ext/crates/sseq/src/charting/seqsee.rs
Builds the SeqSee document on drop, generates style aliases, writes formatted JSON, and tests graph output plus differential-style detection.
Runtime format dispatch
ext/examples/chart.rs
Prompts for svg, tikz, or seqsee, validates the selection, and dispatches graph writing to the corresponding backend.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ChartExample
  participant SeqSeeBackend
  participant Stdout
  User->>ChartExample: choose output format
  ChartExample->>SeqSeeBackend: construct backend for seqsee
  ChartExample->>SeqSeeBackend: write graph nodes and edges
  SeqSeeBackend->>Stdout: emit SeqSee JSON
Loading

Possibly related PRs

Poem

A bunny hops through nodes and lines,
And JSON sparkles in neat designs.
SVG, TikZ, or SeqSee too—
Pick a format; the chart shines through!
o.o

🚥 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 clearly and concisely describes the main change: adding SeqSee chart output.
Linked Issues check ✅ Passed The changes implement SeqSee-compatible JSON export and add the runtime option requested in issue #191.
Out of Scope Changes check ✅ Passed The PR stays focused on SeqSee chart export and the matching example update, with no obvious unrelated code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Move the `Drop` impl above the test module to satisfy
`clippy::items_after_test_module`, and apply nightly rustfmt formatting to
the chart example.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CHkHh9W7nnkiM2Z6fhdHPw
Comment thread ext/crates/sseq/src/charting/seqsee.rs Outdated
Comment thread ext/crates/sseq/src/charting/seqsee.rs Outdated
Comment thread ext/examples/chart.rs Outdated
claude added 2 commits July 12, 2026 05:54
- Derive node ids from `BidegreeGenerator`'s `Display` impl (`{:#}` →
  `(x,y,idx)`) instead of a bespoke `node_id` helper, keeping node creation
  and edge endpoints in sync.
- Make the `chart` example's format dispatch exhaustive with an explicit
  `svg` arm and `unreachable!()`, since the format is already validated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CHkHh9W7nnkiM2Z6fhdHPw
The snapshot test compared the pretty-printed JSON as a string, which baked
in a particular object key order. serde_json's `preserve_order` feature gets
enabled through feature unification in the full-workspace test build (but not
in an isolated `-p sseq` build), so the emitted key order — and thus the test
outcome — differed between local and CI runs.

Compare the parsed `serde_json::Value`s instead, which is independent of
object key ordering.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CHkHh9W7nnkiM2Z6fhdHPw
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.

Output SeqSee-compatible JSON

2 participants