Skip to content

feat: Add chevron process diagram to Conceptual DSL#93

Merged
jongalloway merged 3 commits intomainfrom
copilot/add-chevron-process-diagram-support
Mar 14, 2026
Merged

feat: Add chevron process diagram to Conceptual DSL#93
jongalloway merged 3 commits intomainfrom
copilot/add-chevron-process-diagram-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 14, 2026

Summary

Implements diagram: chevrons as a new first-class Conceptual DSL diagram type for slide-style horizontal chevron process diagrams, as specified in issue #[Conceptual: Chevron process diagram support].

Syntax

diagram: chevrons
steps:
  - Discover
  - Build
  - Launch
  - Learn

Requires at least 2 steps.

Changes

Parser

  • ConceptualDslParser.Chevron.cs – parses steps: list (minimum 2 items), produces node_0..n with LeftToRight layout hints; throws DiagramParseException for missing/empty steps or a single step
  • ConceptualDslParser.Dispatch.cs – registers chevrons in ParseHandlers and KnownTypes

Layout

  • DefaultLayoutEngine.Chevron.cs – horizontal stage layout; computes tipDepth = nodeH × 0.35, assigns per-node metadata (conceptual:chevronSegment, chevronIndex, chevronCount, chevronTipDepth), and sets label:centerX to visually center text within the rectangular body of each chevron (accounting for the notch on subsequent stages)
  • DefaultLayoutEngine.Conceptual.cs – registers chevrons layout handler

Rendering

  • SvgNodeWriter.csAppendChevronNode renders the first chevron as a pentagon (flat left edge, pointed right) and subsequent chevrons as hexagons (notched left edge matching the previous arrow point, pointed right), using theme-aware fill/stroke and shadow support

Tests

  • Parser unit testsCanParse, node count, label values, diagram type, error cases (missing section, empty section, single step, CRLF line endings)
  • Layout unit tests – horizontal ordering, equal sizing and Y alignment, metadata correctness, title offset, gap between stages, chevron count storage
  • E2E snapshot fixtureconceptual-chevrons.input + conceptual-chevrons.expected.svg baseline

Docs

  • README.md – added chevrons to the Conceptual DSL chooser table; added #### chevrons section with syntax example and description; updated the rule-of-thumb sentence; removed chevrons from the "Planned conceptual additions" note

Security Summary

No security vulnerabilities found or introduced (confirmed by CodeQL scan).

Co-authored-by: jongalloway <68539+jongalloway@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for a new Conceptual DSL diagram type: chevrons (a left-to-right, stage-based process diagram) across the parser → layout engine → SVG renderer pipeline, along with unit and snapshot tests plus README documentation.

Changes:

  • Register and parse diagram: chevrons with a steps: list in the Conceptual DSL parser.
  • Add a chevrons-specific layout handler that sizes/positions stages and writes chevron-related metadata.
  • Render chevron stages as polygons in the SVG node writer and add E2E snapshot coverage + README docs.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/DiagramForge.Tests/Parsers/ConceptualDslParserTests.cs Adds parser tests for diagram: chevrons and step validation.
tests/DiagramForge.Tests/Layout/DefaultLayoutEngineTests.cs Adds layout/metadata/order/size tests for chevrons.
tests/DiagramForge.E2ETests/Fixtures/conceptual-chevrons.input Adds a new chevrons snapshot fixture input.
tests/DiagramForge.E2ETests/Fixtures/conceptual-chevrons.expected.svg Adds the expected SVG output baseline for the new fixture.
src/DiagramForge/Rendering/SvgNodeWriter.cs Adds SVG polygon rendering for nodes tagged as chevron segments.
src/DiagramForge/Parsers/Conceptual/ConceptualDslParser.Dispatch.cs Registers chevrons parse handler.
src/DiagramForge/Parsers/Conceptual/ConceptualDslParser.Chevron.cs Implements steps: parsing and min-step validation for chevrons.
src/DiagramForge/Layout/DefaultLayoutEngine.Conceptual.cs Registers chevrons layout handler.
src/DiagramForge/Layout/DefaultLayoutEngine.Chevron.cs Implements stage sizing/positioning and chevron metadata for rendering.
README.md Documents the new Conceptual DSL diagram type chevrons.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread README.md Outdated

#### chevrons

Horizontal process diagram using connected chevron (arrow) shapes. Ideal for sequential stage flows such as product discovery, delivery pipelines, or onboarding steps. Each step is rendered as a pointed chevron stage; the first stage has a flat left edge and subsequent stages have a notched left edge that visually connects to the previous arrow point.
Comment on lines +1227 to +1240
public void Layout_Chevrons_AdjacentNodesHaveGapBetweenThem()
{
var diagram = new Diagram { DiagramType = "chevrons" };
diagram.AddNode(new Node("node_0", "Discover"))
.AddNode(new Node("node_1", "Build"));

_engine.Layout(diagram, _theme);

var first = diagram.Nodes["node_0"];
var second = diagram.Nodes["node_1"];

Assert.True(second.X > first.X + first.Width,
$"Expected a gap between chevron stages, but node_1.X ({second.X}) was not greater than node_0 right edge ({first.X + first.Width}).");
}
Comment on lines +8 to +20
private static void ParseChevronsDiagram(string[] lines, IDiagramSemanticModelBuilder builder)
{
int sectionLine = FindSectionLine(lines, "steps");
if (sectionLine < 0)
throw new DiagramParseException("Missing required section 'steps:' in chevrons diagram.");

var items = ReadListItems(lines, sectionLine + 1);
if (items.Count == 0)
throw new DiagramParseException("Section 'steps' contains no items.");

if (items.Count < 2)
throw new DiagramParseException(
$"Chevrons diagram requires at least 2 steps, but {items.Count} was provided.");
Comment on lines +459 to +466
public void CanParse_ReturnsTrue_ForChevrons()
{
const string text = "diagram: chevrons\nsteps:\n - Discover\n - Build\n - Launch";

Assert.True(_parser.CanParse(text));
}

[Fact]
@jongalloway
Copy link
Copy Markdown
Owner

@copilot address comments

Co-authored-by: jongalloway <68539+jongalloway@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 14, 2026

@copilot address comments

All four review comments addressed in b304b99:

  1. Layout/README consistency — removed ChevronStageGap (was 6px); stages now have zero gap so the tip of each chevron abuts the notch of the next at their shared bounding-box boundary. README updated to describe a "seamless stage sequence" where each stage's notched left edge "abuts the tip of the preceding stage".

  2. Test/docs consistency — renamed Layout_Chevrons_AdjacentNodesHaveGapBetweenThemLayout_Chevrons_AdjacentNodesAreImmediatelyAbutted and changed the assertion to Assert.Equal(first.X + first.Width, second.X).

  3. Parser duplication — added an optional minItems parameter to ParseListDiagram; ParseChevronsDiagram is now a one-liner: => ParseListDiagram(lines, builder, "steps", "chevrons", minItems: 2).

  4. Redundant test — removed the standalone CanParse_ReturnsTrue_ForChevrons fact (the [InlineData] in CanParse_ReturnsTrue_ForKnownTypes already covers it).

E2E snapshot regenerated (width 573.20 → 555.20 reflecting the removed inter-stage gaps).

@jongalloway jongalloway merged commit 404c026 into main Mar 14, 2026
5 checks passed
@jongalloway jongalloway deleted the copilot/add-chevron-process-diagram-support branch March 14, 2026 19:07
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.

Conceptual: Chevron process diagram support

3 participants