Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] check object properties (during object creation) #2509

Open
mcm1957 opened this issue Oct 29, 2023 · 5 comments
Open

[Feature] check object properties (during object creation) #2509

mcm1957 opened this issue Oct 29, 2023 · 5 comments
Labels
refinement 🔍 Needs refinement with core developers

Comments

@mcm1957
Copy link
Contributor

mcm1957 commented Oct 29, 2023

js controller should check state configuration when cretaing or extending a state.
Especially role shoul dbe checked against data type and read/write settings.

I.e. role indocator is incompatible with write=true or type=string

When checking ONLY during creation/extending the number od log entries should be acceptable.

Config could be either hardcoded or extendable by using a cached schema from online service. The later approach would allow to check if a role is defined at all too.

@mcm1957 mcm1957 changed the title [Feature] check state paramaters (during state creation) [Feature] check state parameters (during state creation) Oct 29, 2023
@mcm1957
Copy link
Contributor Author

mcm1957 commented Nov 20, 2023

As there has been some concern about performance impact (at telegram) I would like to state;

The check should ONLY be performed when really creating or modifying a state - NOT at every access. As states should not be created over and over the impact should be acceptable.

Its totally ok to miss modifications done by users to existing states - its not the goal to detect such changes, the goal is to give feeback to developers to write correct state definitions. As states are likely to be created dynamically, its impossible to check them by repo checker.

@foxriver76
Copy link
Collaborator

So it is more like an extended object creation check, we already have them when objects are created or extended. We would need to extend that by a check which checks if write, read and type match the state definitions.

We could maybe create a file which holds like Record<string, {write: boolean, read: boolean, type: ioBroker.AllowedStateType}> as a single point of truth. Meaning creating the docs automatically out of it (not on dev releases only real releases) + using it as validation, so docs + validation would be in sync.

@mcm1957
Copy link
Contributor Author

mcm1957 commented Nov 20, 2023

Well
The technical details are know by you best.

I would suggest to check

Type
Role
Read write

Against each other. And of course unknow roles must be allowed unless we can gurantte a very fast update of roles without explicit user action. Updating with js-controller releases would be to slow as users ste likely several releases behind.

@Apollon77 Apollon77 changed the title [Feature] check state parameters (during state creation) [Feature] check object properties (during object creation) Nov 21, 2023
@Apollon77
Copy link
Collaborator

I fixed the wording in at least headline ... it is about objects ... not states

@foxriver76 foxriver76 added the refinement 🔍 Needs refinement with core developers label Mar 18, 2024
@mcm1957
Copy link
Contributor Author

mcm1957 commented Sep 12, 2024

Well - as the discussion continues outsides I would like to give this issue a push up.

I really would suggest to check the roles whenever an object is created or extended.

The list of valid state roles and other Info to check (R/W, type, ...) could be loaded using the same mechanism as we already use to load jsonConfig schema. This would guarantee a fast update if new roles are accepted.

Failing should be reported as a log and if possible as a feedback at sentry so that we can create a Issue at the adapter an potentially check when releasing new versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refinement 🔍 Needs refinement with core developers
Projects
None yet
Development

No branches or pull requests

3 participants