Skip to content

fix: Handle missing ScanID/TaskID in AddFinding to prevent persistence errors#27

Merged
xkilldash9x merged 1 commit intomainfrom
bugfix-context-add-finding-missing-ids
Nov 25, 2025
Merged

fix: Handle missing ScanID/TaskID in AddFinding to prevent persistence errors#27
xkilldash9x merged 1 commit intomainfrom
bugfix-context-add-finding-missing-ids

Conversation

@google-labs-jules
Copy link
Copy Markdown
Contributor

This PR addresses a runtime error where findings could fail to persist if ScanID or TaskID were missing (empty strings), causing pgx to fail when encoding for UUID columns.

Changes:

  • Modified internal/analysis/core/context.go:
    • AddFinding now checks for missing TaskID (in addition to existing ScanID check) and attempts to fill it from ac.Task.
    • Added a defensive fallback: if either ID remains empty after checking context, it is set to 00000000-0000-0000-0000-000000000000 (Nil UUID).
    • Added warning logs when the fallback mechanism is triggered.

This ensures findings are always persisted with valid UUID formats, even if the context is incomplete, preventing data loss and application errors.


PR created automatically by Jules for task 979387406518472121 started by @xkilldash9x

Refactors AddFinding to populate missing ScanID and TaskID from the
analysis context.
Adds a defensive fallback to a Nil UUID if IDs are still missing,
preventing "unable to encode empty string into binary format for uuid"
errors during database persistence.
Logs a warning when the fallback is used to aid in debugging.
@google-labs-jules
Copy link
Copy Markdown
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@xkilldash9x xkilldash9x marked this pull request as ready for review November 25, 2025 04:36
@xkilldash9x xkilldash9x merged commit 1facbf0 into main Nov 25, 2025
4 of 5 checks passed
@xkilldash9x xkilldash9x deleted the bugfix-context-add-finding-missing-ids branch November 25, 2025 04:37
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