Skip to content

MS: User Tasks with Space and User Data Access#730

Merged
Zayn-Javed merged 14 commits intomainfrom
ms/user-task-data-access
Apr 14, 2026
Merged

MS: User Tasks with Space and User Data Access#730
Zayn-Javed merged 14 commits intomainfrom
ms/user-task-data-access

Conversation

@jjoderis
Copy link
Copy Markdown
Contributor

Summary

Added handling of global data from a space in the MS in User Tasks in the MS task list.

Details

  • added logic that will inline space data into user task html when it is required in a placeholder in the html
    • this works both for tasks in the task list as well as for start forms

@github-actions

This comment has been minimized.

varPath = varPath.split('.').slice(1).join('.');
} else {
throw new Error(`Unable to get data for global variable (@global.${varPath}).`);
return;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't throwing an error be a better approach instead of simply returning?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I changed this back to how it was before.


const startInstance = async (versionId: string, variables: { [key: string]: any } = {}) => {
if (engines?.length)
if (engines?.length) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it prevents attempting to start an instance when no engines are available.

So the question is: should this throw an error instead of silently returning undefined? Alternatively, if we are confident that an engine will always be available, we might even remove the if check.

I mean the if check seems unnecessary here. isn't it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right that this should not fail silently. I changed it to return a user facing error that informs the user that there is no engine to start the instance on.

} else if (segments[0] === '@worker' || !segments[0].startsWith('@')) {
({ userId } = await getCurrentUser());
} else if (segments[0] !== '@organization') {
console.error(`Invalid selector for global data access in user task html. (${segments[0]})`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we throw an error here instead of logging?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this to throw a user facing error instead.


if (isErrorResponse(result)) {
console.error(
'Ecountered error while trying to get global variable for user task rendering:',
Copy link
Copy Markdown
Contributor

@Zayn-Javed Zayn-Javed Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question as above. also the error string has minor typo: Ecountered

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this to throw a user facing error instead.

Copy link
Copy Markdown
Contributor

@Zayn-Javed Zayn-Javed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very well. please have a look at these minor things.

@github-actions

This comment has been minimized.

@jjoderis jjoderis requested a review from Zayn-Javed April 14, 2026 07:40
…lead to a user readable error instead of silently failing
@github-actions
Copy link
Copy Markdown

CLOUDRUN ACTIONS

✅ Successfully created Preview Deployment.

https://pr-730---ms-server-staging-c4f6qdpj7q-ew.a.run.app

@Zayn-Javed Zayn-Javed merged commit 1f842db into main Apr 14, 2026
30 of 33 checks passed
@Zayn-Javed Zayn-Javed deleted the ms/user-task-data-access branch April 14, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants