Refactor of Weac - #8
Conversation
|
Warning Rate limit exceeded@zacczakk has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 18 minutes and 25 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (9)
WalkthroughReplace legacy procedural/mixin code with a new object-oriented core (Slab, Scenario, Eigensystem, SlabTouchdown, SystemModel, UnknownConstantsSolver, FieldQuantities), add Pydantic component models and analysis layer (Analyzer, CriteriaEvaluator, Plotter), introduce constants/utilities, CI workflows, many tests/fixtures, demo scripts, a data submodule, and remove numerous legacy modules and tests. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Components as Components (ModelInput, Config)
participant System as SystemModel
participant Core as Eigensystem/Scenario/Solver
participant Analysis as Analyzer/CriteriaEvaluator
participant Plot as Plotter
User->>Components: create ModelInput + Config
User->>System: instantiate SystemModel(model_input, config)
System->>Core: build Slab and Scenario
System->>Core: compute cached Eigensystem
System->>Core: UnknownConstantsSolver.solve_for_unknown_constants(...)
System-->>User: provide field quantities (fq) and z(...)
User->>Analysis: Analyzer(SystemModel) / CriteriaEvaluator(...)
Analysis->>System: request rasterize_solution / find_minimum_force / find_crack_length
Analysis-->>User: raster, stresses, ERR, CoupledCriterionResult
User->>Plot: Plotter.plot_*(Analyzer/SystemModel)
Plot-->>User: saved figure files
sequenceDiagram
participant System as SystemModel
participant TD as SlabTouchdown
participant Solver as UnknownConstantsSolver
System->>TD: instantiate if config.touchdown True
TD-->>System: touchdown_mode, touchdown_distance, collapsed_kR
System->>Solver: solve_for_unknown_constants(..., touchdown params)
Solver-->>System: unknown constants C
Estimated code review effort🎯 5 (Critical) | ⏱️ ~180 minutes ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
bugbot run |
There was a problem hiding this comment.
Bug: Duplicate Methods Cause Redundant Computation
The methods _create_collapsed_eigensystem and _create_collapsed_system are duplicates with identical logic. Both create a collapsed weak layer with modified stiffness and its associated eigensystem, though _create_collapsed_eigensystem takes an unused qs parameter. This leads to redundant, expensive computation as both are called, with the second call overwriting the first's results, and introduces maintenance overhead.
weac_2/core/slab_touchdown.py#L203-L239
weac/weac_2/core/slab_touchdown.py
Lines 203 to 239 in 9b40fef
BugBot free trial expires on July 22, 2025
You have used $0.00 of your $50.00 spend limit so far. Manage your spend limit in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎
There was a problem hiding this comment.
Actionable comments posted: 4
♻️ Duplicate comments (1)
.github/workflows/tests.yml (1)
30-31: Verify tests fail the job on failures (non-zero exit)Confirm tests/run_tests.py exits non-zero on failure. Earlier commits didn’t; your latest changes may have fixed it—let’s verify.
#!/bin/bash set -euo pipefail # Check that the test runner exits non-zero on failure # 1) Ensure a sys.exit based on wasSuccessful() exists in __main__ rg -n -C2 --type=py 'if __name__ == .__main__.:|sys\.exit\(|wasSuccessful\(' tests/run_tests.py || true # 2) Heuristic: look for unittest result used in sys.exit rg -n -C2 --type=py 'result\s*=\s*run_tests\(\)' tests/run_tests.py || trueIf absent, update main:
if __name__ == "__main__": import sys result = run_tests() sys.exit(0 if result.wasSuccessful() else 1)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
.github/workflows/tests.yml(1 hunks)
🔇 Additional comments (1)
.github/workflows/tests.yml (1)
1-11: Triggers and YAML formatting look goodQuoting "on", fixing indentation under steps, and ending with a newline are all addressed. Workflow triggers cover PRs, workflow_call, and manual dispatch appropriately.
There was a problem hiding this comment.
Actionable comments posted: 4
♻️ Duplicate comments (10)
README.md (5)
184-194: Fix header typo: “Exampel 2” → “Example 2”.Keep example headers clean and searchable.
-# Exampel 2: PST +# Example 2: PST
362-366: Remove trailing spaces in fenced code block language tag.The two spaces after “```bash” violate markdownlint; keep indentation and surrounding blank lines as-is.
- ```bash + ```bash git submodule update --init --recursive ```
203-208: Fix undefined variable in ModelInput: uselayers(defined above), notcustom_layers.As written, the snippet will error at runtime.
model_input = ModelInput( weak_layer=weak_layer, scenario_config=skier_config, - layers=custom_layers, + layers=layers, segments=skier_segments, )
218-218: Wording: “cached_properties” → “cached properties”.Also avoid backticks unless referencing a symbol.
-Unknown constants are cached_properties; calling `skier_system.unknown_constants` solves the system of linear equations and extracts the constants. +Unknown constants are cached properties; calling `skier_system.unknown_constants` solves the system of linear equations and extracts the constants.
263-273: Fix terminology and undefined variables (top,mid,bot).
- “weaklayer” → “weak layer” in the comment.
- Replace
top/mid/botwith concrete values or derive fromweak_layer.hso the snippet runs.-# Compute stresses in kPa in the weaklayer +# Compute stresses in kPa in the weak layer tau = skier_system.fq.tau(Z=z_skier, unit='kPa') sig = skier_system.fq.sig(Z=z_skier, unit='kPa') w = skier_system.fq.w(Z=z_skier, unit='um') -# Example evaluation vertical displacement at top/mid/bottom of the slab -u_top = skier_system.fq.u(Z=z_skier, h0=top, unit='um') -u_mid = skier_system.fq.u(Z=z_skier, h0=mid, unit='um') -u_bot = skier_system.fq.u(Z=z_skier, h0=bot, unit='um') +# Example: vertical displacement at top/mid/bottom of the weak layer (mm from top surface) +u_top = skier_system.fq.u(Z=z_skier, h0=0.0, unit='um') +u_mid = skier_system.fq.u(Z=z_skier, h0=weak_layer.h/2, unit='um') +u_bot = skier_system.fq.u(Z=z_skier, h0=weak_layer.h, unit='um') psi = skier_system.fq.psi(Z=z_skier, unit='deg').github/workflows/tests.yml (5)
4-11: Good fix: quoted “on” and clean trigger sectionQuoting the on key and structuring triggers looks correct now. Previous yamllint complaints about truthy “on” are resolved.
4-8: Optionally scope PR triggers to main/developIf you want to limit CI runs to primary branches (as hinted earlier), add a branches filter.
Apply:
pull_request: types: [opened, reopened, synchronize, ready_for_review] + branches: [main, develop]
11-13: Harden workflow: least-privilege token + cancel superseded runsReduce token scope and cancel in-flight runs on new pushes to the same PR.
Apply:
workflow_dispatch: +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs:
28-31: Install build tooling and test extras (if defined)
- Ensure setuptools/wheel are present for PEP 517 builds.
- If you define dev/test extras in pyproject, install them to pull test-only deps; otherwise keep -e . or use requirements.txt.
Option A (preferred if extras exist):
- name: Install dependencies run: | - python -m pip install --upgrade pip - python -m pip install -e . + python -m pip install --upgrade pip setuptools wheel + python -m pip install -e ".[dev]"Option B (fallback if no extras; use requirements.txt):
- name: Install dependencies run: | - python -m pip install --upgrade pip - python -m pip install -e . + python -m pip install --upgrade pip setuptools wheel + python -m pip install -e . + python -m pip install -r requirements.txt
25-27: Include requirements.txt in cache key to improve cache hitsIf you keep a requirements.txt (added in this PR), include it so cache invalidates when deps change there.
Apply:
cache-dependency-path: | pyproject.toml + requirements.txt
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
.github/workflows/tests.yml(1 hunks)README.md(5 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
README.md
37-37: Inline HTML
Element: a
(MD033, no-inline-html)
131-131: Multiple consecutive blank lines
Expected: 1; Actual: 2
(MD012, no-multiple-blanks)
🪛 LanguageTool
README.md
[grammar] ~122-~122: Use correct spacing
Context: ...om/2phi/weac/blob/main/pyproject.toml)): - [Python](https://www.python.org/downloads...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~124-~124: There might be a mistake here.
Context: ...g/downloads/release/python-3120/) ≥ 3.12 - Numpy ≥ 2.0.1 - [Sc...
(QB_NEW_EN)
[grammar] ~125-~125: There might be a mistake here.
Context: ...12 - Numpy ≥ 2.0.1 - Scipy ≥ 1.14.0 ...
(QB_NEW_EN)
[grammar] ~126-~126: There might be a mistake here.
Context: ...Scipy ≥ 1.14.0 - Matplotlib ≥ 3...
(QB_NEW_EN)
[grammar] ~127-~127: There might be a mistake here.
Context: ...lotlib](https://matplotlib.org/) ≥ 3.9.1 - [Pydantic](https://docs.pydantic.dev/late...
(QB_NEW_EN)
[grammar] ~128-~128: There might be a mistake here.
Context: ...ps://docs.pydantic.dev/latest/) ≥ 2.11.7 - [Snowpylot](https://github.com/connellymk...
(QB_NEW_EN)
[grammar] ~129-~129: Use correct spacing
Context: ...github.com/connellymk/snowpylot) ≥ 1.1.3 ## Usage The following describes the basic...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~133-~133: Use correct spacing
Context: ...1.1.3 ## Usage The following describes the basic usage ...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~135-~135: Use correct spacing
Context: ...tps://2phi.github.io/weac/) for details. Load the module. ```python import weac ...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~137-~137: Use correct spacing
Context: ...io/weac/) for details. Load the module. python import weac Choose a snow profile from the preconfig...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~143-~143: Use correct spacing
Context: ...w surface) to bottom (above weak layer). python from weac.components import Layer layers = [ Layer(rho=170, h=100), # (1) surface layer Layer(rho=190, h=40), # (2) Layer(rho=230, h=130), # : Layer(rho=250, h=20), Layer(rho=210, h=70), Layer(rho=380, h=20), # : Layer(rho=280, h=100) # (N) last slab layer above weak layer ] Create a WeakLayer instance that lies un...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~159-~159: Use correct spacing
Context: ... instance that lies underneath the slab. python from weac.components import WeakLayer weak_layer = WeakLayer(rho=125, h=20) Create a Scenario that defines the envir...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~167-~167: There might be a mistake here.
Context: ...environment and setup that the slab and weaklayer will be evaluated in. ```python from w...
(QB_NEW_EN_OTHER)
[grammar] ~167-~167: Use correct spacing
Context: ...slab and weaklayer will be evaluated in. python from weac.components import ScenarioConfig, Segment # Example 1: SKIER skier_config = ScenarioConfig( system_type='skier', phi=30, ) skier_segments = [ Segment(length=5000, has_foundation=True, m=0), Segment(length=0, has_foundation=False, m=80), Segment(length=0, has_foundation=False, m=0), Segment(length=5000, has_foundation=True, m=0), ] # Scenario is a skier of 80 kg standing on a 10 meter long slab at a 30 degree angle # Exampel 2: PST pst_config = ScenarioConfig( system_type='pst-', # Downslope cut phi=30, # (counterclockwise positive) cut_length=300, ) pst_segments = [ Segment(length=5000, has_foundation=True, m=0), Segment(length=300, has_foundation=False, m=0), # Crack Segment ] # Scenario is Downslope PST with a 300mm cut Create SystemModel instance that combine...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[style] ~195-~195: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... is Downslope PST with a 300mm cut ``` Create SystemModel instance that combines the ...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[grammar] ~196-~196: Use correct spacing
Context: ...m solving and field quantity extraction. python from weac.components import Config, ModelInput from weac.core.system_model import SystemModel # Example: build a model for the skier scenario defined above model_input = ModelInput( weak_layer=weak_layer, scenario_config=skier_config, layers=custom_layers, segments=skier_segments, ) system_config = Config( touchdown=True ) skier_system = SystemModel( model_input=model_input, config=system_config, ) Unknown constants are cached_properties;...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~218-~218: There might be a mistake here.
Context: ...em_config, ) ``` Unknown constants are cached_properties; calling `skier_system.unknown_constants...
(QB_NEW_EN_OTHER)
[grammar] ~218-~218: There might be a problem here.
Context: ...ar equations and extracts the constants. python C = skier_system.unknown_constants Analyzer handles rasterization + computation of ...
(QB_NEW_EN_MERGED_MATCH)
[grammar] ~224-~224: There might be a mistake here.
Context: ...weak-layer properties Sxx, Sxz, etc. Prepare the output by rasterizing the so...
(QB_NEW_EN)
[grammar] ~225-~225: Use correct spacing
Context: ...ates that are supported by a foundation. python from weac.analysis.analyzer import Analyzer skier_analyzer = Analyzer(skier_system) xsl_skier, z_skier, xwl_skier = skier_analyzer.rasterize_solution(mode="cracked") Gdif, GdifI, GdifII = skier_analyzer.differential_ERR() Ginc, GincI, GincII = skier_analyzer.incremental_ERR() # and Sxx, Sxz, Tzz, principal stress, incremental_potential, ... Visualize the results. ```python from w...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~237-~237: Use correct spacing
Context: ...tential, ... Visualize the results. python from weac.analysis.plotter import Plotter plotter = Plotter() # Visualize slab profile fig = plotter.plot_slab_profile( weak_layers=weak_layer, slabs=skier_system.slab, ) # Visualize deformations as a contour plot fig = plotter.plot_deformed( xsl_skier, xwl_skier, z_skier, skier_analyzer, scale=200, window=200, aspect=2, field="Sxx" ) # Plot slab displacements (using x-coordinates of all segments, xsl) plotter.plot_displacements(skier_analyzer, x=xsl_skier, z=z_skier) # Plot weak-layer stresses (using only x-coordinates of bedded segments, xwl) plotter.plot_stresses(skier_analyzer, x=xwl_skier, z=z_skier) ``` Compute output/field quantities for expo...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~260-~260: Use correct spacing
Context: ...ld quantities for exporting or plotting. python # Compute stresses in kPa in the weaklayer tau = skier_system.fq.tau(Z=z_skier, unit='kPa') sig = skier_system.fq.sig(Z=z_skier, unit='kPa') w = skier_system.fq.w(Z=z_skier, unit='um') # Example evaluation vertical displacement at top/mid/bottom of the slab u_top = skier_system.fq.u(Z=z_skier, h0=top, unit='um') u_mid = skier_system.fq.u(Z=z_skier, h0=mid, unit='um') u_bot = skier_system.fq.u(Z=z_skier, h0=bot, unit='um') psi = skier_system.fq.psi(Z=z_skier, unit='deg') ## Roadmap See the [open issues](https://g...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~276-~276: Use correct spacing
Context: ...='deg') ``` ## Roadmap See the [open issues](https://github.com...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~278-~278: Use correct spacing
Context: ...t of proposed features and known issues. ### v4.0 - [] Change to scenario & scenario...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~280-~280: Use correct spacing
Context: ...sed features and known issues. ### v4.0 - [] Change to scenario & scenario_config:...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~282-~282: Use correct spacing
Context: ...enario_config: InfEnd/Cut/Segment/Weight ### v3.2 <!-- - [ ] New mathematical foundat...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~284-~284: Use correct spacing
Context: ...fig: InfEnd/Cut/Segment/Weight ### v3.2 - [ ] Complex terrain through the addition...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~286-~286: There might be a mistake here.
Context: ...hrough the addition of out-of-plane tilt - [ ] Up, down, and cross-slope cracks ##...
(QB_NEW_EN)
[grammar] ~287-~287: Use correct spacing
Context: ...t - [ ] Up, down, and cross-slope cracks ### v3.1 - [ ] Improved CriteriaEvaluator O...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~289-~289: Use correct spacing
Context: ..., down, and cross-slope cracks ### v3.1 - [ ] Improved CriteriaEvaluator Optimizat...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~291-~291: Use correct spacing
Context: ...aluator Optimization (x2 time reduction) ## Release history ### v3.0 - Code Refact...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~293-~293: Use correct spacing
Context: ... (x2 time reduction) ## Release history ### v3.0 - Code Refactor - Input Validation...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~295-~295: Use correct spacing
Context: ...reduction) ## Release history ### v3.0 - Code Refactor - Input Validation - Modul...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~297-~297: There might be a mistake here.
Context: ...lease history ### v3.0 - Code Refactor - Input Validation - Modular + Object-Orie...
(QB_NEW_EN)
[grammar] ~298-~298: There might be a mistake here.
Context: ...v3.0 - Code Refactor - Input Validation - Modular + Object-Oriented ### v2.6 - F...
(QB_NEW_EN)
[grammar] ~299-~299: Use correct spacing
Context: ...t Validation - Modular + Object-Oriented ### v2.6 - Finite fracture mechanics implem...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~301-~301: Use correct spacing
Context: ...on - Modular + Object-Oriented ### v2.6 - Finite fracture mechanics implementation...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~305-~305: Use correct spacing
Context: ...tropic weak layer (?) - Add demo gif (?) ### v2.5 - Analyze slab touchdown in PST ex...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~307-~307: Use correct spacing
Context: ...k layer (?) - Add demo gif (?) ### v2.5 - Analyze slab touchdown in PST experiment...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~310-~310: There might be a mistake here.
Context: ...significantly improved API documentation ### v2.4 - Choose between slope-normal (`'-...
(QB_NEW_EN_OTHER)
[grammar] ~312-~312: Use correct spacing
Context: ...tly improved API documentation ### v2.4 - Choose between slope-normal ('-pst', `...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~314-~314: There might be a mistake here.
Context: ...st', 'vpst-'`) PST boundary conditions ### v2.3 - Stress plots on deformed contour...
(QB_NEW_EN_OTHER)
[grammar] ~316-~316: Use correct spacing
Context: ...st-'`) PST boundary conditions ### v2.3 - Stress plots on deformed contours - PSTs...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~318-~318: There might be a mistake here.
Context: ...s ### v2.3 - Stress plots on deformed contours - PSTs now account for slab touchdown ###...
(QB_NEW_EN_OTHER)
[grammar] ~319-~319: There might be a mistake here.
Context: ...rs - PSTs now account for slab touchdown ### v2.2 - Sign of inclination phi consis...
(QB_NEW_EN_OTHER)
[grammar] ~321-~321: Use correct spacing
Context: ...now account for slab touchdown ### v2.2 - Sign of inclination phi consistent wit...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~333-~333: There might be a mistake here.
Context: ...t use of coordinate system with downward pointing z-axis - Consitent top-to-botto...
(QB_NEW_EN_OTHER)
[grammar] ~333-~333: Ensure spelling is correct
Context: ...ate system with downward pointing z-axis - Consitent top-to-bottom numbering of slab layers ...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~334-~334: There might be a mistake here.
Context: ...t top-to-bottom numbering of slab layers - Implementation of PSTs cut from either l...
(QB_NEW_EN)
[grammar] ~335-~335: There might be a mistake here.
Context: ...ayers - Implementation of PSTs cut from either left or right side ### v2.0 - Complet...
(QB_NEW_EN)
[grammar] ~335-~335: Use correct spacing
Context: ... PSTs cut from either left or right side ### v2.0 - Completely rewritten in 🐍 Pytho...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~337-~337: Use correct spacing
Context: ...from either left or right side ### v2.0 - Completely rewritten in 🐍 Python - Coup...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~362-~362: There might be a mistake here.
Context: ...ork the project 2. Initialize submodules bash git submodule update --init --recursive 3. Create your feature branch (`git checkou...
(QB_NEW_EN_OTHER)
[grammar] ~368-~368: There might be a mistake here.
Context: ...git checkout -b feature/amazingfeature) 4. Commit your changes (git commit -m 'Add...
(QB_NEW_EN_OTHER)
[style] ~369-~369: Consider using a more formal and expressive alternative to ‘amazing’.
Context: ...mazingfeature) 4. Commit your changes (git commit -m 'Add some amazing feature') 5. Push to the branch (git ...
(AWESOME)
[grammar] ~369-~369: There might be a mistake here.
Context: ...t commit -m 'Add some amazing feature') 5. Push to the branch (git push origin fea...
(QB_NEW_EN_OTHER)
[grammar] ~371-~371: There might be a mistake here.
Context: .../amazingfeature`) 6. Open a pull request ## Workflows [![Publish Python 🐍 releases ...
(QB_NEW_EN_OTHER)
🔇 Additional comments (7)
README.md (5)
122-130: Good: Runtime dependencies now align with pyproject/CI (Python ≥ 3.12).The dependency block looks correct and matches the refactor direction. Thanks for adding the surrounding blank lines.
230-234: Good: Analyzer now receives the correct model variable and typo fixed.This addresses prior feedback; the example should run as shown.
245-247: Good: Consistent variable names in Plotter usage.
weak_layers=weak_layerandslabs=skier_system.slabare now consistent with earlier definitions.
304-304: Good: “anisotropic” spelling corrected.Resolved prior typo.
314-314: Good: “vertical” spelling corrected.Resolved prior typo in PST boundary conditions section.
.github/workflows/tests.yml (2)
20-27: Nice use of setup-python with cachingUsing cache: 'pip' and check-latest is solid. This will speed up runs and keep 3.12 fresh.
33-34: Tests correctly fail the CI on test failuresConfirmed that
tests/run_tests.pyinvokes:if __name__ == "__main__": unittest_result = run_tests() sys.exit(0 if unittest_result.wasSuccessful() else 1)No changes required.
| jobs: | ||
| test: | ||
| name: Run unit tests 🤖 | ||
| runs-on: ubuntu-latest |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Add a job timeout to prevent stuck runs consuming minutes
Guardrail to auto-cancel if tests hang.
Apply:
test:
name: Run unit tests 🤖
runs-on: ubuntu-latest
+ timeout-minutes: 20📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| jobs: | |
| test: | |
| name: Run unit tests 🤖 | |
| runs-on: ubuntu-latest | |
| jobs: | |
| test: | |
| name: Run unit tests 🤖 | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 |
🤖 Prompt for AI Agents
In .github/workflows/tests.yml around lines 13 to 16, the test job lacks a
timeout and can hang indefinitely; add a job timeout by including a
timeout-minutes field under the job definition (for example timeout-minutes: 20
or another project-appropriate value) to ensure GitHub Actions cancels stuck
runs automatically.
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (3)
.github/workflows/pylint.yml (3)
3-10: Good fix: quoted “on” key; triggers look correct.
Addresses the previous yamllint truthy warning and keeps the intended triggers.
30-68: Fix: lint targets don’t match repo reorg (weac_2/tests_2) and grep can fail the step.
- The PR moved code/tests to weac_2/tests_2. Current command still targets weac/ tests/ and will either do nothing useful or trigger a usage error (32).
- Several grep lines can return non-zero when there are zero matches or when the report file is empty/missing, causing the step to fail under bash -e.
Refactor to dynamically select existing targets and guard summaries.
- name: Run pylint analysis # Using repository pylint config (pyproject.toml) with comprehensive settings for scientific code run: | - exit_code=0 - python -m pylint --rcfile=pyproject.toml --output-format=parseable --output=pylint-report.txt weac/ tests/ || exit_code=$? + set +e # we'll manage exit codes manually + exit_code=0 + : > pylint-report.txt # ensure file exists even if pylint errors early + + # Build target list compatible with repo reorg (prefer new dirs, fall back to legacy) + TARGET_DIRS="" + for d in weac_2 weac tests_2 tests; do + [ -d "$d" ] && TARGET_DIRS="$TARGET_DIRS $d" + done + if [ -z "$TARGET_DIRS" ]; then + echo "No target directories found for pylint (checked: weac_2, weac, tests_2, tests)." + echo "Skipping pylint run." + exit 0 + fi + + python -m pylint --output-format=parseable --output=pylint-report.txt $TARGET_DIRS || exit_code=$? echo "Pylint finished with exit code $exit_code." echo echo "Pylint exit code meaning:" if [ $exit_code -eq 0 ]; then echo "-> No issues found"; fi if [ $((exit_code & 1)) -ne 0 ]; then echo "-> Fatal message issued"; fi if [ $((exit_code & 2)) -ne 0 ]; then echo "-> Error message issued"; fi if [ $((exit_code & 4)) -ne 0 ]; then echo "-> Warning message issued"; fi if [ $((exit_code & 8)) -ne 0 ]; then echo "-> Refactor message issued"; fi if [ $((exit_code & 16)) -ne 0 ]; then echo "-> Convention message issued"; fi if [ $((exit_code & 32)) -ne 0 ]; then echo "-> Usage error"; fi echo echo 'Error type counts:' - grep -oP '[A-Z]\d+\([a-z\-]+\)' pylint-report.txt | sort | uniq -c | sort -nr + grep -oP '[A-Z]\d+\([a-z\-]+\)' pylint-report.txt | sort | uniq -c | sort -nr || true echo echo 'Errors per file:' - grep -oP '^[\w\-\/]+\.py' pylint-report.txt | sort | uniq -c | sort -nr + grep -oP '^[\w\-\/]+\.py' pylint-report.txt | sort | uniq -c | sort -nr || true echo echo 'Total errors:' - grep -oP '^[\w\-\/]+\.py' pylint-report.txt | wc -l + grep -oP '^[\w\-\/]+\.py' pylint-report.txt | wc -l || true echo grep 'Your code' pylint-report.txt || true # Fail on fatal, error, and usage error. # These are severe and should block PRs. # Warnings (4), refactors (8), and conventions (16) will not cause a failure. fail_on_codes=$((1 | 2 | 32)) if [ $((exit_code & fail_on_codes)) -ne 0 ]; then echo "Failing CI due to fatal/error/usage messages from pylint." exit 1 else echo "Pylint check passed. No fatal/error/usage messages." fiNotes:
- If your pylint config lives in pyproject.toml, you can drop the explicit --rcfile flag; pylint auto-detects pyproject. Keep it only if you’ve verified it’s needed.
12-15: Add least-privilege permissions to harden the workflow.
Explicitly scope the token to read-only. Top-level preferred so all jobs inherit it."on": pull_request: types: [opened, reopened, synchronize, ready_for_review] workflow_call: workflow_dispatch: +permissions: + contents: read + jobs: pylint:
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
.github/workflows/pylint.yml(1 hunks)
| - name: Set up Python 3.12 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
| cache: "pip" | ||
|
|
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Optional: improve pip cache effectiveness with dependency path hints.
actions/setup-python can hash your requirements to invalidate cache correctly.
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
+ cache-dependency-path: |
+ requirements.txt
+ pyproject.toml
+ setup.cfg
+ setup.py
+ environment.yml📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: "pip" | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: "pip" | |
| cache-dependency-path: | | |
| requirements.txt | |
| pyproject.toml | |
| setup.cfg | |
| setup.py | |
| environment.yml |
🤖 Prompt for AI Agents
In .github/workflows/pylint.yml around lines 19 to 24, the workflow uses
actions/setup-python with cache: "pip" but does not provide
cache-dependency-path, so the cache won’t be invalidated when requirements
change; add the cache-dependency-path input pointing to your dependency files
(e.g. **/requirements.txt, **/pyproject.toml, **/setup.cfg or other files you
use) so the action will hash those files and invalidate the pip cache when they
change.
| echo 'Error type counts:' | ||
| grep -oP '[A-Z]\d+\([a-z\-]+\)' pylint-report.txt | sort | uniq -c | sort -nr | ||
| echo | ||
| echo 'Errors per file:' | ||
| grep -oP '^[\w\-\/]+\.py' pylint-report.txt | sort | uniq -c | sort -nr | ||
| echo | ||
| echo 'Total errors:' | ||
| grep -oP '^[\w\-\/]+\.py' pylint-report.txt | wc -l | ||
| echo | ||
| grep 'Your code' pylint-report.txt || true |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Optional: drop grep -P for portability.
GNU grep -P is fine on ubuntu-latest, but can be disabled elsewhere. Consider awk/sed for portability if you reuse locally.
Example replacement for the three grep -oP pipelines:
- Error types:
awk '{ if (match($0, /[A-Z][0-9]+([a-z-]+)/, a)) print a[0] }' pylint-report.txt | sort | uniq -c | sort -nr || true - Per-file:
awk -F: 'NF>1 &&$1 ~ /.py$ / {print $1}' pylint-report.txt | sort | uniq -c | sort -nr || true - Total errors:
awk -F: 'NF>1 &&$1 ~ /.py$ /' pylint-report.txt | wc -l || true
🤖 Prompt for AI Agents
In .github/workflows/pylint.yml around lines 47 to 56 the workflow uses grep -P
(Perl regex) which is not portable; replace the three grep -oP pipelines with
POSIX-safe awk (or sed) equivalents that extract the same fields (error type
tokens, filenames, and count of errors), preserve the same sorting/uniq logic
and ensure the pipeline exits zero on no matches (append || true where needed),
and keep the surrounding echo lines and output ordering unchanged.
🚨 Bugbot Trial ExpiredYour Bugbot trial has expired. Please purchase a license in the Cursor dashboard to continue using Bugbot. |
…ecated highlighting extension
Complete Refactor of CodeBase
Reasons:
Draft:
In the draft the weac package is refactored in weac_2 and integration tests are provided in tests_2.
Additionally, a streamlit App is provided to test the implementation.
Next steps:
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Tests
Chores