feat: render qt/ at deploy time and enforce the suffix (step 4)
qt/ was declared a render path in step 1 but nothing rendered it: the Qt
deploy step was a plain rsync, so the UI files shipped with literal
placeholders in every PV name.
* deploy.yml renders the deployed qt/ directory with render_subs.py
after the rsync. No --service is needed; qt holds no per-service
token, and a file that acquired one would fail the step rather than
ship the placeholder.
* bin/sls_hla_launch_gui.sh no longer passes an AGEBD_ENV_SUFFIX macro.
No .ui file has referenced $(AGEBD_ENV_SUFFIX) since a06fded, and the
suffix is now baked in at deploy time. This removes the last
hardcoded '-DEV' outside config/environments.yml.
check_ui_files.py is rewritten for the chosen convention. It asserted the
old caQtDM macro, and its regex had stopped matching anything at all once
placeholders appeared in device names -- against the pre-fix Service
Manager it inspected 0 names, where the new check finds 16 violations.
The new rule: every AGEBD- device name carries the suffix token, except
systemd unit names, which are the same in both environments. The token
name is read from the central config so a rename cannot leave this check
enforcing a stale one.
Fixing what that check surfaced, all in A_BD_ServiceManager.ui:
* 16 'IOC=AGEBD-CPCL-<NAME>' caInclude macro values had no suffix. The
included UI uses them as PV prefixes ($(IOC):STATUS, $(IOC):RESTART),
so the dev Service Manager was reading status from, and sending
restarts to, production IOCs.
* Two ssh commands hardcoded sls-vserv-bd-hla01, so the dev GUI's
restart button targeted the production HLA host.
* cli generates those macro values, so the generator emits the token
too and new services are no longer born with the bug.
These were latent while qt/ shipped unrendered placeholders; turning
rendering on would have made them live.
Verified: dev renders -DEV device names and the -dev host, prod renders
byte-identical to the currently deployed prod files, no placeholder
survives in either, and all 24 UI files stay well-formed XML.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
5e4246508b
commit
ee5f331f4c
@@ -1,5 +1,67 @@
|
||||
from ci.check_ui_files import check_ui_files
|
||||
import pytest
|
||||
from agebd.subs import SubstitutionsConfig
|
||||
from agebd.utils import get_git_root
|
||||
|
||||
from ci.check_ui_files import check_ui_file, check_ui_files, suffix_token
|
||||
|
||||
REPO_ROOT = get_git_root(__file__)
|
||||
TOKEN = "@@agebd_env_suffix_upper@@"
|
||||
|
||||
|
||||
def test_check_ui_files():
|
||||
@pytest.fixture
|
||||
def token():
|
||||
return suffix_token(SubstitutionsConfig.load(REPO_ROOT / "config"))
|
||||
|
||||
|
||||
def test_repo_ui_files_all_carry_the_suffix():
|
||||
check_ui_files()
|
||||
|
||||
|
||||
def test_token_comes_from_the_central_config(token):
|
||||
assert token == TOKEN
|
||||
|
||||
|
||||
def test_pv_name_with_the_suffix_is_accepted(token):
|
||||
text = f'<string notr="true">AGEBD-ALH{TOKEN}:NTURNS-ONOFF</string>'
|
||||
|
||||
assert check_ui_file(text, token, "A_BD_NTurns.ui") == []
|
||||
|
||||
|
||||
def test_pv_name_without_the_suffix_is_reported(token):
|
||||
text = '<string notr="true">AGEBD-ALH:NTURNS-ONOFF</string>'
|
||||
|
||||
errors = check_ui_file(text, token, "A_BD_NTurns.ui")
|
||||
|
||||
assert len(errors) == 1
|
||||
assert "AGEBD-ALH" in errors[0]
|
||||
assert "A_BD_NTurns.ui:1" in errors[0]
|
||||
|
||||
|
||||
def test_ioc_macro_value_without_the_suffix_is_reported(token):
|
||||
"""This is the bug that had the dev Service Manager driving prod IOCs."""
|
||||
text = "<string>IOC=AGEBD-CPCL-NTURNS,service=NTURNS,name=NTurns</string>"
|
||||
|
||||
errors = check_ui_file(text, token, "A_BD_ServiceManager.ui")
|
||||
|
||||
assert len(errors) == 1
|
||||
assert "AGEBD-CPCL-NTURNS" in errors[0]
|
||||
|
||||
|
||||
def test_systemd_unit_name_is_exempt(token):
|
||||
text = "<string>systemctl --user restart AGEBD-SERVICE-MASTER.service</string>"
|
||||
|
||||
assert check_ui_file(text, token, "A_BD_ServiceManager.ui") == []
|
||||
|
||||
|
||||
def test_other_facilities_are_not_our_business(token):
|
||||
text = "<string>IOC=AGEOP-CPCL-SHIFTTOOL,service=SHIFTTOOL</string>"
|
||||
|
||||
assert check_ui_file(text, token, "A_BD_ServiceManager.ui") == []
|
||||
|
||||
|
||||
def test_reports_the_line_number(token):
|
||||
text = "line one\nline two\n<string>AGEBD-TUNE:AO</string>\n"
|
||||
|
||||
errors = check_ui_file(text, token, "A_BD_Tune.ui")
|
||||
|
||||
assert "A_BD_Tune.ui:3" in errors[0]
|
||||
|
||||
Reference in New Issue
Block a user