Skip to content

feat(logging): add structured progress output and stdlib logging - #54

Merged
d-lazenby merged 9 commits into
mainfrom
27-improve-workflow-run-output-for-clearer-progress-and-troubleshooting
Aug 11, 2026
Merged

feat(logging): add structured progress output and stdlib logging#54
d-lazenby merged 9 commits into
mainfrom
27-improve-workflow-run-output-for-clearer-progress-and-troubleshooting

Conversation

@d-lazenby

Copy link
Copy Markdown
Contributor

Replaces sparse print() calls with structured, levelled log output across the module update workflow.

Closes #27

Changes

  • Add log.py wrapper backed by Python's logging module (LOG_LEVEL env var, [%(levelname)s] format)
  • Add stage-level lifecycle messages in main(): manifest loaded, discovery, processing, run summary
  • Add per-module progress in both process functions: query start, ref/version resolution, and outcome (updated / unchanged / skipped)
  • Surface zero-replacement causes: no target files resolved (WARN) vs ref/version already current (INFO)
  • Migrate bare print([SKIP]) calls to log.skip()
  • Fix update_github_module and update_registry_module to count only actual file changes, not regex matches — prevents false updated outcomes when a module is already at the latest ref/version

Tests

  • New tests for lifecycle output, per-module outcomes, skip paths, zero-replacement cause hints and already-current ref/version cases
  • Migrate all output assertions in test_app.py from capsys to caplog

- New log.py with info/warn/skip/error helpers
- Lifecycle messages in app.py: manifest loaded, discovery, processing, completed
- Test lifecycle output in test_app.py
- Log module query start, resolved ref/version, and outcome (updated/
  unchanged/skipped) for both github and registry modules in app.py
- Migrate bare print([SKIP]) calls to log.skip()
- Add tests covering start, resolution, skip and outcome log lines for both module types
- Return ModuleOutcome("updated"|"unchanged"|"skipped") from both
  process functions instead of a raw int
- Aggregate outcomes in main() and emit a final [INFO] Run summary
  line with modules/updated/unchanged/skipped/replacements counts
- Update tests to assert on outcome.outcome and outcome.replacements
  and verify the summary line is present in lifecycle output
@d-lazenby
d-lazenby requested a review from a team as a code owner August 10, 2026 13:47
@d-lazenby d-lazenby linked an issue Aug 10, 2026 that may be closed by this pull request

@small-e small-e 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.

mostly looks good - a couple of questions to address before approval though

Comment thread src/update_tf_modules/app.py Outdated
Comment thread src/update_tf_modules/log.py Outdated

def skip(message: str) -> None:
_logger.info("[SKIP] %s", message)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ah I see where the skip is coming in. I am questioning whether this module and these functions are worthwhile since it doesn't seem there isn't anything really being added to logging (not really). Another consideration is that adding the skip caught me off guard because it strays from convention - so I would recommend not adding this module but sticking to logging conventions. I won't let it block approval if you feel strongly though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was for convenience when I was refactoring but agree it's confusing and needs tidying up. I'll keep a single logging configuration point and switch modules to standard module-level loggers. For skip events, I'll emit INFO with explicit skipped outcome/reason fields for clarity.

Comment thread tests/test_app.py Outdated
manifest_path, _, _, _ = manifest_data
tmp_root = manifest_path.parent

from update_tf_modules import discovery, targets

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

curious as to why you are importing within the test here? It seems a bit inconsistent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. The local imports were mainly for patching convenience while I was wiring integration-style tests, but they are not strictly required - I'll move them to module scope for consistency.

@small-e small-e 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.

Thanks for addressing the comments

@d-lazenby
d-lazenby merged commit dcb72e5 into main Aug 11, 2026
5 checks passed
@d-lazenby
d-lazenby deleted the 27-improve-workflow-run-output-for-clearer-progress-and-troubleshooting branch August 11, 2026 14:07
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.

Improve workflow run output for clearer progress and troubleshooting

2 participants