Skip to content

update#5

Merged
koudis merged 1 commit intomainfrom
update_override_behav
Jan 10, 2026
Merged

update#5
koudis merged 1 commit intomainfrom
update_override_behav

Conversation

@koudis
Copy link
Member

@koudis koudis commented Jan 10, 2026

Summary by CodeRabbit

  • Tests

    • Updated system name override test scenarios to reflect revised validation logic.
  • Chores

    • Refined system name override handling in build configuration to adjust when system name cache is applied.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 10, 2026

Walkthrough

This PR modifies the system name override handling logic in CMCONF.cmake by inverting conditional behavior for warning/error emission, relocating cache assignment to an else-branch to defer property setting until system name is determined as new, and updates corresponding test cases with revised system name placeholders (OVERRIDE_SYSTEM and ORIGINAL_SYSTEM) and cache variable type adjustments.

Changes

Cohort / File(s) Summary
Core Logic
CMCONF.cmake
Inverted conditional logic for CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED: warnings now emit when ON, fatal errors when OFF (reversed from previous). Moved cache assignment from post-conditional line to dedicated else-branch, deferring property setting until new system name is confirmed.
Test Expectations
test/test_cases/pass/system_name_override_allowed/CMakeLists.txt
Updated expected warning message assertion: changed system name references from FIRST_SYSTEM → SECOND_SYSTEM to OVERRIDE_SYSTEM → ORIGINAL_SYSTEM, and updated corresponding tag reference.
Test Configuration
test/test_cases/pass/system_name_override_allowed/test_config/CMakeLists.txt
Changed CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED cache type from INTERNAL to BOOL. Added CMCONF_SYSTEM_NAME pre-set to "OVERRIDE_SYSTEM". Renamed initial system initialization from FIRST_SYSTEM to ORIGINAL_SYSTEM. Updated validation logic to check against OVERRIDE_SYSTEM instead of SECOND_SYSTEM.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Allow system name reinit #4: Modifies CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED handling and system-name override control flow with related test updates.

Poem

🐰 A system name shift, both bold and true,
Conditions inverted—the old makes way for new,
From FIRST to ORIGINAL, a naming refrain,
Cache paths redirected through logic's domain!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'update' is too vague and generic; it does not convey meaningful information about the specific changes made to the system name override behavior and test cases. Revise the title to be more descriptive, such as 'Invert system name override behavior and update tests' or similar, to clearly indicate the main purpose of the changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update_override_behav

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
CMCONF.cmake (1)

184-189: Documentation is inconsistent with implementation.

The documentation states "the system name can be changed" when CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED=ON, but the implementation at lines 206-214 does not change the system name—it only emits a warning and keeps the existing value.

Please update the documentation to accurately describe the behavior:

  • When CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED=ON: The existing CMCONF_SYSTEM_NAME is preserved, and a warning is emitted about the attempted re-initialization.
  • When CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED=OFF: A fatal error is raised.
🤖 Fix all issues with AI agents
In @CMCONF.cmake:
- Around line 206-214: The warning message inside the
IF(CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED) branch is misleading because no override
is actually performed; update the _CMCONF_MESSAGE(...) invocation so it does not
say "Overriding ... to ..." but instead clearly states an attempted override was
detected and that the cache value CMCONF_SYSTEM_NAME remains unchanged (use
CMCONF_SYSTEM_NAME and system_name_upper to compose the message), e.g.
"Attempted to override system name from 'X' to 'Y' — override not applied;
current value remains 'X'"; keep this change in the branch where
CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED is checked and leave the ELSE() FATAL_ERROR
behavior unchanged.

