Skip to content

Convert FOM extract to strategy pattern [AI] - #1727

Merged
douglasjacobsen merged 5 commits into
Ramble-Project:developfrom
rfbgo:an_strat
Sep 4, 2026
Merged

Convert FOM extract to strategy pattern [AI]#1727
douglasjacobsen merged 5 commits into
Ramble-Project:developfrom
rfbgo:an_strat

Conversation

@rfbgo

@rfbgo rfbgo commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

This is some nice OOP around fom extraction, that allows for different methods of extraction

In some situations (such as no contexts) this allows us to have an optimized extract that swap out the full scan "forward last wins" and instead read the file backwards and stop early

class BackwardsAnalysisStrategy(AnalysisStrategyBase):
    """Optimized analysis strategy that reads logs backwards and stops early."""

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the analysis logic in Ramble by introducing a strategy pattern. It extracts the analysis code from the application base class into a new ramble.analysis package, implementing both the original ForwardAnalysisStrategy and a new, optimized BackwardsAnalysisStrategy that reads log files backwards to allow early termination. Unit tests are also added to verify these strategies. The review feedback highlights a bug in the backwards file reader where leading empty lines could be ignored, and points out potential runtime errors in BackwardsAnalysisStrategy due to missing local imports of ramble.analysis in fallback blocks.

Comment thread lib/ramble/ramble/analysis/backwards.py Outdated
Comment thread lib/ramble/ramble/analysis/backwards.py
Comment thread lib/ramble/ramble/analysis/backwards.py
@ramble-pr-bot

ramble-pr-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

Ramble Performance Test Metrics

Results produced with commit: 82e734e

Test Name Outcome Duration (s) Most Recent Run (s) Last 5 Avg (s)
test_analyze_large_file passed 1.0770 2.0963 (8c2f07e) 2.0865
test_large_template_expansion passed 1.6441 1.7311 (8c2f07e) 1.6590
test_many_experiments passed 24.6267 25.5761 (8c2f07e) 25.5208
test_many_objects_defaults passed 13.9427 14.6309 (8c2f07e) 14.6471
test_matrix_filter_perf passed 1.1250 1.1806 (8c2f07e) 1.1818

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.81395% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.96%. Comparing base (8c2f07e) to head (82e734e).
⚠️ Report is 38 commits behind head on develop.

Files with missing lines Patch % Lines
lib/ramble/ramble/analysis/forward.py 92.90% 10 Missing ⚠️
lib/ramble/ramble/analysis/backwards.py 95.33% 7 Missing ⚠️
lib/ramble/ramble/analysis/base.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1727      +/-   ##
===========================================
+ Coverage    93.94%   93.96%   +0.01%     
===========================================
  Files          367      372       +5     
  Lines        36605    36906     +301     
===========================================
+ Hits         34389    34678     +289     
- Misses        2216     2228      +12     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rfbgo
rfbgo marked this pull request as draft August 19, 2026 17:16
@rfbgo
rfbgo marked this pull request as ready for review August 24, 2026 15:50

@rfbgo rfbgo left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@dcoapp recheck

rfbgo and others added 5 commits September 3, 2026 12:14
Signed-off-by: Bob <robertbird@google.com>
Signed-off-by: Bob <robertbird@google.com>
Signed-off-by: Bob <robertbird@google.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Bob <robertbird@google.com>
Signed-off-by: Bob <robertbird@google.com>
@douglasjacobsen
douglasjacobsen merged commit b6667ce into Ramble-Project:develop Sep 4, 2026
22 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.

2 participants