-
Notifications
You must be signed in to change notification settings - Fork 1
Hotfix zmskvr set workstation select resolve references from 3 to 2 #1620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Hotfix zmskvr set workstation select resolve references from 3 to 2 #1620
Conversation
WalkthroughReduced reference-resolution depth: Changes
Sequence Diagram(s)(No sequence diagram provided — changes are a parameter adjustment and a small safeguard, not a control-flow modification.) Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)**/*⚙️ CodeRabbit configuration file
Files:
**/*.php⚙️ CodeRabbit configuration file
Files:
🧬 Code graph analysis (1)zmsdb/src/Zmsdb/Department.php (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (1)
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. Comment |
|
@coderabbitai problem is now the cluster location names no longer show up in the selection list in zmsadmin. They show up in the list as deleted locations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
zmsadmin/src/Zmsadmin/WorkstationSelect.php (1)
25-25: Accept change (resolveReferences 3 → 2); document rationale and extract magic number.
- Evidence: WorkstationSelectTest and codebase searches show resolveReferences => 2 is expected and sufficient (zmsadmin/src/Zmsadmin/WorkstationSelect.php:25; zmsadmin/tests/Zmsadmin/WorkstationSelectTest.php).
- Downstream: LoginForm::writeWorkstationUpdate only uses useraccount-level fields and the template receives the workstation object (zmsadmin/src/Zmsadmin/Helper/LoginForm.php; zmsadmin/templates/page/workstationSelect.twig).
- Action items (non-blocking): add a one-line comment or PR note stating why resolution was reduced (e.g. performance/over‑fetching) and replace the literal 2 with a named constant to avoid the magic number.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
zmsadmin/src/Zmsadmin/WorkstationSelect.php(1 hunks)zmsadmin/tests/Zmsadmin/WorkstationSelectTest.php(6 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*
⚙️ CodeRabbit configuration file
**/*: Apply the following Clean Code guidelines to all files, as summarized by wojteklu's Clean Code gist:Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
General rules
- Follow standard conventions.
- Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.
Design rules
- Keep configurable data at high levels.
- Prefer polymorphism to if/else or switch/case.
- Separate multi-threading code.
- Prevent over-configurability.
- Use dependency injection.
- Follow Law of Demeter. A class should know only its direct dependencies.
Understandability tips
- Be consistent. If you do something a certain way, do all similar things in the same way.
- Use explanatory variables.
- Encapsulate boundary conditions. Boundary conditions are hard to keep track of. Put the processing for them in one place.
- Prefer dedicated value objects to primitive type.
- Avoid logical dependency. Don't write methods which works correctly depending on something else in the same class.
- Avoid negative conditionals.
Names rules
- Choose descriptive and unambiguous names.
- Make meaningful distinction.
- Use pronounceable names.
- Use searchable names.
- Replace magic numbers with named constants.
- Avoid encodings. Don't append prefixes or type information.
Functions rules
- Small.
- Do one thing.
- Use descriptive names.
- Prefer fewer arguments.
- Have no side effects.
- Don't use flag arguments. Split method into several independent methods that can b...
Files:
zmsadmin/src/Zmsadmin/WorkstationSelect.phpzmsadmin/tests/Zmsadmin/WorkstationSelectTest.php
**/*.php
⚙️ CodeRabbit configuration file
**/*.php: Flag any usage of error_log() as it should be replaced with proper Monolog logging mechanisms provided by zmsslim which should be setup in the App/Application of each module:
- For error handling: Use the proper Monolog logging framework with error levels
- For application info logs: Use the proper Monolog logging framework with info levels
- For debugging: Use a dedicated debug logger or remove debug statements
- For CLI output: Use a CLI output handler or symfony/console
- The application log levels are as follows DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, and EMERGENCY
Example replacement:
// Instead of: error_log("Import failed - " . $e->getMessage()); // Use: $log->error("Import failed", ['error' => $e->getMessage()]);Flag specific logging violations:
- error_log(), var_dump(), print_r(), die(), exit() usage (except proper error logging in catch blocks)
- Any debug output that should use proper Monolog logging
- Debug constants like DEBUG = true
- Debug logging that should be removed in production
- Commented debug code that should be cleaned up
Example replacements:
// Instead of: error_log("Error occurred"); var_dump($data); die('debug point'); // Use: $log->error("Error occurred", ['context' => 'processing']); $log->debug('Data dump', ['data' => $data]); // Remove die() statements entirelyException handling should use proper logging:
// Instead of: try { $result = $this->process(); } catch (Exception $e) { error_log("Processing failed: " . $e->getMessage()); } // Use: try { $result = $this->process(); } catch (Exception $e) { $log->error("Processing failed", ['error' => $e->getMessage(), 'trace' => $e->getTraceAsString()]); } ```...
Files:
zmsadmin/src/Zmsadmin/WorkstationSelect.phpzmsadmin/tests/Zmsadmin/WorkstationSelectTest.php
🧬 Code graph analysis (2)
zmsadmin/src/Zmsadmin/WorkstationSelect.php (1)
zmsclient/src/Zmsclient/Http.php (1)
readGetResult(175-188)
zmsadmin/tests/Zmsadmin/WorkstationSelectTest.php (1)
zmsapi/tests/Zmsapi/Base.php (1)
readFixture(31-38)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: call-php-unit-tests / zmsdb-test
🔇 Additional comments (2)
zmsadmin/tests/Zmsadmin/WorkstationSelectTest.php (2)
20-21: LGTM - Tests properly updated to match implementation change.All test expectations have been correctly updated to reflect the reduced
resolveReferencesparameter (from 3 to 2) and corresponding fixture files have been changed fromresolved3.jsontoresolved2.json. This ensures that tests validate the actual behavior of the updated code.Also applies to: 38-38, 55-56, 61-61, 82-83, 88-88, 133-134, 139-139
110-111: No action needed – fixture file is correct.The fixture
GET_Workstation_Resolved2.jsonis a valid file in the repository. The naming difference from other tests is intentional:GET_Workstation_Resolved2.json(without "with_process") represents a basic resolved workstation, whileGET_workstation_with_process_resolved2.jsonis used when process information is relevant. For a validation failure test, using the simpler fixture is appropriate.
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 5504 🏁 Script executed: Length of output: 883 🏁 Script executed: Length of output: 10009 🏁 Script executed: Length of output: 12070 🏁 Script executed: Length of output: 7837 🏁 Script executed: Length of output: 6089 🏁 Script executed: Length of output: 1435 🏁 Script executed: Length of output: 2714 🏁 Script executed: Length of output: 12689 🏁 Script executed: Length of output: 595 🏁 Script executed: Length of output: 1102 🏁 Script executed: Length of output: 8738 🏁 Script executed: Length of output: 0 🏁 Script executed: Length of output: 14006 @ThomasAFink I've identified the root cause of the issue. Let me explain what's happening: Problem AnalysisWhen you changed With
With
Looking at the fixture file "scopes": [
{
"id": "140",
"$ref": "/scope/140/"
}
]They're missing the Where the Problem ManifestsIn {% for cluster in department.clusters %}
{% for scope in cluster.scopes %}
{% set scopeOptionsGroupOptions = scopeOptionsGroupOptions|merge([{ "value": scope.id, "name": providername(scope) }]) %}
{% endfor %}
{% endfor %}The SolutionYou'll need to revert to If there was a specific performance reason for reducing to level 2, we'd need to investigate alternative approaches, such as:
Would you like me to help investigate why this change was made in the first place, or would you prefer to simply revert it? |
Pull Request Checklist (Feature Branch to
next):nextBranch in meinen Feature-Branch gemergt.Summary by CodeRabbit