Skip to content

AIT-370: hookmyapp phone + org profile commands - #51

Merged
ord669 merged 3 commits into
mainfrom
ait-366-org-profile-alert-phone
Aug 11, 2026
Merged

AIT-370: hookmyapp phone + org profile commands#51
ord669 merged 3 commits into
mainfrom
ait-366-org-profile-alert-phone

Conversation

@ord669

@ord669 ord669 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

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; --json everywhere; 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.
  • 8 new tests; full suite 1081 green.

Requires backend endpoints from hookmyapp#193 — release only after that deploys.

Summary by CodeRabbit

  • New Features

    • Added CLI commands to view, set, verify, and manage notification preferences for a private alert phone number.
    • Added organization profile commands to view and update company information.
    • Added human-readable and JSON output options, input validation, phone normalization, and verification support.
  • Tests

    • Added coverage for phone management and organization profile retrieval and updates, including validation and consent scenarios.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d70747c0-757a-473f-856a-c84338afcd8f

📥 Commits

Reviewing files that changed from the base of the PR and between 8dff014 and e0ce67f.

📒 Files selected for processing (1)
  • src/commands/phone.ts
📝 Walkthrough

Walkthrough

The 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.

Changes

CLI profile commands

Layer / File(s) Summary
Phone management commands and validation
src/commands/phone.ts, src/commands/__tests__/phone.test.ts
Adds phone status, setup, verification, and consent commands. The commands validate inputs, call phone APIs, and support human-readable or JSON output. Tests cover these workflows.
Organization profile commands
src/commands/org-profile.ts, src/commands/__tests__/phone.test.ts
Adds profile retrieval and partial updates. Empty updates fail locally. Tests cover retrieval, updates, and validation.
Root command registration
src/index.ts
Registers the phone and organization profile command modules with the root CLI.

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
Loading
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
Loading

Possibly related PRs

  • hookmyapp/cli#35: Uses the same active-workspace and organization resolution helpers.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the phone and organization profile commands added by the pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ait-366-org-profile-alert-phone

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/commands/org-profile.ts (2)

111-119: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider local validation for --email, --website, and --phone.

phone.ts rejects 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 the E164 check for --phone and add a minimal URL parse 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 value

Pin 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. After hookmyapp#193 deploys, 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 win

Add a test for --no-operational.

The suite covers the default consentOperational: true. It does not cover the negated flag. Commander derives opts.operational from the --no-operational declaration, 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

📥 Commits

Reviewing files that changed from the base of the PR and between ccbeed8 and f0d9991.

📒 Files selected for processing (4)
  • src/commands/__tests__/phone.test.ts
  • src/commands/org-profile.ts
  • src/commands/phone.ts
  • src/index.ts

Comment thread src/commands/phone.ts
@ord669

ord669 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 8dff014: the invalid-phone ValidationError message is now static — the raw number no longer reaches Sentry via captureException.

@coderabbitai review

@codex review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

@ord669 I will review the updated pull request, including commit 8dff014.

⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread src/commands/phone.ts Outdated
@ord669

ord669 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

verify-code message made static in e0ce67f — no OTP value can reach Sentry.

@coderabbitai review

@codex review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

@ord669 I will review the update in e0ce67f, including the static verification-code validation message.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: e0ce67fa26

ℹ️ 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".

@ord669
ord669 merged commit 9131b85 into main Aug 11, 2026
3 checks passed
@ord669
ord669 deleted the ait-366-org-profile-alert-phone branch August 11, 2026 14:18
ord669 added a commit that referenced this pull request Aug 12, 2026
AIT-370: hookmyapp phone + org profile commands
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