Skip to content

refactor: Move the ID-or-name resolver out of the task helpers - #1609

Closed
DaveHanns wants to merge 1 commit into
masterfrom
refactor/resource-id-helpers
Closed

DaveHanns wants to merge 1 commit into
masterfrom
refactor/resource-id-helpers

Conversation

@DaveHanns

Copy link
Copy Markdown
Contributor

What

Moves toSafeResourceId, isAmbiguousResourceId, and getResourceByIdOrName from src/tools/tasks/task_helpers.ts to a new module, src/utils/apify_resource_id.ts. No behavior change.

Why

These helpers already resolve tasks, schedules, and Actors, so they don't belong in the task helpers. The source tools (#1453) need the same resolution for their actor argument. The repo lands a refactor before the feature that uses it, so the move comes in its own PR.

Part of #1463.

How

  • The new module holds the three functions and the ID regex they use. The code is unchanged. The toSafeResourceId and isAmbiguousResourceId docstrings no longer mention tasks only: they apply to any Apify resource the API addresses by ID or name (Actors, tasks, schedules, ...).
  • task_helpers.ts keeps getTaskByIdOrName, the task schemas, the task result shape, and the publication call, and imports the helpers from the new module.
  • The task and schedule tools import the helpers from the new module.
  • src/tools/AGENTS.md points to the new location.

Testing

type-check, lint, format, test:unit, and check:agents pass. No test imported these functions directly, so no test changed.

AI disclosure: implemented with Claude Code; awaiting human review.

🤖 Generated with Claude Code

@DaveHanns

Copy link
Copy Markdown
Contributor Author

Closing: this move is now part of #1453 as its own commit (0d5b6f6), so #1453 and #1454 no longer wait on this PR.

@DaveHanns DaveHanns closed this Oct 16, 2026
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.

Create an Actor and change a version's files over MCP (create-actor, update-actor-version)

2 participants