Skip to content

refactor(config)!: make JSON authoritative for event settings - #401

Merged
plexoos merged 9 commits into
mainfrom
rename-config-event-mode
Oct 20, 2026
Merged

plexoos merged 9 commits into
mainfrom
rename-config-event-mode

Conversation

@plexoos

@plexoos plexoos commented Jul 6, 2026 •

Copy link
Copy Markdown
Member

Summary

Make typed simphony::Config defaults plus the selected JSON profile the authoritative source for modeled event settings.

  • Add typed JSON fields for retained event, resource, propagation, output, and input controls.
  • Apply the complete configuration deterministically through the existing SEventConfig facade before event creation.
  • Remove obsolete and legacy OPTICKS_* event-setting support, including values that were previously read and then silently overwritten.
  • Migrate shipped profiles, scripts, asynchronous examples, and DD4hep integration to named JSON configurations.
  • Document the complete event schema, defaults, discovery behavior, and configuration lifecycle.
  • Expand configuration tests and make source fixtures work when Simphony is embedded with add_subdirectory.

Breaking changes

  • Legacy OPTICKS_* variables for modeled event settings are no longer honored. Set these values in the selected JSON profile.
  • event.mode has been replaced by event.event_mode; the old key is rejected with an explanatory error.
  • Applications must construct simphony::Config before creating event or geometry consumers.

SIMPHONY_CONFIG_DIR and SIMPHONY_PTX_DIR remain supported as discovery variables; they are not event settings.

Migration

Select a configuration basename with -c or --config:

SIMPHONY_CONFIG_DIR=$PWD/config \
    GPUPhotonSourceMinimal \
    -g tests/geom/wls_test.gdml \
    -c wls_test \
    -m tests/run.mac

Move runtime settings into the profile’s event object:

{
  "event": {
    "event_mode": "HitPhoton",
    "integration_mode": 1,
    "max_bounce": 100,
    "maxslot": 100000,
    "output_dir": "./output"
  }
}

Scope

The legacy G4CX layer is not being modernized here because it is scheduled for removal in a separate PR.

@plexoos
plexoos marked this pull request as ready for review July 6, 2026 22:20
Copilot AI review requested due to automatic review settings July 6, 2026 22:20
@plexoos
plexoos force-pushed the rename-config-event-mode branch from 6ff6222 to b4c320f Compare July 6, 2026 22:21
@plexoos plexoos self-assigned this Jul 6, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6ff6222679

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sysrap/config.cpp Resolved

Copilot AI 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.

Pull request overview

This PR refactors the event persistence mode configuration key by renaming the JSON field from event.mode to event.event_mode, updating both the C++ config reader and the checked-in sample config files so that Config continues to drive SEventConfig correctly.

Changes:

  • Update Config::ReadConfig to read the event mode from event.event_mode instead of event.mode.
  • Reorder Config’s event_mode member placement and adjust Config::Apply() call ordering for SEventConfig::SetEventMode.
  • Update sample JSON configs to use "event_mode".

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sysrap/config.h Moves event_mode member (no semantic change by itself).
sysrap/config.cpp Reads renamed JSON key and applies SEventConfig::SetEventMode.
config/wls_test.json Updates event mode key to "event_mode".
config/trap_iso.json Updates event mode key to "event_mode".
config/sphere_leak.json Updates event mode key to "event_mode".
config/dev.json Updates event mode key to "event_mode" and reorders within the object.
config/8x8SiPM_crystal.json Updates event mode key to "event_mode".

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sysrap/config.cpp Resolved
@plexoos
plexoos force-pushed the rename-config-event-mode branch from b4c320f to a270d5c Compare October 18, 2026 00:49
@plexoos
plexoos requested a balanced review from Copilot October 18, 2026 16:23

Copilot AI 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.

🟡 Changes recommended

Standalone diagnostics still lack JSON initialization, and configuration fixture discovery breaks in embedded builds.

3 open issues
1 resolved since last review

Review effort: Balanced

Comment thread sysrap/SEventConfig.cc Resolved
Comment thread sysrap/tests/CMakeLists.txt Resolved
@plexoos plexoos changed the title refactor(config): rename event mode key refactor(config)!: make JSON authoritative for event settings Oct 18, 2026
@plexoos
plexoos force-pushed the rename-config-event-mode branch 2 times, most recently from cdab874 to 04de536 Compare October 20, 2026 01:35
Finish the event_mode rename across every shipped JSON profile and move the WLS event policy, bounce
limit, and slot capacity out of its shell environment into wls_test.json.

Remove redundant legacy overrides from Config-backed timing and photon-file workflows, pass an
explicit JSON profile through the performance runner, and update the WLS output path for the
simplified event_reldir default.

Add a ConfigTest matrix covering the intended event policy of every shipped profile. JSON and script
syntax checks pass, ConfigTest is green, and test_GPUPhotonFileSource.sh passes end to end; the WLS
comparison skips because its external validator is unavailable.
Add typed Config fields for the retained SEventConfig runtime, resource, propagation, output, and input controls, parse them from the event object, and apply them through the existing low-level facade.

Preserve useful OPTICKS_* settings as a one-release compatibility fallback when JSON keys are omitted, make explicit JSON values authoritative, and emit migration warnings that name the replacement keys.

Extend ConfigTest to cover the complete JSON contract, adapter application, and precedence behavior. Also add the missing event-skipahead setter and non-lossy max-simtrace setter.
Stop loading obsolete, overwritten, or policy-derived OPTICKS_* values for event naming, per-event test counts, debug buffer maxima, legacy RNG/photon caps, save/client modes, compressed-record domains, ray-generation mode, component masks, and unused input selection.

Keep the internal SEventConfig state required by existing allocation and programmatic callers, but derive component masks and debug maxima from event policy and default ray generation to simulate. Replace the disconnected event-name expansion with event.event_reldir.

Add a fresh-process CTest that sets every retired variable and proves none affects runtime state. The complete enabled SysRap suite passes (101 tests; one pre-existing test disabled).
Reject event.mode explicitly instead of silently retaining the inherited or default event mode after the JSON schema rename.

Point users to event.event_mode and cover the behavior in ConfigTest while leaving the valid torch.mode setting on its existing parser path.
Keep Config::output_dir at the current working directory when SEventConfig only contains its unresolved $DefaultOutputDir sentinel. Continue inheriting explicit JSON, environment, and programmatic output-directory values.

Add regression coverage for omitted event.output_dir and document the distinction between application defaults and low-level SEvt path handling. This restores hit arrays and timing CSVs for the affected integration tests.
Make typed Config defaults plus the selected JSON file the sole source of modeled event settings, and apply every value deterministically through SEventConfig.

Migrate the async and DD4hep examples to named JSON profiles, initialize DD4hep configuration once per process, and require C++20 for the plugin target.

Remove retired variable names from code and documentation, update affected configuration files, and expand ConfigTest coverage for absent and empty event objects.
Resolve ConfigTest's source fixture directory relative to the SysRap test CMake file instead of the parent project's CMAKE_SOURCE_DIR. This keeps source-profile checks working when Simphony is included with add_subdirectory.
@plexoos
plexoos force-pushed the rename-config-event-mode branch from ea9fbcf to f7ec8ca Compare October 20, 2026 03:24
@plexoos

plexoos commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T03:28:54.851338Z f7ec8ca Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: f7ec8caf67

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@plexoos
plexoos merged commit 2d06b05 into main Oct 20, 2026
24 checks passed
@plexoos
plexoos deleted the rename-config-event-mode branch October 20, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants