Skip to content

feat: --debug flag, centralized logging, surface swallowed upsert errors (#246)#252

Merged
cdot65 merged 4 commits into
mainfrom
cdot65/feat/observability-debug
Jul 7, 2026
Merged

feat: --debug flag, centralized logging, surface swallowed upsert errors (#246)#252
cdot65 merged 4 commits into
mainfrom
cdot65/feat/observability-debug

Conversation

@cdot65

@cdot65 cdot65 commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a global --debug flag and centralizes logging config at CLI entry with a quiet WARNING default. Fixes identity upserts swallowing real update errors via except Exception: pass.

Changes

  • scm --debug <cmd>: root DEBUG, un-pins scm.auth/oauthlib loggers (OAuth traffic finally visible), full tracebacks from handle_command_errors
  • Logging configured once in main callback (precedence --debug > SCM_LOG_LEVEL > context/settings > WARNING); invalid levels warn + fall back instead of crashing (SCM_LOG_LEVEL=VERBOSE used to AttributeError)
  • Removed logging.basicConfig(force=True) + logger pinning from SCMClient.__init__
  • 6 identity upserts now catch (NotFoundError, ObjectNotPresentError) only — update failures propagate with the real API error
  • Removed the duplicated, backwards show_context_info stderr banners (objects/insights/mobile_agent)
  • Context-config read failure now logged instead of silently swallowed
  • scm context create default log level INFO → WARNING; settings.yaml default WARNING

Testing

  • New tests/test_debug_and_logging.py (9 tests): debug flag levels/unpinning, traceback on/off, invalid+valid SCM_LOG_LEVEL, upsert propagation + not-found fall-through
  • Full suite: 1281 passed, 29 skipped; lint/ruff/mypy clean; docs build passes
  • E2E: default run silent on stderr; --debug shows SDK logs; VERBOSE warns

Checklist

  • Tests written first (TDD)
  • All tests passing
  • Lint/format/typecheck clean
  • Documentation updated
  • Changeset added

Closes #246

🤖 Generated with Claude Code

@cursor

cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Failed to generate code suggestions for PR

@cdot65 cdot65 merged commit d92622b into main Jul 7, 2026
2 checks passed
@cdot65 cdot65 deleted the cdot65/feat/observability-debug branch July 7, 2026 02:16
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.

feat: --debug flag, centralized logging config, un-pin auth loggers, fix swallowed upsert errors

1 participant