Skip to content

mctest: --comp follows INHERIT - #3093

Open
willend wants to merge 1 commit into
mainfrom
mctest-comp-follow-inherit
Open

willend wants to merge 1 commit into
mainfrom
mctest-comp-follow-inherit

Conversation

@willend

@willend willend commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Free-form text area

mctest/mxtest --comp=X now also selects instruments using components that INHERIT from X (followed transitively). Closes the CI gap described in #3091: #3088 changed Fluorescence, but the FluoPowder users SOLEIL_CRISTAL and SOLEIL_MARS were never tested.

The CI workflows already pass --comp=<changed comps>, so they need no change, and McStas and McXtrace are covered by the same code. The widened list is shown in the existing "Instrument list includes those using component(s) ..." log line.

Examples of the widening (selection block run against the component trees of this branch):

--comp Widens to Instruments selected
Fluorescence (McXtrace) FluoCrystal,FluoPowder,Fluo_detector,Fluorescence 15, now including SOLEIL_CRISTAL and SOLEIL_MARS
Slit (McXtrace) Diaphragm,Slit 46
Monitor_nD (McStas) Monitor_Sqw,Monitor_nD,StatisticalChopper_Monitor,Union_abs_logger_nD,Union_abs_logger_nD_scintillator 156
Single_crystal (McStas) unchanged (nothing inherits it in McStas) 22
Unittest_IO_parent (McStas) Unittest_IO_cancel,Unittest_IO_extend,Unittest_IO_keep,Unittest_IO_noinit,Unittest_IO_parent 1 (Unittest_INHERIT_OVERRIDE)

Side effects:

  • A change to an inherited component tests more instruments than before.

Over-matching

The search is a plain text match of INHERIT <word> over the whole .comp file. It does not parse the component, so it also matches in comments and in the doc header. A component that only mentions INHERIT X in text is treated as derived from X, and its users get tested when X changes.

  • This can add unneeded tests, never drop needed ones.
  • On current main there are 64 matches in 25 component files, 5 of them in comments or doc headers. None of the 5 produces a false derivation today:
    • NMO.comp, MCPL_input_once.comp, Unittest_IO_extend.comp (S and X): prose such as "uses INHERIT of all sections", where the matched word (of, within) is not a component name.
    • FluoPowder.comp: the comment "we can't INHERIT Fluorescence ..." matches, but the component does SHARE INHERIT Fluorescence anyway.
  • A future comment naming a real component after INHERIT would cause a false derivation. Accepted to keep this at a few lines instead of a parser.

Declaration of use of AI-tools

  • Please add a checkmark here if you used AI-tools during the work for this contribution
  • Furter, please describe how / where and for what the tools were used: Claude Code wrote the change and checked the resulting instrument selection.

Development OS / boundary conditions

Developed on macOS. The new selection block was run against the mcstas-comps and mcxtrace-comps trees of this branch to list the selected instruments (table above). A full mctest/mxtest run with --comp was not done, and nothing was tested on Linux or Windows; the code is plain Python (re, pathlib).


PR Checklist for contributing to McStas/McXtrace


🤖 Generated with Claude Code

…n ones

Refs #3091

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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