Repository navigation
refactor(b08): explicit startup config normalization; import no longer mutates os.environ - #590
Merged
Merged
Conversation
…s.environ writes - move plugin-mount / monitor-dispatch strategy_profile normalization into pure application/startup_config.py (same rules, same [config-sync] log lines) - main import no longer writes os.environ; corrected monitor dispatch targets are read through an explicit overlay (identical call when nothing was corrected) - frozen settings are dataclasses.replace()d instead of object.__setattr__ - adopted corrections recorded in STARTUP_CONFIG_RECEIPT - parity tests against verbatim copies of the pre-B08 inline logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary — B08 batch 1 (QSL-MODULAR-AUDIT §10: "显式化配置解析;先保持原归一化行为,采用值有回执,模块 import 不改 os.environ;默认策略变化另开 PR")
application/startup_config.py:normalize_plugin_mounts_strategy,normalize_monitor_dispatch_targets,overlay_env,ConfigCorrection,StartupConfigReceipt. Noos.environreads/writes inside.main.pyimport no longer writesos.environ[MONITOR_DISPATCH_TARGETS_JSON | LONGBRIDGE_MONITOR_DISPATCH_TARGETS_JSON]. Corrections are kept inMONITOR_DISPATCH_ENV_OVERRIDES;/monitor-dispatchreads throughoverlay_env(os.environ, overrides)(only consumer of these names in LB). With no corrections the call is byte-identical to before (load_monitor_targets()).PlatformRuntimeSettingsisdataclasses.replace()d instead ofobject.__setattr__(non-dataclass test doubles still use setattr).STARTUP_CONFIG_RECEIPT(profile, each correction source/field/original/adopted, overridden env names).[config-sync] …log lines unchanged.Parity
tests/test_startup_config.pykeeps verbatim copies of the pre-B08 inline logic (main@fe16142) and checks 9 plugin-mount inputs + 8 env inputs (malformed JSON, non-dict, non-list, matching/non-matching profiles, non-ASCII, mixed entries): same output, same log lines, input env not mutated.MONITOR_DISPATCH_TARGETS_JSON→os.environunchanged after import, receipt recorded, dispatcher sees corrected targets.Not in scope
No default-strategy change, no HK scheduler /
enable-hk-*/ PAUSED-resume change, no env/secret/traffic/deploy. Remaining B08 work: rest of module-level config resolution inmain.py(RUNTIME_SETTINGS → STRATEGY_RUNTIME globals) into an explicit startup context.Author: Pigbibi.