-
-
Notifications
You must be signed in to change notification settings - Fork 174
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
Introduce IDs for each script/category #262
Comments
LGTM! One potential caveat to point out, though would be the fact, that using only the first word increases chances of collisions down the line - though I don't know enough to say how significant a chance would it be. Though I don't have a good idea how to prevent this (a bad idea would be to update the CLI tool with the list of currently used IDs and make the tool re-generate a new GUID if the first word of a fresh one collided with an old one). |
Just snowballing here - since the hierarchical structure is bad (categories are a bit whimsical, can change names, etc.) and GUIDs are a proposed solution - what if we could have a list of GUIDs but in the script itself give each feature an array of category tags? This way you're not limited to only one category. I hope that's potentially useful ;). |
Can you elaborate @neube3? Do I understand correctly that you're suggesting that we keep categories but introduce one more level of taxonomy through tags? You're right that the hierarchical categories can never be perfect and one script could often be categorized inside a few groups. So we add tag support and tag scripts/categories as another level of categorization? And assign IDs to these tags too? |
I knew I was right when I put it up for discussion - I didn’t even think about IDs for tags, but that’s exactly the type of an idea enhancement I expected from a discussion :)! Tag ID's sound great - I’m almost always for separating the key and label (doing multilingual work - you learn to appreciate ID-label coupling). As a side note - I have no clue about any plans for translating the scripts, but tags could have language versions to them (as a property, I guess?) but since the ID would stay the same through label and language changes the whole system should be both accessible and easily shareable. As for the tags, we could either:
Whichever we choose, we should allow users to search by tag; there are also fun little additional things you can do with a tag structure you cannot do in a hierarchy, most basic of which is one script with multiple tags ("Is it script a security or a speedup measure?" - now you don’t have to guess!), a further one is a tag cloud (pleasing visual representation of tags by their relative count) and finally the best thing ever: searching by tags, e.g. "All speedup scripts in one Last, but not least, tags can include/reference other tags (non-hierarchically, but we could always choose to include only such subsets). |
human readable ids are nice ribbit |
FYI, ID support is implemented. I'm merging necessary refactorings as part of patches and will add the main code in next release. In previous refactoring c138f74, I added a concept called Executable. An Executable represents a Category or a Script that can be uniquely identified (a.k.a. {
"key": {
"collection": "windows",
"id": "27e7b119",
},
} However, the blog post you linked @Kerobyte inspired me to do adding {
"key": {
"collection": "windows",
"type": "script",
"id": "27e7b119",
},
} I quote this:
With the previous design I had in mind, all executable in a collection must be iterated until the executable is found to be able to find out the object and read the type. But having The article argues that having an object like this "complicates the API with no additional gain". I do not agree, the gain is that it's much more explicit and human readable. So I will keep this kind of complex key/ID structure in the code. However, we'll need to serialize this object to use in public API (#126) and to store selections (#59). And in that case, I guess we can use this format:
For example: I guess this URI format is much more clear than what the articles suggests with underscores ( We're making the last decisions. I'd like to hear your feedback on this. (@Marc05 feel free to join designing this if you're around) TLDR Use a composite/aggregate key for executables (category/script) composed of following properties: {
"key": {
"collection": "windows",
"type": "script",
"id": "27e7b119",
},
} Serialize it in URI format like this: New decision: Add |
Not gonna lie - I didn't grok everything, but your solution LGTM! Also, the article basically mentions Hungarian notation. Which is not bad, per se, but not new, either. Semi-connected rant below, feel free to skip if you're for the opinion on the solution: As for the "oh, I'm customer 50, your operation isn't big and therefore doesn't feel that great anymore" argument - it would be trivial to just add a random(10000,100000) to the ID and check for collisions - another strawman. |
Ship it! :) It probably goes without saying to keep in mind some safety checks around categories; it sounds like there's potential for infinite loops since they can reference each other. Good progress! |
@neube3 I agree. It's security by obscurity, and a very weak one. Enumeration is mitigated by proper authentication and network controls not by adding prefixes to IDs. Thanks for the input everyone. This will be final design: The support in application will be added in upcoming patch release(s). The collection files will modified in the feature release. GPT 4 agrees that the executable type (whether it is a script or a category) should be part of the key/ID when my prompt asked for it to optimize for easiest future changes to maximize maintainabilityIncorporating Pros of Including
Cons of Including
Recommendation: |
If I might suggest another piece of metadata for each executable: the privacy.sexy version/build the specific script got introduced in, or a "revision number". In the future, people will want to load the script they previously created as a template in order to create an updated version of it. It would then be important to be able to quickly see all the newly added executables since the template script was created and add the desired ones from such a filtered overview. It would also make sense to change this version metadata for executables if new breaking changes have been made or if new incompatibility information or other warnings were added, so that people can reconsider these executables upon rebuilding their script. |
This commit unifies the concepts of executables having same ID structure. It paves the way for more complex ID structure and using IDs in collection files as part of new ID solution (#262). Using string IDs also leads to more expressive test code. This commit also refactors the rest of the code to adopt to the changes. This commit: - Separate concerns from entities for data access (in repositories) and executables. Executables use `Identifiable` meanwhile repositories use `RepositoryEntity`. - Refactor unnecessary generic parameters for enttities and ids, enforcing string gtype everwyhere. - Changes numeric IDs to string IDs for categories to unify the retrieval and construction for executables, using pseudo-ids (their names) just like scripts. - Remove `BaseEntity` for simplicity. - Simplify usage and construction of executable objects. Move factories responsible for creation of category/scripts to domain layer. Do not longer export `CollectionCategorY` and `CollectionScript`. - Use named typed for string IDs for better differentation of different ID contexts in code.
This commit unifies executable ID structure across categories and scripts, paving the way for more complex ID solutions for #262. It also refactors related code to adapt to the changes. Key changes: - Change numeric IDs to string IDs for categories - Use named types for string IDs to improve code clarity - Add unit tests to verify ID uniqueness Other supporting changes: - Separate concerns in entities for data access and executables by using separate abstractions (`Identifiable` and `RepositoryEntity`) - Simplify usage and construction of entities. - Remove `BaseEntity` for simplicity. - Move creation of categories/scripts to domain layer - Refactor CategoryCollection for better validation logic isolation - Rename some categories to keep the names (used as pseudo-IDs) unique on Windows.
TL;DR: Please checked the Proposed solution, I'm looking for community feedback on the proposed ID format and the overall approach.
Problem description
The absence of IDs for scripts and categories is blocking:
To be able to implement these, we need to assign IDs for each script and category.
Requirements for IDs
The IDs should be:
Proposed solution
Adopt the approach of generating a GUID (e.g.,
27e7b119-6fdb-447f-91e1-99ecf94d9f34
) and extracting the first segment (prior to the first dash, e.g.,27e7b119
).So every script and category will have an ID in format of
27e7b119
.Alternatives considered
TODO
The text was updated successfully, but these errors were encountered: