Skip to content

add: solvent logs — tail and filter the structured event log#43

Merged
ianalloway merged 1 commit into
mainfrom
claude/solvent-logs
Jun 30, 2026
Merged

add: solvent logs — tail and filter the structured event log#43
ianalloway merged 1 commit into
mainfrom
claude/solvent-logs

Conversation

@ianalloway

Copy link
Copy Markdown
Owner

Summary

Completes the operator visibility triangle alongside solvent status and solvent jobs.

  • solvent logs — show last 20 lines of data/solvent.log (human-readable columnar)
  • solvent logs -n 50 — show last N lines
  • solvent logs -f / --follow — live-follow like tail -f (0.5 s poll, Ctrl-C exits)
  • solvent logs --job <id> — filter by job ID prefix match
  • solvent logs --stage <stage> — filter by pipeline stage name
  • solvent logs --json — raw JSON output for scripting/monitoring
  • solvent logs --path — print the log file path and exit

Pure stdlib — no new dependencies.

Test plan

  • python3 -m pytest tests/test_logs.py -v → 29 passed
  • python3 -m pytest -q → 414 passed, 6 skipped
  • solvent logs on empty log → "(no log entries)"
  • solvent logs --json → valid JSON per line
  • solvent logs --stage fulfill → only fulfill entries
  • solvent logs -f → live output on new events

🤖 Generated with Claude Code

https://claude.ai/code/session_01SGjM79GJpSksy9wSSBa7e6


Generated by Claude Code

- solvent logs          show last 20 log lines (human-readable)
- solvent logs -n 50   show last 50 lines
- solvent logs -f      live-follow like tail -f (0.5s poll)
- solvent logs --job   filter by job ID prefix
- solvent logs --stage filter by pipeline stage name
- solvent logs --json  raw JSON output for scripting
- solvent logs --path  print the log file path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SGjM79GJpSksy9wSSBa7e6
@ianalloway ianalloway marked this pull request as ready for review June 30, 2026 16:52
Copilot AI review requested due to automatic review settings June 30, 2026 16:52

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ianalloway ianalloway merged commit 21cf362 into main Jun 30, 2026
5 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: db77d69e3a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread solvent/logs.py
Comment on lines +42 to +43
def _fmt_margin(m: float) -> str:
return f"{m * 100:.1f}%"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Stop multiplying percentage margins again

When a booked job is logged, StageRunner._emit stores margin_actual from actual_margin_pct, and service.reconcile_cogs already computes that field on a 0–100 percentage scale. Formatting it here as m * 100 makes normal human log output report values like 8000.0% for an 80% margin, which undermines the new operator-facing financial log view.

Useful? React with 👍 / 👎.

Comment thread solvent/logs.py
Comment on lines +123 to +124
if not follow:
lines = _tail_lines(path, max(n * 4, 200)) # over-fetch then filter

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Apply job and stage filters before truncating the log

When --job or --stage is used, this only reads the most recent max(n * 4, 200) physical log lines before filtering, so an active install can print (no matching entries) for a valid job or stage as soon as more than that many unrelated events have been appended. The advertised filter should either scan/filter the log before taking the last n matches, or clearly restrict itself to the recent physical tail.

Useful? React with 👍 / 👎.

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.

3 participants