Skip to content

Ticket9007 config macro fix - #1874

Merged
Tom-Willemsen merged 8 commits into
masterfrom
Ticket9007_Config_Macro_Fix
Aug 11, 2026
Merged

Ticket9007 config macro fix#1874
Tom-Willemsen merged 8 commits into
masterfrom
Ticket9007_Config_Macro_Fix

Conversation

@Chsudeepta

Copy link
Copy Markdown
Contributor

Description of work

Fixes the bug reported here

Comment on lines +152 to +153

m.setValue(null);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need this set - we're not doing anything with it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Removed.

@Tom-Willemsen

Copy link
Copy Markdown
Member

Minor regression: when setting a macro for the first time, the value textbox now needs a double click to begin entering text, rather than a single click before you could start typing previously.

@Tom-Willemsen

Tom-Willemsen commented Aug 11, 2026

Copy link
Copy Markdown
Member

As @FreddieAkeroyd reported on teams, if you untick the use default box but don't actually type a value, it uses value = null and doesn't write it to the XML in the blockserver. It should use value = "" rather than null initially for this case.

This causes the config to be corrupt and the blockserver to fail to load it on restart:

[2026-08-11 14:46:31.935967] MAJOR: Could not load last configuration. Message was: Element '{http://epics.isis.rl.ac.uk/schema/iocs/1.0}macro': The attribute 'value' is required but missing., line 36

}

@Test
public void test_GIVEN_macro_with_value_WHEN_view_model_created_THEN_use_default_is_false() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Test name is now wrong.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Corrected. Name hasn't been changed.

@Tom-Willemsen

Copy link
Copy Markdown
Member

With the latest change, I started with a brand-new TRITON_02 IOC and added 4 macros like this:

image

When I then save this new IOC, the macros are saved in the XML as:

	<ioc name="TRITON_02" autostart="true" restart="true" simlevel="none">
		<macros>
			<macro name="CHANNEL_POLL_RATE" value="" description="The poll rate of channel values." pattern="^.*$" defaultValue="10 second" hasDefault="YES"/>
			<macro name="IPADDR" value="" description="IP address to connect to." pattern="^.*$" defaultValue="localhost" hasDefault="YES"/>
			<macro name="IPPORT" value="" description="Port to connect to (defaults to 33576)." pattern="^[0-9]+$" defaultValue="33576" hasDefault="YES"/>
			<macro name="POLL_RATE" value="" description="The poll rate of non-channel values." pattern="^.*$" defaultValue="1 second" hasDefault="YES"/>
		</macros>
		<pvs/>
		<pvsets/>
	</ioc>

i.e. all the values are value="". If I then go to save the config again, then they will be saved correctly the second time.

@Tom-Willemsen

Copy link
Copy Markdown
Member

It looks like we are somehow mixing the XML that defines macro-defaults (the one with a description attribute), with the JSON which gets passed to the blockserver and later turned into XML. This feels like the most likely source of many of these bugs. These two XMLs should be entirely independent.

@Tom-Willemsen
Tom-Willemsen merged commit 3a678bc into master Aug 11, 2026
8 checks passed
@Tom-Willemsen
Tom-Willemsen deleted the Ticket9007_Config_Macro_Fix branch August 11, 2026 19:22
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.

2 participants