Skip to content

Conversation

@nielsenko
Copy link
Collaborator

@nielsenko nielsenko commented Jan 23, 2026

Description

Adds debugging functionality to PathTrie for diagnosing routing issues:

  • paths getter - Returns all registered path patterns as Iterable<String>
  • toString() override - Quick text dump of all paths
  • toDot() method - DOT graph output for Graphviz visualization, with cycles from self-attachment shown as dashed red edges

All methods handle cycles created by self-attachment.

Related Issues

Pre-Launch Checklist

  • This update focuses on a single feature or bug fix.
  • I have read and followed the Dart Style Guide and formatted the code using dart format.
  • I have referenced at least one issue this PR fixes or is related to.
  • I have updated/added relevant documentation (doc comments with ///), ensuring consistency with existing project documentation.
  • I have added new tests to verify the changes.
  • All existing and new tests pass successfully.
  • I have documented any breaking changes below.

Breaking Changes

  • No breaking changes.

Summary by CodeRabbit

  • New Features

    • Ability to enumerate all registered routing patterns in a deterministic order
    • Visual graph generation support for routing structure representation
    • Improved debugging through readable path output
  • Tests

    • Comprehensive path enumeration validation across various pattern types
    • Cycle detection verification for routing integrity
    • Graph output formatting and edge-case coverage

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 23, 2026

📝 Walkthrough

Walkthrough

Adds debugging support to PathTrie by introducing a public API to enumerate all registered path patterns via a paths getter, generate Graphviz-compatible DOT graph output via toDot(), and provide custom string representation via toString(). Implements internal cycle-detecting traversal helper _enumeratePaths().

Changes

Cohort / File(s) Summary
Path Enumeration and Introspection
packages/relic_core/lib/src/router/path_trie.dart
Adds paths getter returning all registered patterns in deterministic order; toDot() method generating Graphviz representation with cycle detection; toString() override displaying formatted paths; and private _enumeratePaths() helper for trie traversal with visited-set cycle detection. Logic handles dynamic segments and node values during enumeration.
Test Coverage
packages/relic_core/test/router/path_trie_test.dart
Comprehensive test suite validating path enumeration across empty trie, root-only, literals, parameters, wildcards, tail segments, and deep nesting; cycle detection validation; DOT graph output correctness (including cycle marking with dashed red edges); and edge cases with attached tries and consume modes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and clearly summarizes the main changes: adding paths getter, toString, and toDot methods to PathTrie for debugging purposes.
Description check ✅ Passed The PR description is complete with all template sections filled out: detailed description of changes, linked issue reference, pre-launch checklist items checked, and breaking changes documented.
Linked Issues check ✅ Passed All coding requirements from issue #319 are met: paths getter for enumeration, toString() override for text dump, and toDot() for Graphviz visualization with cycle detection.
Out of Scope Changes check ✅ Passed All changes are scoped to the stated objectives: new public methods on PathTrie, internal helper for path enumeration, and comprehensive tests for the new functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@nielsenko nielsenko changed the title feat dump trie feat: Add paths getter, toString, and toDot to PathTrie for debugging Jan 23, 2026
@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.31%. Comparing base (2ba9392) to head (f5840f7).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #320      +/-   ##
==========================================
+ Coverage   91.18%   91.31%   +0.12%     
==========================================
  Files          97       97              
  Lines        3723     3777      +54     
  Branches     1905     1929      +24     
==========================================
+ Hits         3395     3449      +54     
  Misses        328      328              
Flag Coverage Δ
relic_core 91.06% <100.00%> (+0.14%) ⬆️
relic_io 93.27% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nielsenko nielsenko mentioned this pull request Jan 23, 2026
1 task
@nielsenko nielsenko self-assigned this Jan 23, 2026
Adds the ability to enumerate and visualize all registered paths in a PathTrie
for debugging routing issues.

- Add `paths` getter that returns an Iterable<String> of all registered paths
- Add `toString()` override for quick debugging output
- Add `toDot()` method for DOT graph visualization (Graphviz compatible)
- Use cycle detection to handle recursive attachment scenarios
- Paths are returned in deterministic order (literals sorted, then dynamic)

Closes serverpod#319
@nielsenko
Copy link
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 26, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

Dump all paths in PathTrie

1 participant