Skip to content

fix(telegram): String owner_id test + registry bump - #2620

Merged
serrrfirat merged 1 commit into
stagingfrom
fix/telegram-channel-owner-id-string
Apr 18, 2026
Merged

serrrfirat merged 1 commit into
stagingfrom
fix/telegram-channel-owner-id-string

Conversation

@ilblackdragon

Copy link
Copy Markdown
Member

Summary

PR #2471 (hot-activation owner_id unification) changed TelegramConfig::owner_id from Option<i64> to Option<String> with a deserialize_string_or_number deserializer, but missed the test_config_full case in channels-src/telegram/src/lib.rs:2622 which still asserts Some(42) (integer). That breaks the Telegram Channel Tests CI job and is one of four blockers on the staging→main promotion PR #2612.

Bumped registry/channels/telegram.json 0.2.9 → 0.2.10 so the Version Bump Check passes as well.

Change Type

  • Bug fix

Linked Issue

Unblocks #2612.

Validation

  • cargo test --lib test_config_full (in channels-src/telegram/) passes locally
  • CI green on this PR

Security Impact

None.

Database Impact

None.

Blast Radius

channels-src/telegram test-only change + registry patch version bump.

Rollback Plan

Revert this commit on staging.


Review track: A (test + version bump)

🤖 Generated with Claude Code

PR #2471 changed `TelegramConfig::owner_id` from `Option<i64>` to
`Option<String>` with a string-or-number deserializer, but missed the
test case in channels-src/telegram/src/lib.rs:2622 which still asserts
`Some(42)`. That breaks the Telegram Channel Tests CI job and has been
blocking the staging→main promotion PR #2612.

Also bump registry/channels/telegram.json from 0.2.9 to 0.2.10 so the
Version Bump Check passes (changing channels-src/telegram/ requires a
registry version bump).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 18, 2026 06:45
@github-actions github-actions Bot added size: XS < 10 changed lines (excluding docs) risk: low Changes to docs, tests, or low-risk modules contributor: core 20+ merged PRs labels Apr 18, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Telegram channel by bumping its version to 0.2.10 and updating a test case to reflect that the owner_id in the configuration is now a string instead of an integer. I have no feedback to provide.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes the Telegram channel’s test_config_full to match the post-#2471 owner_id: Option<String> behavior, and bumps the Telegram registry version so the CI version-bump gate passes for this change.

Changes:

  • Update test_config_full to assert owner_id == Some("42".to_string()) (string) instead of Some(42) (integer).
  • Bump registry/channels/telegram.json version from 0.2.9 to 0.2.10.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
registry/channels/telegram.json Patch version bump to satisfy the version-bump check when channels-src/telegram/ changes.
channels-src/telegram/src/lib.rs Fixes a failing test by asserting the string-typed owner_id produced by the new deserializer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@serrrfirat
serrrfirat merged commit 96aa31b into staging Apr 18, 2026
11 checks passed
@serrrfirat
serrrfirat deleted the fix/telegram-channel-owner-id-string branch April 18, 2026 07:05
ilblackdragon added a commit that referenced this pull request Apr 19, 2026
…variants

- Expand UserRole to {Owner, Admin, Regular}
- UserId carries role; methods is_owner()/is_admin()/is_regular()
- Remove From<String>/From<&str> impls (enforces types.md rule)
- Validated construction via new(); from_trusted() for DB-sourced values

Addresses bug pattern from #2561, #2620, #2349 where owner_id silently
round-tripped as String.
ilblackdragon added a commit that referenced this pull request Apr 20, 2026
…variants (#2677)

* refactor(ownership): collapse OwnerId+Identity into UserId with role variants

- Expand UserRole to {Owner, Admin, Regular}
- UserId carries role; methods is_owner()/is_admin()/is_regular()
- Remove From<String>/From<&str> impls (enforces types.md rule)
- Validated construction via new(); from_trusted() for DB-sourced values

Addresses bug pattern from #2561, #2620, #2349 where owner_id silently
round-tripped as String.

* refactor(ownership): address review feedback — id-only equality, persist owner role, doc fixes

- UserId PartialEq/Eq/Hash now compare only `id`, not `role`. Role is
  metadata that travels with the identity; two UserIds with the same id
  but different roles must be interchangeable as HashMap/HashSet keys
  and cache lookup targets. Added a regression test that builds a
  HashSet keyed on UserId and asserts cross-role `.contains()`
  membership, plus a hash-equality check.
- CLI pairing path now persists the "owner" role string (via
  UserRole::Owner.as_db_role()) instead of the hardcoded "admin", so
  a reload through UserRole::from_db_role stays Owner rather than
  being silently downgraded to Admin.
- Update the feature/pairing approve handler to mirror the refactor:
  build UserId via from_trusted + UserRole::from_db_role(&user.role)
  instead of the removed OwnerId::from.
- AdminScope doc comment now reflects that Owner also passes
  is_admin().
- AdminUser extractor error message now reads "Admin privileges
  required (admin or owner)" so the forbidden response matches the
  actual gate.

---------

Co-authored-by: Henry Park <henrypark133@gmail.com>
theredspoon pushed a commit to theredspoon/ironclaw that referenced this pull request Jun 21, 2026
theredspoon pushed a commit to theredspoon/ironclaw that referenced this pull request Jun 21, 2026
…variants (nearai#2677)

* refactor(ownership): collapse OwnerId+Identity into UserId with role variants

- Expand UserRole to {Owner, Admin, Regular}
- UserId carries role; methods is_owner()/is_admin()/is_regular()
- Remove From<String>/From<&str> impls (enforces types.md rule)
- Validated construction via new(); from_trusted() for DB-sourced values

Addresses bug pattern from nearai#2561, nearai#2620, nearai#2349 where owner_id silently
round-tripped as String.

* refactor(ownership): address review feedback — id-only equality, persist owner role, doc fixes

- UserId PartialEq/Eq/Hash now compare only `id`, not `role`. Role is
  metadata that travels with the identity; two UserIds with the same id
  but different roles must be interchangeable as HashMap/HashSet keys
  and cache lookup targets. Added a regression test that builds a
  HashSet keyed on UserId and asserts cross-role `.contains()`
  membership, plus a hash-equality check.
- CLI pairing path now persists the "owner" role string (via
  UserRole::Owner.as_db_role()) instead of the hardcoded "admin", so
  a reload through UserRole::from_db_role stays Owner rather than
  being silently downgraded to Admin.
- Update the feature/pairing approve handler to mirror the refactor:
  build UserId via from_trusted + UserRole::from_db_role(&user.role)
  instead of the removed OwnerId::from.
- AdminScope doc comment now reflects that Owner also passes
  is_admin().
- AdminUser extractor error message now reads "Admin privileges
  required (admin or owner)" so the forbidden response matches the
  actual gate.

---------

Co-authored-by: Henry Park <henrypark133@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs risk: low Changes to docs, tests, or low-risk modules size: XS < 10 changed lines (excluding docs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants