Skip to content

fix: bare except clauses, noisy logging, and dead type annotation in API server and frontend handlers#5364

Merged
michaelkedar merged 3 commits into
google:masterfrom
Saatvik-GT:fix/bare-except-and-dead-annotation
May 15, 2026
Merged

fix: bare except clauses, noisy logging, and dead type annotation in API server and frontend handlers#5364
michaelkedar merged 3 commits into
google:masterfrom
Saatvik-GT:fix/bare-except-and-dead-annotation

Conversation

@Saatvik-GT
Copy link
Copy Markdown
Contributor

Fixes : #5363

Summary

  • Replace 4 bare except: blocks in _match_versions and _match_events (gcp/api/server.py)
    with except Exception: to prevent silently swallowing SystemExit and KeyboardInterrupt
  • Downgrade logging.errorlogging.debug for the ecosystem helper failure path,
    addressing the existing TODO(michaelkedar): This log is noisy comments
  • Remove dead source_path: str type annotation in add_source_info
    (gcp/website/frontend_handlers.py) — variable is already bound via partition(':')
    on line 517, making the annotation misleading

Files Changed

  • gcp/api/server.py_match_versions, _match_events
  • gcp/website/frontend_handlers.pyadd_source_info

Testing

No behavior change intended. The except Exception: narrowing is strictly safer and
the log level change matches the intent described in the existing TODO comment.

… noise

- Replace 4 bare `except:` blocks in _match_versions/_match_events with
  `except Exception:` to avoid silently catching SystemExit/KeyboardInterrupt
- Downgrade the noisy ecosystem-helper logging.error to logging.debug as
  noted by the existing TODO(michaelkedar) comments
- Remove dead `source_path: str` type annotation in add_source_info that
  was misleading (variable is already bound on line 517)
Copy link
Copy Markdown
Member

@michaelkedar michaelkedar left a comment

Choose a reason for hiding this comment

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

Thanks!

@michaelkedar
Copy link
Copy Markdown
Member

/gcbrun

@Saatvik-GT
Copy link
Copy Markdown
Contributor Author

Thanks!

Thank you for the approval! I don't have access to the GCB logs, is there anything I can do on my end to fix the snapshot test failure, or is it something that needs to be handled internally?

@michaelkedar
Copy link
Copy Markdown
Member

Thanks!

Thank you for the approval! I don't have access to the GCB logs, is there anything I can do on my end to fix the snapshot test failure, or is it something that needs to be handled internally?

Sorry this is an unrelated failure. I will merge this PR when we've dealt with it

@michaelkedar
Copy link
Copy Markdown
Member

/gcbrun

@michaelkedar michaelkedar merged commit 3d8edfc into google:master May 15, 2026
21 checks passed
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.

bug: bare except clauses in API server silently swallow SystemExit/KeyboardInterrupt

2 participants