-
Notifications
You must be signed in to change notification settings - Fork 119
1317 applicationservice fails to access applications inside private folders #1318
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
1317 applicationservice fails to access applications inside private folders #1318
Conversation
…and discover() This PR fixes issue #1317 where ApplicationService failed to access applications inside private folders. Key changes: - Refactored _resolve_path() to properly handle mixed public/private folder hierarchies by probing path segments to find private boundaries - Added _build_path_url() to construct correct URLs with PrivateContents - Added _find_private_boundary() to detect where paths transition to private - Added discover() method for exploring the Applications folder tree - All application methods (get, get_document, exists, create, update, delete, rename) now correctly handle documents in private folders The TM1 REST API requires different URL patterns: - Public: /Contents('folder')/Contents('subfolder') - Private: /PrivateContents('folder')/PrivateContents('subfolder') - Mixed: /Contents('public')/PrivateContents('private') Once inside a private folder, all nested content must use PrivateContents.
Summary
New Features
|
|
Tests completed for environment: tm1-11-cloud. Check artifacts for details. |
|
Looks really good. Thank you, @nicolasbisurgi. I hesitate a little bit with the No strong opinion, I just wanted to share my thoughts on this one. |
|
|
Thanks for the feedback! Approach:I do agree having @Hubert-Heijkers insight on this would be great. I was a bit surprised to see that there was no way to get this information without a trial an error approach. CachingRegarding caching, I think that if we leave it False as default we should still be considering TM1Py stateless. The reason I'm working on this topic is to create a script to transform all private applications into public ones for <500 user model, so having the ability to cache some of the valid mixed paths was a nice to have StrategyI agree, binary approach is more efficient but we would start seeing better performance starting on 4 level deep onwards, right? This might be more useful on v12 than v11 considering how Cloudfare handles repeated requests. Next steps ProposalI think we can proceed as is and wait for a response from Hubert; depending on where that answer leaves us we can optimize this approach by replacing linear by binary. Thoughts? |
|
Yeah. I think the search optimization can be done in a future PR, given the expected performance impact. Thanks everyone, for the feedback on this! |
|
@onefloid, @nicolasbisurgi, correct me if I'm wrong but my (quick) understanding here is that in TM1py any path, which end in a public or private target document, gets dumbed down to a simple [file] path, effectively ignoring that one little aspect that the same name can actually resolve in both a public as well as a private path or document. Truth be told this has never been one of my favorite things in TM1 either, not in applications, and especially not in public/private subsets/views and the implicit behavior that stems from it. The iterative resolve of such a path not knowing if a segment represents a public or private entry only works if only either a public or private entry with such a name exists. But if that were always the case we wouldn't have had to have separate public (Contents) and private (PrivateContents) collections to begin with. I.o.w. the conversion to a path is not lossless. As for resolving one could in theory resolve the entry, or more entries if multiple existed with the same 'path', using one REST request IF TM1 supported type cast segments on these entries (which I just got reminded it does not - yet). A request for a path like This can probably be a bit more optimize where we know we have to be dealing with a folder anyway, or have to be, but it's all mute until the type segment on the collection and entry types is supported unfortunately and even then this would give you one or more entries and you'd likely still not know which one right? |

Summary
Problem
The ApplicationService failed with 404 errors when accessing applications inside private folders because the TM1 REST API requires PrivateContents('FolderName') for private folder segments, but TM1py was always using Contents('FolderName') for intermediate path segments.
Solution: Implemented automatic path resolution with an optimistic probing strategy:
Changes: