Repository navigation
Align stubs with documented and kernel behavior - #78
Merged
Merged
Conversation
Fix outright bugs: - Register new objects in root's ChildrenIDs (typo ChildrendIDs) - IPS_GetObjectIDByName returned an int from an array function - IPS_RunScriptWait/IPS_RunScriptTextWait called missing methods - IPS_GetScriptFile did not return anything - Anchor the ident regex so invalid idents are rejected - Use IS_CREATING (101) during creation and switch to IS_ACTIVE after the first ApplyChanges, like the kernel - GetTimerInterval returns the configured interval - IPSModuleStrict::ReceiveData returns '' when not overridden - IPS_GetVariablePresentation falls back to the system presentation - Sort float associations correctly, return profile names by type - Fix IPS_UpdateFormField argument count, add UnregisterOAuth - Allow module type 6 (visualization) in the validator Reject the same invalid input as the kernel: - Objects: parent existence, cycles, ident collisions, icon spaces, deleting objects with children, object type ranges - Variables: type checks on read/write, kernel value conversion for SetValue, NaN/INF, 1024kB and UTF-8 limits, read-only variables of IPSModuleStrict, profile/action/presentation checks - Profiles: name rules, duplicates, read-only system profiles, value/digit ranges, boolean association deletion - Instances: connection rules for module types and dataflow, data flow packet and DataID checks - Modules: property conversion and unknown properties in configurations, registration only in Create, duplicate registrations, timer intervals, status codes, log message types, buffer limits Co-Authored-By: Claude Opus 5.5 <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.
Compared the stubs against the official docs (https://www.symcon.de/de/llms.txt) and the kernel source, then fixed bugs in the existing stubs and added the input checks the real kernel performs. Error messages are copied from the kernel, so tests fail with the same text a module would see in production.
Bug fixes
ChildrenIDs(typoChildrendIDs), soIPS_GetChildrenIDs(0)was always empty and ident uniqueness below root was not checked.IPS_GetObjectIDByName/IPS_Get*IDByNamethrew a TypeError on success. They now return the ID, or emit a warning and returnfalseif nothing is found.IPS_RunScriptWait/IPS_RunScriptTextWaitcalled methods that don't exist.IPS_GetScriptFilereturned nothing.IS_SBASE) instead ofIS_CREATING(101). Like the kernel, the instance now becomesIS_ACTIVEafter the firstApplyChangeshas finished.GetTimerIntervalnow returns the configured interval, as in the kernel (IPSModule.cpp). Before, it returned the remaining time, which went negative for interval 0.IPSModuleStrict::ReceiveDatathrew a TypeError when the module did not override it.IPS_GetVariablePresentationnow falls back to the system presentation.IPS_GetVariableProfileListByTypereturns names.IPS_UpdateFormField. AddedUnregisterOAuth(strict).Input checks matching the kernel
SetValue*/GetValue*check the variable typeSetValueconverts values like the kernel does ('5'→ 5,1.7→ 2,true→'True')PRESENTATIONGUID$this->SetValuecan change them.~system profiles are read-only, min/max/step/digit ranges, boolean associations cannot be deleted, deleting a missing association fails.IPS_ConnectInstancechecks the module-type rules, dataflow compatibility (implemented vs. requirements), an existing parent, connecting to itself and loops.IPS_DisconnectInstancerequires a parent.DataID, and the parent must implement that DataID. Children that don't implement the DataID are skipped.IPS_SetProperty/IPS_SetConfigurationconvert values to the property type and reject unknown properties and non-scalar valuesCreate, and only onceSetStatusaccepts only 102/104/106/≥200LogMessagerejects KL_SUCCESS and KL_CUSTOMEnableAction/DisableActionon an unknown ident returnfalseinstead of throwing a TypeErrorRegisterVariableon an ident used by another object type bails out instead of throwingRegisterVariable*,MaintainVariableandUnregisterVariablereport whether the variable was actually created or removedThese changes are intended, but modules that relied on the looser behavior will now fail:
GetTimerIntervalreturning the remaining time.Create.IPS_ConnectInstanceand the data flow now check them, andConnectParentandRequireParentuseIPS_ConnectInstance.SetValueon the module's variables.Tests
tests/KernelSanitizationTest.phpandtests/ModuleSanitizationTest.php, with fixture modules intests/SanitizationStubs. 66 of them fail on the old stubs..styleand the JSON check are clean.🤖 Generated with Claude Code