Skip to content

feat: add --rules flag to topology command#9

Merged
broediger merged 16 commits intomainfrom
feat/topology-rules-flag
Mar 29, 2026
Merged

feat: add --rules flag to topology command#9
broediger merged 16 commits intomainfrom
feat/topology-rules-flag

Conversation

@broediger
Copy link
Copy Markdown
Owner

@broediger broediger commented Mar 25, 2026

Summary

  • Adds --rules flag to the crucible topology command that shows the actual filter expression beneath each subscription rule name
  • Supports SQL filters (shows the SQL expression) and correlation filters (shows readable property list)
  • Works across all output formats: tree (indented sub-line), JSON (filter property), and Mermaid (expression as edge label)
  • $Default TrueFilter rules are hidden in Mermaid output to reduce noise

Example

crucible topology --rules

Topics
  └─ orders
      └─ process-sub
          ├─ $Default
          │ → TrueFilter
          └─ highPriority
            → priority = 'high'

Test plan

  • Run crucible topology without --rules — verify existing behavior unchanged
  • Run crucible topology --rules — verify filter expressions appear under rule names
  • Run crucible topology --rules --format json — verify filter property in output
  • Run crucible topology --rules --format mermaid — verify expressions as edge labels
  • Verify correlation filter rules display readable property format

broediger and others added 16 commits March 26, 2026 00:20
Add --rules flag that displays the actual SQL or correlation filter
expression beneath each subscription rule name in the topology output.

Supports all three output formats:
- tree: shows expression on indented sub-line with → prefix
- json: includes filter property on rule objects
- mermaid: uses filter expression as edge label instead of rule name

$Default TrueFilter rules (1=1) are hidden in mermaid output.
Split into formatSqlFilter and formatCorrelationFilter helpers.
Replace repeated if-checks with data-driven CORRELATION_FIELDS array.
Extract getDlqCount, runExecCommand, and sendNotification into
standalone helpers to bring the poll function under the complexity limit.
…er 15

Extract data gathering (gatherQueueCosts, gatherTopicCosts), issue
detection (detectQueueIssues, detectTopicIssues), cost estimation
(estimateMonthlyCost), and rendering (renderSummary, renderTable,
renderOptimizations) into standalone functions. The action handler
is now a simple orchestrator.
Extract generic diffNamedEntities and diffProperties helpers to
eliminate the repeated map-build/added/removed/compare pattern
across diffQueues, diffTopics, diffSubscriptions, and diffRules.
Extract createReceiver, buildJsonOutput, renderMessage,
renderApplicationProperties, and renderBody into standalone functions.
Extract treePrefixes, renderRulesTree, renderSubscriptionsTree, and
getRuleLabel helpers to flatten the deeply nested loop structure and
eliminate the duplicated showRules if/else branches.
peekMessages has a batch ceiling, so searching with --count >100 would
silently return fewer results. Now peeks in 100-message batches using
fromSequenceNumber to walk through the full queue.
- ESLint flat config with typescript-eslint recommended rules
- Prettier with double quotes, semicolons, trailing commas, 80 char width
- eslint-config-prettier to avoid rule conflicts
- Added lint, lint:fix, format, and format:check scripts
- Formatted all source files
@sonarqubecloud
Copy link
Copy Markdown

@broediger broediger merged commit cc14785 into main Mar 29, 2026
4 checks passed
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.

1 participant