[LLM-authored] EPICS record alias support to softioc - #210
Open
klenze wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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.aliasargument inaOutand friends, for convenienceAddDeviceAlias(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
aliaskeyword 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
dblacommand to the interactive_ioc shell for listing record aliases, matching the existing dbl/dbgf/etc. commands.