Skip to content

Handle errors in lookup script#5096

Merged
lukaszgryglicki merged 7 commits into
devfrom
unicron-handle-errors-in-lookup-script
Jun 24, 2026
Merged

Handle errors in lookup script#5096
lukaszgryglicki merged 7 commits into
devfrom
unicron-handle-errors-in-lookup-script

Conversation

@lukaszgryglicki

Copy link
Copy Markdown
Member

Signed-off-by: Lukasz Gryglicki lgryglicki@cncf.io

Assisted by OpenAI

Assisted by GitHub Copilot

Assisted by Claude

Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)

Assisted by [Claude](https://claude.ai)
@lukaszgryglicki lukaszgryglicki self-assigned this Jun 24, 2026
Copilot AI review requested due to automatic review settings June 24, 2026 05:07
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

The AWS log search script now captures command output in a temporary file and reports AWS and jq failures separately. The log lookup script now exits immediately when a command fails.

Changes

Log Error Handling

Layer / File(s) Summary
Temp file capture and error reporting
utils/search_aws_log_group.sh
The AWS log search script writes filter-log-events output to raw_log, removes the temp file on exit, and handles AWS failures and jq parse failures with distinct exit codes and messages.
Fail-fast lookup behavior
utils/lookup_all_logs.sh
The log lookup script enables strict shell options, updates argument and stage checks for unset-variable safety, and adds comments describing immediate termination on helper failure.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description only contains sign-off and attribution metadata, so it doesn't describe the changeset. Add a brief summary of the script error-handling changes and affected files.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: improving error handling in lookup-related shell scripts.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch unicron-handle-errors-in-lookup-script

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

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

Updates the utils/search_aws_log_group.sh helper to better distinguish “no matching CloudWatch log events” from AWS CLI failures (e.g., expired SSO / missing permissions), so users don’t misinterpret an empty result as “no hits”.

Changes:

  • Adds post-command error handling intended to detect AWS CLI failures after piping results through jq.
  • Emits a clearer error message and exits non-zero when AWS fails, rather than returning an empty/[]-looking result.

Comment thread utils/search_aws_log_group.sh Outdated
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)

Assisted by [Claude](https://claude.ai)

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread utils/search_aws_log_group.sh Outdated

@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

🤖 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 `@utils/search_aws_log_group.sh`:
- Around line 98-108: The new AWS and jq exit codes in search_aws_log_group.sh
are not being propagated by the caller, so lookup_all_logs.sh can still succeed
even when a log lookup fails. Update the logic in lookup_all_logs.sh around the
individual calls to the log-search helper so it checks each returned status,
stops immediately on nonzero rc, and returns that failure instead of relying on
the final ls result; use the existing helper/script names to locate the affected
call sites and make the error contract fail fast end-to-end.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7b77b7cc-3386-4562-b90b-b823fa9010b8

📥 Commits

Reviewing files that changed from the base of the PR and between d8a4645 and d2b0cc8.

📒 Files selected for processing (1)
  • utils/search_aws_log_group.sh

Comment thread utils/search_aws_log_group.sh Outdated
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)

Assisted by [Claude](https://claude.ai)

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

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

Comment thread utils/search_aws_log_group.sh Outdated
Comment thread utils/search_aws_log_group.sh Outdated
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)

Assisted by [Claude](https://claude.ai)

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

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

Comment thread utils/search_aws_log_group.sh Outdated
Comment thread utils/lookup_all_logs.sh Outdated
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)

Assisted by [Claude](https://claude.ai)

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

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

Comment thread utils/search_aws_log_group.sh Outdated
Comment thread utils/search_aws_log_group.sh Outdated
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)

Assisted by [Claude](https://claude.ai)

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread utils/search_aws_log_group.sh Outdated
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)

Assisted by [Claude](https://claude.ai)

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread utils/search_aws_log_group.sh
@lukaszgryglicki lukaszgryglicki merged commit a24c46c into dev Jun 24, 2026
10 checks passed
@lukaszgryglicki lukaszgryglicki deleted the unicron-handle-errors-in-lookup-script branch June 24, 2026 11:26
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