Skip to content

Channel Rules -> Rules + some inconsistency fixes/cleanup #239

Merged
umair-ably merged 3 commits intomainfrom
rulesFixes
Mar 31, 2026
Merged

Channel Rules -> Rules + some inconsistency fixes/cleanup #239
umair-ably merged 3 commits intomainfrom
rulesFixes

Conversation

@umair-ably
Copy link
Copy Markdown
Collaborator

@umair-ably umair-ably commented Mar 30, 2026

Summary

Ably's documentation and dashboard refer to these as "rules", not "channel rules". This aligns the CLI with that terminology.

  • Renames "channel rules" to "rules" across all user-facing CLI text (descriptions, flags, success/error messages, confirmations)
  • Standardizes ID formatting in list output to match create/update/delete (uses ID: {id} label instead of Channel Rule ID: {id} heading)
  • Removes exposeTimeSerial from CLI output (JSON, human-readable) and the --expose-time-serial flag, as it's no longer encouraged
  • Deletes deprecated channel-rule and apps channel-rules alias commands and their tests
  • Fix rules JSON output consistency: remove redundant name field from create, add null-handling fallbacks and modified timestamp to create/update, align list ID heading with CLI convention

Test plan

  • TypeScript builds cleanly
  • All 2189 unit tests pass
  • Verify ably apps rules list shows ID: label (not Channel Rule ID:)
  • Verify ably apps rules list --json does not include exposeTimeSerial
  • Verify ably apps rules create --help does not show --expose-time-serial flag
  • Verify ably channel-rule no longer exists as a command

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cli-web-cli Ready Ready Preview, Comment Mar 31, 2026 5:04pm

Request Review

@umair-ably umair-ably marked this pull request as ready for review March 30, 2026 16:06
@umair-ably umair-ably requested review from AndyTWF and sacOO7 March 30, 2026 16:06
@umair-ably umair-ably marked this pull request as draft March 30, 2026 16:08
@claude-code-ably-assistant
Copy link
Copy Markdown

Walkthrough: This PR renames channel rules to rules in all user-facing text, standardizes ID label formatting, removes the expose-time-serial flag and exposeTimeSerial field, and deletes legacy channel-rule and apps channel-rules alias commands with their tests. Changes: Deleted 10 deprecated alias command files in apps/channel-rules and channel-rule namespaces. Updated apps/rules commands (create, update, delete, list, index) to use rule terminology and remove expose-time-serial. Removed exposeTimeSerial from channel-rule-display.ts. Removed 8 test files for deleted aliases. Updated rules tests to match new output. Updated e2e tests for rules terminology. Regenerated README and updated Project-Structure.md. Breaking changes: ably channel-rule and ably apps channel-rules are deleted; expose-time-serial flag removed from rules create and update. No new dependencies. Test coverage complete.

Copy link
Copy Markdown

@claude-code-ably-assistant claude-code-ably-assistant bot left a comment

Choose a reason for hiding this comment

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

Clean, focused PR. The rename is thorough and the alias cleanup is correct. One real inconsistency to flag.

Finding: list.ts line 103 — namespace.id not wrapped in formatResource()

The change introduces:

this.log(`${formatHeading("ID")} ${namespace.id}`);

But it should be:

this.log(`${formatHeading("ID")} ${formatResource(namespace.id)}`);

The ID renders as plain text in list output, while create/delete/update all display it in cyan via formatResource(). The PR description says this standardizes ID formatting, but the list output ends up as the only command where the ID is not cyan. Project convention: always use formatResource() for resource names.

The formatHeading label is fine for a list record header — just the value needs formatResource().

Everything else looks correct: rename is exhaustive across commands/tests/e2e/docs/README; exposeTimeSerial cleanly removed from flag, JSON output interface, human-readable display helper, and request payload; service layer Namespace interface correctly retains exposeTimeSerial (API still has the field, CLI just stops surfacing it); all 10 alias files and their tests properly deleted; test strings updated to match new output; no this.error() calls, no broken JSON guards, no missing test coverage.

@umair-ably umair-ably marked this pull request as ready for review March 30, 2026 16:09
@claude-code-ably-assistant
Copy link
Copy Markdown

Walkthrough

This PR renames "channel rules" to "rules" throughout all user-facing CLI text to align with Ably's documentation and dashboard terminology. It also standardizes ID formatting in list output, removes the deprecated --expose-time-serial flag (and its output field), and deletes the hidden apps channel-rules and channel-rule alias commands that had previously been kept for backwards compatibility.

Changes

Area Files Summary
Commands (deleted) src/commands/apps/channel-rules/ (5 files), src/commands/channel-rule/ (5 files) Removed deprecated alias command trees entirely
Commands (modified) src/commands/apps/rules/{create,delete,index,list,update}.ts Renamed "channel rule" → "rule" in descriptions/messages; removed --expose-time-serial flag from create and update; fixed list to use ID: label instead of Channel Rule ID: heading
Utils src/utils/channel-rule-display.ts Removed exposeTimeSerial field from display output
Tests (deleted) test/unit/commands/apps/channel-rules/ (4 files), test/unit/commands/channel-rule/ (4 files) Removed unit tests for deleted alias commands
Tests (modified) test/unit/commands/apps/rules/{create,delete,index,list,update}.test.ts Updated assertions to match new "rule" terminology and removed exposeTimeSerial expectations
Tests (modified) test/e2e/control-api.test.ts, test/e2e/control/control-api-workflows.test.ts Updated e2e test descriptions and assertions for renamed terminology
Docs README.md, docs/Project-Structure.md Regenerated README to reflect new command descriptions/flags; removed alias directory entries from project structure doc

Review Notes

  • Breaking change: ably channel-rule and ably apps channel-rules commands are fully removed (not just deprecated). Any scripts or integrations relying on these aliases will break. Previously they emitted a deprecation warning; now they simply don't exist.
  • Breaking change: --expose-time-serial flag removed from apps rules create and apps rules update. Scripts passing this flag will now get an unknown flag error.
  • JSON output change: exposeTimeSerial field no longer appears in apps rules list --json output. Downstream consumers parsing this field will silently get undefined.
  • ID label change: apps rules list human-readable output now shows ID: instead of Channel Rule ID: — low risk but visually different.
  • No new dependencies introduced.

Copy link
Copy Markdown

@claude-code-ably-assistant claude-code-ably-assistant bot left a comment

Choose a reason for hiding this comment

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

REVIEW SUMMARY

Overall this is a clean, well-scoped rename. One formatting bug slipped in.

FINDING: src/commands/apps/rules/list.ts Line 103

Formatting inconsistency. The PR description says it is standardising ID formatting to match create/update/delete, but the list command ends up using different formatters.

What is there now:
this.log(${formatHeading("ID")} ${namespace.id});

What create/update/delete all use:
this.log(${formatLabel("ID")} ${formatResource(namespace.id)});

The difference matters visually:

  • formatHeading = bold, no colon appended
  • formatLabel = dim text with colon, the standard field-label style used everywhere else
  • namespace.id without formatResource = plain text, not cyan

So after "ably apps rules create chat" the user sees a dim ID: label + cyan ID. Then in "ably apps rules list" they see a bold ID (no colon) + plain-text ID for the same field. That is the opposite of what the PR intended.

Fix: use formatLabel("ID") and formatResource(namespace.id) to match create/update/delete.

BREAKING CHANGES (intentional and documented)

The removal of --expose-time-serial from create and update, and the deletion of the channel-rule and apps channel-rules alias commands, are all breaking changes. These appear intentional per the PR description. Worth confirming they are covered in a changelog or release note if that is part of this project's process.

EVERYTHING ELSE LOOKS GOOD

  • exposeTimeSerial is cleanly removed from output without breaking the underlying type (field still in Namespace, API still returns it, CLI just stops exposing it)
  • Error handling correctly uses this.fail() throughout; component strings are camelCase (ruleDelete, ruleUpdate, ruleList)
  • All 5 required describe blocks present in modified test files
  • No auth flags in unit tests, no --duration in unit tests
  • Tests correctly updated to match new output strings

@umair-ably
Copy link
Copy Markdown
Collaborator Author

Fixed the formatting issue mentioned by Claude

@sacOO7
Copy link
Copy Markdown
Contributor

sacOO7 commented Mar 31, 2026

Previously we had alias for channel-rules that pointed to rules right? So, we got rid of it

@umair-ably
Copy link
Copy Markdown
Collaborator Author

Previously we had alias for channel-rules that pointed to rules right? So, we got rid of it

yep, deleted. We're pre-GA so best to use the opportunity to clean it up now

…ides exposeTimeserial in Rules - Deletes deprecated Rules alias
…reate, add null-handling fallbacks and modified timestamp to create/update, align list ID heading with CLI convention
Copy link
Copy Markdown
Contributor

@sacOO7 sacOO7 left a comment

Choose a reason for hiding this comment

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

Thanks for addressing feedback, LGTM

@umair-ably umair-ably merged commit 9e1cb97 into main Mar 31, 2026
10 checks passed
@umair-ably umair-ably deleted the rulesFixes branch March 31, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants