Skip to content

Conversation

vladfrangu
Copy link
Member

Way too overdue, closes #287

@github-actions github-actions bot added this to the 118th sprint - Tooling team milestone Jul 6, 2025
@github-actions github-actions bot added t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics. labels Jul 6, 2025
@B4nan B4nan requested review from B4nan and barjin July 28, 2025 09:32
Copy link
Contributor

@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.

Few nits, but looks alright to me otherwise, thank you!

return null;
}

export const readInputSchema = (): Dictionary | null => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can we make all of them (readJSONIfExists, readInputSchema, getDefaultsFromInputSchema) function (or make all of them const arrow function)?


export const readInputSchema = (): Dictionary | null => {
const localConfig = readJSONIfExists(
join(process.cwd(), ACTOR_SPECIFICATION_FOLDER, LOCAL_CONFIG_NAME),
Copy link
Contributor

Choose a reason for hiding this comment

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

process.cwd() will likely break if the Dockerfile entry point is not npm (--prefix=app/) start, but e.g. node app/main.js

But I'm not sure how else we would refer to these files 🤔 I guess it's okay to live with this, especially since on Platform, we load this via API.

Copy link
Contributor

Choose a reason for hiding this comment

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

I only gave it a quick look, but it looks like we don't copy the .actor directory in our Dockerfiles anyway, so for the "build a Docker image and run it outside of the platform" use case, the answer to "But I'm not sure how else we would refer to these files" is probably "tough luck lol" 🤷

But if we add a nice error log when there's not input schema to be found, yeah, we can live with that.

.build(env.actorBuildId)
.get();

inputSchema = buildData?.actorDefinition?.input;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would at least log an error if this is not present in the response.

inputSchema = buildData?.actorDefinition?.input;
} else {
// On local, we can get the input schema from the local config
inputSchema = readInputSchema();
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd also be nice to log something if no input schema is found.


export const readInputSchema = (): Dictionary | null => {
const localConfig = readJSONIfExists(
join(process.cwd(), ACTOR_SPECIFICATION_FOLDER, LOCAL_CONFIG_NAME),
Copy link
Contributor

Choose a reason for hiding this comment

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

I only gave it a quick look, but it looks like we don't copy the .actor directory in our Dockerfiles anyway, so for the "build a Docker image and run it outside of the platform" use case, the answer to "But I'm not sure how else we would refer to these files" is probably "tough luck lol" 🤷

But if we add a nice error log when there's not input schema to be found, yeah, we can live with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support input schema defaults locally in Actor.getInput()
3 participants