Skip to content

Conversation

@arkanoider
Copy link
Collaborator

@arkanoider arkanoider commented Sep 19, 2025

@grunch ,

small pr with some small improvement on commands, but mainly for testing a pr with new automatic build

Summary by CodeRabbit

  • New Features
    • User mentions (e.g., @username) are now auto-linked to GitHub profiles in generated changelogs.
  • Refactor
    • DM commands now run using a shared application context, improving consistency and reducing setup friction.
    • Admin DM no longer relies on environment-based keys; uses keys from the application context.
    • Improved error handling in DM flows: commands return actionable errors instead of exiting the process.
  • Chores
    • Updated configuration comments to reflect support for user mention linking.

- Update link_parsers to include @username patterns
- Support usernames with special characters like [bot]
- Usernames will now be converted to clickable GitHub profile links
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 19, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Refactors DM command handlers to accept and use a shared Context instead of a Client and env-derived keys. Updates call sites in the CLI. Adjusts error handling to return Result errors. Adds a link parser in cliff.toml to hyperlink @user mentions alongside existing PR reference parsers.

Changes

Cohort / File(s) Summary
Config: link parsing
cliff.toml
Adds link parser for GitHub user mentions (@username) under [git].link_parsers; updates adjacent comment. Existing PR parsers unchanged.
CLI dispatcher wiring
src/cli.rs
Updates SendDm and AdmSendDm call sites to pass &Context (ctx) instead of &Client. Other command paths unchanged.
DM commands → Context-based runtime
src/cli/adm_send_dm.rs, src/cli/send_dm.rs
Changes function signatures to accept &Context. Replace env admin key retrieval with ctx.context_keys. Use ctx.client and ctx.pool; remove local pool creation. Convert missing-order handling to return an error. Minor logging adjustments and explicit Ok(()) return.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User as CLI User
  participant CLI as CLI Commands
  participant Ctx as Context
  participant DB as DB (Ctx.pool)
  participant Client as Client (Ctx.client)
  participant Net as Network

  User->>CLI: SendDm {pubkey, order_id, message}
  CLI->>CLI: execute_send_dm(pubkey, &Ctx, order_id, message)
  CLI->>DB: Order::get_by_id(order_id) via Ctx.pool
  DB-->>CLI: Order or error
  alt Order found
    CLI->>Client: send_dm(&Ctx.client, &trade_keys, message)
    Client->>Net: Publish DM
    Net-->>Client: Ack/Result
    Client-->>CLI: Result
    CLI-->>User: Result
  else Order not found
    CLI-->>User: Error (Result)
  end
Loading
sequenceDiagram
  autonumber
  participant Admin as CLI Admin
  participant CLI as CLI Commands
  participant Ctx as Context
  participant Client as Client (Ctx.client)
  participant Net as Network

  Admin->>CLI: AdmSendDm {receiver, message}
  CLI->>CLI: execute_adm_send_dm(receiver, &Ctx, message)
  CLI->>Ctx: Access ctx.context_keys (admin keys)
  CLI->>Client: send_dm(&Ctx.client, &ctx.context_keys, message)
  Client->>Net: Publish DM
  Net-->>Client: Ack/Result
  Client-->>CLI: Result
  CLI-->>Admin: Result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • grunch
  • Catrya

Poem

I tap my paws and pass the ctx along,
No env keys now—just one tidy song.
DMs hop swiftly through fields of code,
Orders found, messages goad.
Mentions link with a cheerful ping—
@bunny waves, and off they spring! 🐇✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch improving-context

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4914787 and 2a41839.

📒 Files selected for processing (4)
  • cliff.toml (1 hunks)
  • src/cli.rs (2 hunks)
  • src/cli/adm_send_dm.rs (1 hunks)
  • src/cli/send_dm.rs (3 hunks)

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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.

@arkanoider arkanoider merged commit ee0bc5e into main Sep 19, 2025
1 check was pending
@arkanoider arkanoider deleted the improving-context branch September 19, 2025 15:43
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.

2 participants