fix(actors info): follow the Actor's default build for --input and --readme by l2ysho · Pull Request #1473 · apify/apify-cli · GitHub
Skip to content

fix(actors info): follow the Actor's default build for --input and --readme - #1473

Merged
l2ysho merged 8 commits into
masterfrom
fix/actors-info-default-build
Oct 19, 2026
Merged

l2ysho merged 8 commits into
masterfrom
fix/actors-info-default-build

Conversation

@l2ysho

@l2ysho l2ysho commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Note

TL;DR — fix failing e2e

Closes #1454

Changes

  • src/commands/actors/info.ts: for --input and --readme, resolve the build with client.actor(id).defaultBuild(). Fall back to taggedBuilds.latest if that call fails. This follows the approach agreed on the issue, and it also handles defaultRunOptions.build set to a build number.
  • test/local/commands/actors-info.test.ts: 3 tests with a mocked client: no latest tag, default build preferred over latest, fallback to latest. The first two fail without the fix.

Evidence

  • apify/rag-web-browser now has only beta-3 and version-1 tags. defaultRunOptions.build is version-1.
  • The E2E test actors/info.test.ts > shows input schema with --input flag fails on the last 3 master nightlies (10-03 to 10-05) with SyntaxError: Unexpected token 'E', because the CLI printed the error text instead of JSON: failing job 10-05.
  • defaultBuild() returned the right input schema for apify/rag-web-browser (15 properties), apify/web-scraper (39) and apify/hello-world (1), without a token.

Not verified

  • I did not run the E2E test locally (no TEST_USER_TOKEN). The next E2E nightly will show it.

🤖 Generated with Claude Code

…readme

Closes #1454

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@l2ysho l2ysho added the t-builders Issues owned by the Builders team. label Oct 5, 2026
…uild

Only a 404 means the Actor has no default build. Any other error now fails the
command instead of silently printing the `latest` schema with exit 0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@l2ysho l2ysho self-assigned this Oct 8, 2026
@l2ysho
l2ysho marked this pull request as ready for review October 8, 2026 08:39
@l2ysho
l2ysho requested a review from DaveHanns as a code owner October 8, 2026 08:39
@apify-service-account apify-service-account added the tested Temporary label used only programatically for some analytics. label Oct 8, 2026

@DaveHanns DaveHanns left a comment

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.

LGTM 👍

@l2ysho
l2ysho merged commit 6cb3b29 into master Oct 19, 2026
22 checks passed
@l2ysho
l2ysho deleted the fix/actors-info-default-build branch October 19, 2026 18:17
l2ysho added a commit that referenced this pull request Oct 19, 2026
> [!NOTE]
> **TL;DR**
> `apify init` never terminated when stdin was not a TTY. Fixed, along
with three other defects on the same path.

## What was broken

`apify init` with no name and a non-TTY stdin never exited. Not a
blocked read — a retry loop writing ~28 MB/s to stderr. Measured 152 MB
in 6 s, which also makes the process hard to kill.

`stdinCheckWrapper` throws whenever stdin cannot be read. The loop
caught that, printed it, and retried. The error is permanent, so the
retry could never succeed.

## What changed

| | Defect | Before | After |
|---|---|---|---|
| D1 | `--yes` did not skip the name prompt, though `interactiveNote`
and the `apify init --yes` example both promise it does | infinite loop
| exit 0, uses the directory name |
| D2 | The retry loop treated a permanent failure as retryable |
infinite loop | one error, exit 1 |
| D3 | The directory confirmation turned "cannot ask" into "no" | **exit
0**, nothing done | exit 1 with a message |
| D4 | The positional name was never validated | `init 'Bad Name!!'`
exited 0 and wrote that name, failing later on push | exit 1 |

D2 is fixed by removing the loop, not capping it. Validation moved
inside inquirer's own `validate`, so a typo still re-asks interactively,
while a prompt that cannot be answered fails once with a message naming
the escape hatch:

```
Error: Actor name is required. Run 'apify init <name>', or pass --yes to use the current directory name.
```

Two supporting changes: the directory name is now sanitized for every
project type rather than only Python (`my_project` → `my-project`), and
the prompt validator is shared with `apify create`, which had its own
copy.

## Behavior changes worth a reviewer's attention

- A non-Node/Python directory without a TTY goes from exit 0 to exit 1.
The old exit 0 did nothing useful, but a CI script treating 0 as success
will start failing.
- An invalid explicit name is now rejected up front. That includes two
cases where the name was previously discarded anyway: an
already-initialized directory, and a Scrapy project. Rejecting a name
the user typed beats silently dropping it.
- The default Actor name is sanitized for all project types, not just
Python.

## Tests

Three e2e tests through a new `runCliBounded` helper, plus four local
tests.

Both layers assert on the loop itself, not on a timeout. A hang and a
loop are indistinguishable by deadline and cost the full deadline either
way. The helper caps combined output at 256 KB and kills on breach, so a
regression fails in under a second.

execa's own `maxBuffer` was the obvious alternative and was measured
instead of assumed: 7–20 s to trip, against 25–500 ms for the counter.
In one run it blew past its own 15 s timeout and still reported
`timedOut: false`.

## Not in scope

- The held-open-pipe variant still hangs. That happens in `readStdin()`
at entrypoint load, before any command code runs —
[#1206](#1206), fixed by
[#1330](#1330). Verified: with
the eager read stubbed out, that case exits 0 in 1.3 s with the default
name.
- [#1451](#1451) (global
`--non-interactive` flag) is adjacent but different. It covers
pseudo-terminals, where a TTY exists; this is the plain non-TTY path.
- [#1354](#1354) — the
non-interactive error naming `--confirm`/`--no-confirm`, which do not
exist. `init` now has its own messages; other commands still print the
misleading default.
- `validateActorName` says "maximum of 30 characters" while
`ACTOR_NAME.MAX_LENGTH` is 63. Pre-existing; the new `--yes` failure
path surfaces it more often.

## Checks

`lint`, `format`, `build` clean. `test:local` 660 passed. Local e2e 44
passed. No dependency changes, so no install-size impact. `update-docs`
produces no diff — flags, args, description and examples are untouched.

CI's one red check is `actors info --input`, inherited from master. The
same assertion fails on master's own E2E runs daily back to 5 October,
and [#1473](#1473) fixes it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-builders Issues owned by the Builders team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

actors info --input/--readme should follow the Actor's default build, not the latest tag

3 participants