In @test/test_cases/pass/system_name_override_allowed/CMakeLists.txt:
- Around line 15-17: The test's expected WARNING_MESSAGE in
TEST_RUN_AND_CHECK_OUTPUT is misleading because CMCONF.cmake preserves the
system name as 'OVERRIDE_SYSTEM' rather than changing it to 'ORIGINAL_SYSTEM';
update the expected warning text to reflect that the override was ignored (e.g.,
"Ignoring request to change system name from 'OVERRIDE_SYSTEM' to
'ORIGINAL_SYSTEM'" or "System name 'OVERRIDE_SYSTEM' preserved; ignoring
'ORIGINAL_SYSTEM'") so the test expectation matches the actual behavior of
CMCONF.cmake and the test config.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5066f04 and 454431c.

📒 Files selected for processing (3)
  • CMCONF.cmake
  • test/test_cases/pass/system_name_override_allowed/CMakeLists.txt
  • test/test_cases/pass/system_name_override_allowed/test_config/CMakeLists.txt
⏰ 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: test_windows
🔇 Additional comments (1)
test/test_cases/pass/system_name_override_allowed/test_config/CMakeLists.txt (1)

10-17: LGTM—test correctly validates the override behavior.

The test appropriately:

  1. Pre-sets CMCONF_SYSTEM_NAME to simulate a command-line override
  2. Enables CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED
  3. Calls CMCONF_INIT_SYSTEM with a different name
  4. Verifies the pre-set value is preserved

The change from CACHE INTERNAL to CACHE BOOL for CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED is appropriate since this is a user-configurable option.

Comment on lines +206 to 214
IF(CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED)
_CMCONF_MESSAGE(WARNING "Overriding system name from '${CMCONF_SYSTEM_NAME}' to '${system_name_upper}'")
ELSE()
_CMCONF_MESSAGE(FATAL_ERROR "System name already set. Cannot change system name from '${CMCONF_SYSTEM_NAME}' to '${system_name_upper}'")
ENDIF()
ENDIF()
ELSE()
SET_PROPERTY(CACHE CMCONF_SYSTEM_NAME PROPERTY VALUE "${system_name_upper}")
ENDIF()
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Warning message is misleading—no override actually occurs.

When CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED=ON and the names differ, the warning at line 207 says "Overriding system name from 'X' to 'Y'", but the system name is not changed—it remains X. This is confusing because:

  1. The word "Overriding" implies the name is being changed
  2. The order "from 'X' to 'Y'" suggests Y becomes the new value

Consider rewording to accurately reflect what happens:

Suggested fix
             IF(CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED)
-                _CMCONF_MESSAGE(WARNING "Overriding system name from '${CMCONF_SYSTEM_NAME}' to '${system_name_upper}'")
+                _CMCONF_MESSAGE(WARNING "System name already set to '${CMCONF_SYSTEM_NAME}'; ignoring attempt to initialize as '${system_name_upper}'")
             ELSE()
📝 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.

Suggested change
IF(CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED)
_CMCONF_MESSAGE(WARNING "Overriding system name from '${CMCONF_SYSTEM_NAME}' to '${system_name_upper}'")
ELSE()
_CMCONF_MESSAGE(FATAL_ERROR "System name already set. Cannot change system name from '${CMCONF_SYSTEM_NAME}' to '${system_name_upper}'")
ENDIF()
ENDIF()
ELSE()
SET_PROPERTY(CACHE CMCONF_SYSTEM_NAME PROPERTY VALUE "${system_name_upper}")
ENDIF()
IF(CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED)
_CMCONF_MESSAGE(WARNING "System name already set to '${CMCONF_SYSTEM_NAME}'; ignoring attempt to initialize as '${system_name_upper}'")
ELSE()
_CMCONF_MESSAGE(FATAL_ERROR "System name already set. Cannot change system name from '${CMCONF_SYSTEM_NAME}' to '${system_name_upper}'")
ENDIF()
ENDIF()
ELSE()
SET_PROPERTY(CACHE CMCONF_SYSTEM_NAME PROPERTY VALUE "${system_name_upper}")
ENDIF()
🤖 Prompt for AI Agents
In @CMCONF.cmake around lines 206 - 214, The warning message inside the
IF(CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED) branch is misleading because no override
is actually performed; update the _CMCONF_MESSAGE(...) invocation so it does not
say "Overriding ... to ..." but instead clearly states an attempted override was
detected and that the cache value CMCONF_SYSTEM_NAME remains unchanged (use
CMCONF_SYSTEM_NAME and system_name_upper to compose the message), e.g.
"Attempted to override system name from 'X' to 'Y' — override not applied;
current value remains 'X'"; keep this change in the branch where
CMCONF_SYSTEM_NAME_OVERRIDE_ALLOWED is checked and leave the ELSE() FATAL_ERROR
behavior unchanged.

Comment on lines 15 to 17
TEST_RUN_AND_CHECK_OUTPUT("test_config"
WARNING_MESSAGE "CMCONF\\\\[FIRST_SYSTEM\\\\] - Overriding system name from 'FIRST_SYSTEM' to.*'SECOND_SYSTEM'"
WARNING_MESSAGE "CMCONF\\\\[OVERRIDE_SYSTEM\\\\] - Overriding system name from 'OVERRIDE_SYSTEM' to.*'ORIGINAL_SYSTEM'"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Warning message expectation may be misleading.

The expected warning says "Overriding system name from 'OVERRIDE_SYSTEM' to 'ORIGINAL_SYSTEM'", but based on the implementation in CMCONF.cmake and the test config, the system name actually remains OVERRIDE_SYSTEM (it is not changed to ORIGINAL_SYSTEM). The warning message is therefore misleading—it implies a change that doesn't occur.

Consider rephrasing to something like:

  • "Ignoring request to change system name from 'OVERRIDE_SYSTEM' to 'ORIGINAL_SYSTEM'"
  • "System name 'OVERRIDE_SYSTEM' preserved; ignoring 'ORIGINAL_SYSTEM'"
🤖 Prompt for AI Agents
In @test/test_cases/pass/system_name_override_allowed/CMakeLists.txt around
lines 15 - 17, The test's expected WARNING_MESSAGE in TEST_RUN_AND_CHECK_OUTPUT
is misleading because CMCONF.cmake preserves the system name as
'OVERRIDE_SYSTEM' rather than changing it to 'ORIGINAL_SYSTEM'; update the
expected warning text to reflect that the override was ignored (e.g., "Ignoring
request to change system name from 'OVERRIDE_SYSTEM' to 'ORIGINAL_SYSTEM'" or
"System name 'OVERRIDE_SYSTEM' preserved; ignoring 'ORIGINAL_SYSTEM'") so the
test expectation matches the actual behavior of CMCONF.cmake and the test
config.

@koudis koudis merged commit b0a92a6 into main Jan 10, 2026
14 checks passed
@koudis koudis deleted the update_override_behav branch January 10, 2026 14:44
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.

1 participant

Comments