Skip to content

Conversation

@stepskop
Copy link
Contributor

@stepskop stepskop commented Nov 25, 2025

This adds the ACTOR_PERMISSION_LEVEL environmental variable as actorPermissionLevel to the ApifyEnv interface.

@stepskop stepskop self-assigned this Nov 25, 2025
@stepskop stepskop added the t-core-services Issues with this label are in the ownership of the core services team. label Nov 25, 2025
Comment on lines 505 to 507
log.info('Permissions', {
actorPermissionLevel: this.getEnv().actorPermissionLevel,
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure if this should not be somehow conditional, as most of the time it would be defined only when run on Apify. Locally, it won't be defined if the user doesn't do so.

However, I can imagine some cases when my code depends on the permission level, so I am passing it "artificially" even locally to test things out.

Copy link

Choose a reason for hiding this comment

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

I was actually thinking that we'd print it via worker. That would be more universal 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought that the original intention was to put it in the system message (= SDK), but when implementing it, I decided not to put it there, as the system message consists of more "low level" information.

I guess we can log it through Worker.

Copy link

Choose a reason for hiding this comment

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

I thought system message means worker 😅

Copy link
Member

Choose a reason for hiding this comment

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

+1 for logging this elsewhere, locally this IMO doesn't add much value. It's either unset, i.e., this line will print Permissions { actorPermissionLevel: null }, or I pass it manually = I did that intentionally, I know what permission level I'm on.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would also vote for worker or in worst case maybe add it to log.info('System info', getSystemInfo());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wouldn't add it to the system message as I said here: #516 (comment)

Lets move to to Worker 👍

@stepskop stepskop requested a review from tobice November 25, 2025 16:52
@stepskop stepskop changed the title feat: add actorPermissionLevel to env var interface feat: add ACTOR_PERMISSION_LEVEL to env var interface Nov 25, 2025
Comment on lines 505 to 507
log.info('Permissions', {
actorPermissionLevel: this.getEnv().actorPermissionLevel,
});
Copy link

Choose a reason for hiding this comment

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

I was actually thinking that we'd print it via worker. That would be more universal 🤔

Copy link
Member

@barjin barjin left a comment

Choose a reason for hiding this comment

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

I don't have any blockers other than the logging, so please reconsider that and feel free to merge. Thank you!

Note the parity tracking issue in the Python SDK.

Comment on lines 505 to 507
log.info('Permissions', {
actorPermissionLevel: this.getEnv().actorPermissionLevel,
});
Copy link
Member

Choose a reason for hiding this comment

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

+1 for logging this elsewhere, locally this IMO doesn't add much value. It's either unset, i.e., this line will print Permissions { actorPermissionLevel: null }, or I pass it manually = I did that intentionally, I know what permission level I'm on.

/**
* [Permission level](https://docs.apify.com/platform/actors/development/permissions) the Actor is run under. (ACTOR_PERMISSION_LEVEL)
*/
actorPermissionLevel: string | null;
Copy link
Member

Choose a reason for hiding this comment

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

Since this is an enum, I'm wondering if we could type this strictly ('LIMITED_PERMISSIONS' | 'FULL_PERMISSIONS' | null).

It would help users with adoption, but might require some well-placed casts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I typed it using the ACTOR_PERMISSION_LEVEL from @apify/consts

Copy link
Contributor

@danpoletaev danpoletaev left a comment

Choose a reason for hiding this comment

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

Let's decide whether we'll move it to worker

Comment on lines 505 to 507
log.info('Permissions', {
actorPermissionLevel: this.getEnv().actorPermissionLevel,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Would also vote for worker or in worst case maybe add it to log.info('System info', getSystemInfo());

Copy link

@tobice tobice left a comment

Choose a reason for hiding this comment

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

Just adjust the PR description 🙏

@stepskop stepskop merged commit ca3a4df into master Nov 27, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-core-services Issues with this label are in the ownership of the core services team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants