AIT-370: hookmyapp phone + org profile commands - #51
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 42 minutes Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe CLI adds phone management and organization profile commands. It supports validation, API updates, workspace and organization resolution, human-readable output, JSON output, and command tests. ChangesCLI profile commands
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant PhoneCommands
participant API
CLI->>PhoneCommands: Run phone command
PhoneCommands->>API: Retrieve or update phone data
API-->>PhoneCommands: Return phone status
PhoneCommands-->>CLI: Print formatted output
sequenceDiagram
participant CLI
participant OrgProfileCommand
participant API
CLI->>OrgProfileCommand: Run org profile command
OrgProfileCommand->>API: Resolve organization and retrieve or patch profile
API-->>OrgProfileCommand: Return profile
OrgProfileCommand-->>CLI: Print formatted output
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
src/commands/org-profile.ts (2)
111-119: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider local validation for
--website, and--phone.
phone.tsrejects a malformed number before the API call. This command sends every value unchecked. A typed company phone or a malformed URL costs a round trip and returns a server error that is harder to act on. Reuse theE164check for--phoneand add a minimalURLparse for--website.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/commands/org-profile.ts` around lines 111 - 119, Update the option handling around the body construction in the org-profile command to validate supplied --phone values with the existing E164 check and reject invalid values before the API call. Add minimal URL parsing for supplied --website values, reporting validation failures locally while leaving other update fields and the empty-body check unchanged.
85-86: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePin the response shape once the backend endpoint is fixed.
The code accepts both a wrapped
{ organization }response and a flat response. Only one shape can be correct. The dual handling hides a contract mismatch instead of surfacing it, and the wrapped branch has no test. Afterhookmyapp#193deploys, remove the branch that does not apply.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/commands/org-profile.ts` around lines 85 - 86, Update the response handling in the organization profile fetch to use the single response shape defined by the fixed backend contract, removing the fallback between res.organization and res. Keep data typed directly as the expected OrgProfile shape so contract mismatches surface instead of being silently accepted.src/commands/__tests__/phone.test.ts (1)
51-65: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a test for
--no-operational.The suite covers the default
consentOperational: true. It does not cover the negated flag. Commander derivesopts.operationalfrom the--no-operationaldeclaration, so this is the behavior most likely to break during a refactor.🧪 Proposed additional test
+ it('phone set --no-operational opts out of breakdown alerts', async () => { + mockedApi.mockResolvedValue({ delivery: 'sent' }); + + await makeProgram().parseAsync(['node', 'hookmyapp', 'phone', 'set', '+14155552671', '--no-operational']); + + const [, init] = mockedApi.mock.calls[0]; + expect(JSON.parse((init as { body: string }).body).consentOperational).toBe(false); + });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/commands/__tests__/phone.test.ts` around lines 51 - 65, Add a test alongside the existing phone set test that invokes the command with --no-operational and verifies the POST body sent by mockedApi contains consentOperational: false while preserving the other expected consent fields and normalized phone behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/commands/phone.ts`:
- Around line 88-92: Update the ValidationError construction in the phone
validation flow to remove the interpolated raw number from its message. Keep the
international-format guidance and example unchanged, but use a static message so
captureException does not transmit the entered phone number.
---
Nitpick comments:
In `@src/commands/__tests__/phone.test.ts`:
- Around line 51-65: Add a test alongside the existing phone set test that
invokes the command with --no-operational and verifies the POST body sent by
mockedApi contains consentOperational: false while preserving the other expected
consent fields and normalized phone behavior.
In `@src/commands/org-profile.ts`:
- Around line 111-119: Update the option handling around the body construction
in the org-profile command to validate supplied --phone values with the existing
E164 check and reject invalid values before the API call. Add minimal URL
parsing for supplied --website values, reporting validation failures locally
while leaving other update fields and the empty-body check unchanged.
- Around line 85-86: Update the response handling in the organization profile
fetch to use the single response shape defined by the fixed backend contract,
removing the fallback between res.organization and res. Keep data typed directly
as the expected OrgProfile shape so contract mismatches surface instead of being
silently accepted.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 24001958-b8b5-4763-bf5d-439fe3926291
📒 Files selected for processing (4)
src/commands/__tests__/phone.test.tssrc/commands/org-profile.tssrc/commands/phone.tssrc/index.ts
|
Fixed in 8dff014: the invalid-phone ValidationError message is now static — the raw number no longer reaches Sentry via captureException. @coderabbitai review @codex review |
|
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8dff014de6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
verify-code message made static in e0ce67f — no OTP value can reach Sentry. @coderabbitai review @codex review |
|
|
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
AIT-370: hookmyapp phone + org profile commands
Companion to hookmyapp/hookmyapp#193 (AIT-366 umbrella).
hookmyapp phone set|verify|status|consents— the calling user's PRIVATE alert phone (breakdown/product/marketing texts). Local E.164 + 6-digit validation before any API call;--jsoneverywhere; agent etiquette in help text (number and code come from the human, never invented; decline is normal).hookmyapp org profile [show|set]— company profile (email, phone, website, category, niche, use case) over the existing PATCH /organizations/:orgId/profile. Company data, explicitly distinct from the personal alert phone.Requires backend endpoints from hookmyapp#193 — release only after that deploys.
Summary by CodeRabbit
New Features
Tests