Skip to content

Fix #82: audit and standardize logging behavior#98

Closed
RandomOscillations wants to merge 3 commits intomainfrom
codex/issue-82-logging-standardization
Closed

Fix #82: audit and standardize logging behavior#98
RandomOscillations wants to merge 3 commits intomainfrom
codex/issue-82-logging-standardization

Conversation

@RandomOscillations
Copy link
Copy Markdown
Collaborator

Summary

  • replace non-CLI print() paths in network metrics and hydration orchestration with module logger usage
  • harden provider request/response debug logging with recursive sanitization:
    • redact secrets (api_key, auth/token-like fields)
    • redact prompt/content-style payload text while preserving lengths
    • preserve numeric token usage counters
  • avoid logging raw pass-1 prompts in sync reasoning debug output
  • add docs/logging-guidelines.md to document logging conventions and safety expectations
  • add tests validating redaction behavior and ensuring verbose network validation logs via logger (not stdout)

Testing

  • pytest -q tests/test_logging.py tests/test_reasoning_execution.py::test_two_pass_high_fidelity_classifies_private_and_public_positions_separately tests/test_engine.py::TestFlipResistance::test_public_position_prefers_explicit_public_field
  • ruff check extropy/core/providers/logging.py extropy/population/network/metrics.py extropy/population/spec_builder/hydrator.py extropy/simulation/reasoning.py tests/test_logging.py

Closes #82

Copy link
Copy Markdown
Collaborator

@DeveshParagiri DeveshParagiri left a comment

Choose a reason for hiding this comment

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

Code Review

Verdict: ✅ Ready to merge

Summary

Standardizes logging practices and adds comprehensive security hardening for sensitive data redaction.

Changes

Area Fix
print() statements Replaced with logger.info() in metrics.py, hydrator.py
Secret redaction api_key, token, password, etc. → [REDACTED_SECRET]
Text redaction prompt, content, reasoning, etc. → [REDACTED_TEXT length=N]
Long strings Truncated at 200 chars with ...[truncated]
Token counts Preserved (whitelist)
Documentation New docs/logging-guidelines.md

Security Analysis

  • ✅ Recursive sanitization handles nested structures
  • ✅ Broad text markers catch various sensitive fields
  • ✅ Preserves useful metadata (token counts, model, IDs)
  • ✅ Pass-1 prompt logging now only logs length

Tests

4 tests validate redaction of secrets and text content.

No changes required.

@DeveshParagiri DeveshParagiri changed the base branch from codex/issue-90-identity-threat-framing to main February 17, 2026 19:03
@DeveshParagiri
Copy link
Copy Markdown
Collaborator

Closing - branch was stacked on blocked PRs. Recreated as clean PR from main.

@DeveshParagiri DeveshParagiri deleted the codex/issue-82-logging-standardization branch February 23, 2026 01:54
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.

Audit and standardize logging across extropy

2 participants