Skip to content

log url on instant-cli errors (#2806) [bump to v1.0.55] - #2806

Merged
drew-harris merged 2 commits into
mainfrom
drewh/better-logging
Jul 30, 2026
Merged

log url on instant-cli errors (#2806) [bump to v1.0.55]#2806
drew-harris merged 2 commits into
mainfrom
drewh/better-logging

Conversation

@drew-harris

@drew-harris drew-harris commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Shows the url on errors for the info command. For any InstantHttpError, the url is already part of the error message.

image

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The CLI info command now includes the resolved base URL in dashboard fetch errors while preserving the original cause. The shared client version is updated from v1.0.54 to v1.0.55.

Changes

CLI error diagnostics

Layer / File(s) Summary
Dashboard error URL context
client/packages/cli/src/commands/info.ts
The info command resolves the base URL and includes it in /dash/me fetch errors while preserving the original cause.

Shared version update

Layer / File(s) Summary
Version constant update
client/packages/version/src/version.ts
The exported version constant changes from v1.0.54 to v1.0.55.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: nezaj, stopachka

🚥 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.
Title check ✅ Passed The title matches the main change by calling out URL logging for instant-cli errors.
Description check ✅ Passed The description is related to the info command error handling and URL inclusion in errors.
✨ 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 drewh/better-logging

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 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 `@client/packages/cli/src/commands/info.ts`:
- Around line 36-39: Reuse the existing mapError logic that adds the resolved
dashboard URL context for the later `/dash/apps/...` request as well as the
`/dash/me` request. Update the app-fetch error handling near the dashboard
request so schema and non-InstantHttpError failures are wrapped consistently,
without changing successful responses.

In `@client/packages/cli/src/layer.ts`:
- Line 87: Update the error formatting in layer.ts around the request error
handler so methodAndUrl is included only once: retain it in the structured
prefix or the InstantHttpError message, and remove the duplicate from the other
source while preserving the underlying error message.
🪄 Autofix (Beta)

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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e4261dd0-403d-4f8a-bb6f-e17cf892b3d2

📥 Commits

Reviewing files that changed from the base of the PR and between 72b2ee5 and b2d3eb6.

📒 Files selected for processing (2)
  • client/packages/cli/src/commands/info.ts
  • client/packages/cli/src/layer.ts

Comment on lines +36 to +39
(e) =>
new Error(`Couldn't get user information (${baseUrl}).`, {
cause: e,
}),

@coderabbitai coderabbitai Bot Jul 30, 2026

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Apply URL context to the app fetch as well.

This mapError only covers /dash/me; the later /dash/apps/... request can still fail without the resolved dashboard URL, especially for schema or non-InstantHttpError failures. Reuse the same error mapping for both dashboard requests.

🤖 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 `@client/packages/cli/src/commands/info.ts` around lines 36 - 39, Reuse the
existing mapError logic that adds the resolved dashboard URL context for the
later `/dash/apps/...` request as well as the `/dash/me` request. Update the
app-fetch error handling near the dashboard request so schema and
non-InstantHttpError failures are wrapped consistently, without changing
successful responses.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the later /dash/apps request can fail but ti will fail as an InstantHttpError which will print the url.

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.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

ast-grep outline client/packages/cli/src/layer.ts --items all
printf '\n--- InstantHttpError definitions and relevant usage ---\n'
rg -n -C 5 '\bInstantHttpError\b|\bInstantHTTPError\b|function printRedErrors|const printRedErrors|printRedErrors\s*=' client/packages/cli/src
printf '\n--- info command request/error handling ---\n'
sed -n '20,65p' client/packages/cli/src/commands/info.ts

Length of output: 9912


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- InstantHttpError printer ---'
sed -n '70,110p' client/packages/cli/src/layer.ts
printf '%s\n' '--- HTTP client status-error transformation ---'
sed -n '45,125p' client/packages/cli/src/lib/http.ts
printf '%s\n' '--- Existing dashboard schema error wrappers ---'
rg -n -C 4 'schemaBodyJson\(Dash(App|Me)Response\)|Couldn.t get (user|app) information' client/packages/cli/src

Length of output: 6750


@drew-harris, verified: non-2xx responses do become InstantHttpError, so that path is covered.

The remaining case is a 2xx response that fails schemaBodyJson(DashAppResponse)—for example, malformed JSON or a response that no longer matches the expected dashboard schema. That failure occurs after filterStatusOk and is not an InstantHttpError, so it will not have methodAndUrl.

So the requested wrapping is only needed for that decode-error path; the HTTP-error path is already handled as you described.

You are interacting with an AI system.

Comment thread client/packages/cli/src/layer.ts Outdated
@drew-harris
drew-harris force-pushed the drewh/better-logging branch from b2d3eb6 to 0eb2c9a Compare July 30, 2026 20:13
@github-actions

Copy link
Copy Markdown
Contributor

View Vercel preview at instant-www-js-drewh-better-logging-jsv.vercel.app.

@stopachka stopachka 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.

SGTM!

Comment thread client/packages/cli/src/commands/info.ts
Comment thread client/packages/version/src/version.ts Outdated

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 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 `@client/packages/cli/src/commands/info.ts`:
- Around line 36-39: Sanitize the baseUrl value before interpolating it into the
error created in the user-information request handler. Reuse the project’s
existing URL-redaction utility if available, ensuring embedded credentials and
token-bearing query parameters are removed while retaining useful URL context;
keep the original URL for the request itself.
🪄 Autofix (Beta)

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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7366d6f1-a0c9-48e4-9fdb-b969ac2c162f

📥 Commits

Reviewing files that changed from the base of the PR and between c63d6dd and d7db68d.

📒 Files selected for processing (2)
  • client/packages/cli/src/commands/info.ts
  • client/packages/version/src/version.ts

Comment on lines +36 to +39
(e) =>
new Error(`Couldn't get user information (${baseUrl}).`, {
cause: e,
}),

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.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Redact sensitive URL components before logging.

baseUrl may come directly from INSTANT_CLI_API_URI, so interpolating it verbatim can expose embedded credentials or token-bearing query parameters in CLI/CI logs. Log a sanitized URL instead.

🤖 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 `@client/packages/cli/src/commands/info.ts` around lines 36 - 39, Sanitize the
baseUrl value before interpolating it into the error created in the
user-information request handler. Reuse the project’s existing URL-redaction
utility if available, ensuring embedded credentials and token-bearing query
parameters are removed while retaining useful URL context; keep the original URL
for the request itself.

@drew-harris drew-harris changed the title log url on instant-cli errors log url on instant-cli errors (#2806) [bump to v1.0.55] Jul 30, 2026
@drew-harris
drew-harris merged commit 44b78bb into main Jul 30, 2026
35 checks passed
@drew-harris
drew-harris deleted the drewh/better-logging branch July 30, 2026 20:34
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.

3 participants