Skip to content

[LLM-authored] EPICS record alias support to softioc - #210

Open
klenze wants to merge 1 commit into
DiamondLightSource:masterfrom
klenze:aliases
Open

[LLM-authored] EPICS record alias support to softioc#210
klenze wants to merge 1 commit into
DiamondLightSource:masterfrom
klenze:aliases

Conversation

@klenze

@klenze klenze commented Jul 27, 2026

Copy link
Copy Markdown

Oh not, the billionth AI slop PR on github. In my defense, your project does not have a clear LLM policy I could find, so I decided to just try how you would react, with a "Lol, nope. close ban" well within my expected response range.

For what it's worth, this is my first LLM-coauthored PR ever, and I spent a few iterations until I had something which I found comfortable even suggesting adding to a repository of human-readable code. (My main goal was to figure out what the bots can and can't do these days, so I got something out of this either way.)

--

For our use case, we have two different kinds of EPICS pathes:

  • By function (detectorname:hv:ch1:setVoltage)
  • By path (pi3-022:hv:ch1:setVoltage)

Previously, we used epics gateways for these mappings, but now I want to switch to simple alias names. So far, pythonSoftIOC does not support aliases, adding them from user code requires keeping extra state.

Thus I have added three new functions to builder:

  • Alias(target, alias), which is the most general case.
  • An alias argument in aOut and friends, for convenience
  • AddDeviceAlias(aliasPrefix) which is something not supported by EPICS natively (AFAIK). The idea is to populate two or more prefix namespaces at the same time (which would be most convenient for my use case).

Sadly, unlike unix pathes and (to some extend) DNS, EPICS pathes do not have a clear way to distinguish absolute from relative pathes. Currently, I have the heuristic that names with a colon in them are absolute and names without them are relative, but on reflection this it would probably be better to have users prefix ':' (or another character) to indicate absolute pathes (a la unix), in alias context (though it does not work in epics generally), because PV names having additional colons in them (as in ch1:setVoltage) is a common.

This is the current state, let me know if this is something which you might be interested in or if it is a hard no for design or tool reasons.

Cheers,
Philipp

--

Claude-generated log message:

Adds three ways to create EPICS record aliases: an alias keyword argument on record creation functions (aIn, aOut, etc.), a standalone Alias(name, alias_name) function for aliasing an existing record by name, and AddDeviceAlias(prefix) for automatically aliasing every record subsequently created under the current device with an alternate prefix. Device-alias-prefixed names are generated for a record's own aliases too, always pointing directly at the real record rather than chaining through another alias.

Built entirely on epicsdbbuilder's existing alias primitives, with no changes needed to epicsdbbuilder or epicscorelibs. PV-naming mistakes (unknown alias targets, name collisions between records and aliases in either direction, oversized generated names, and cases where a device alias prefix can't sensibly apply to a name) are validated eagerly and raise immediately, rather than being deferred to LoadDatabase().

Also adds the dbla command to the interactive_ioc shell for listing record aliases, matching the existing dbl/dbgf/etc. commands.

Adds three ways to create EPICS record aliases: an `alias` keyword
argument on record creation functions (aIn, aOut, etc.), a standalone
Alias(name, alias_name) function for aliasing an existing record by
name, and AddDeviceAlias(prefix) for automatically aliasing every
record subsequently created under the current device with an
alternate prefix. Device-alias-prefixed names are generated for a
record's own aliases too, always pointing directly at the real record
rather than chaining through another alias.

Built entirely on epicsdbbuilder's existing alias primitives, with no
changes needed to epicsdbbuilder or epicscorelibs. PV-naming mistakes
(unknown alias targets, name collisions between records and aliases in
either direction, oversized generated names, and cases where a device
alias prefix can't sensibly apply to a name) are validated eagerly and
raise immediately, rather than being deferred to LoadDatabase().

Also adds the `dbla` command to the interactive_ioc shell for listing
record aliases, matching the existing dbl/dbgf/etc. commands.

Co-authored-by: Philipp Klenze <p.klenze@gsi.de>
Co-authored-by: Claude <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