verulla-cli 0.0.4__tar.gz → 0.0.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. verulla_cli-0.0.5/CHANGELOG.md +5 -0
  2. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/PKG-INFO +1 -1
  3. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/pyproject.toml +1 -1
  4. verulla_cli-0.0.5/tests/test_cli_import.py +4 -0
  5. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/tests/test_main.py +26 -5
  6. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/verulla_cli/__init__.py +1 -1
  7. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/verulla_cli/main.py +40 -11
  8. verulla_cli-0.0.4/tests/test_cli_import.py +0 -4
  9. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/.gitignore +0 -0
  10. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/tests/test_admin_cmd.py +0 -0
  11. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/tests/test_apps_client.py +0 -0
  12. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/tests/test_auth.py +0 -0
  13. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/tests/test_buildkit.py +0 -0
  14. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/tests/test_buildkit_real.py +0 -0
  15. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/tests/test_deploy_client.py +0 -0
  16. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/tests/test_dev_check.py +0 -0
  17. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/tests/test_emulate.py +0 -0
  18. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/tests/test_owner_commands.py +0 -0
  19. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/tests/test_packaging.py +0 -0
  20. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/tests/test_secrets_client.py +0 -0
  21. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/tests/test_sketch_status.py +0 -0
  22. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/verulla_cli/apps_client.py +0 -0
  23. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/verulla_cli/auth.py +0 -0
  24. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/verulla_cli/buildkit.py +0 -0
  25. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/verulla_cli/config.py +0 -0
  26. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/verulla_cli/deploy_client.py +0 -0
  27. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/verulla_cli/emulate.py +0 -0
  28. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/verulla_cli/packaging.py +0 -0
  29. {verulla_cli-0.0.4 → verulla_cli-0.0.5}/verulla_cli/secrets_client.py +0 -0
@@ -0,0 +1,5 @@
1
+ # verulla-cli changelog
2
+
3
+ ## 0.0.5
4
+
5
+ - Make `verulla deploy --wait` wait for the deployed app's runtime health to become ready, not just build/apply completion. It exits nonzero on a crash and reports the available crash cause plus a hint to check the configured (or default 8080) listening port; the wait timeout remains bounded.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: verulla-cli
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Requires-Python: >=3.12
5
5
  Requires-Dist: docker>=7
6
6
  Requires-Dist: httpx>=0.27
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "verulla-cli"
3
- version = "0.0.4"
3
+ version = "0.0.5"
4
4
  requires-python = ">=3.12"
5
5
  dependencies = [
6
6
  "verulla-manifest==0.0.2",
@@ -0,0 +1,4 @@
1
+ def test_import():
2
+ import verulla_cli
3
+
4
+ assert verulla_cli.__version__ == "0.0.5"
@@ -355,7 +355,7 @@ def test_deploy_wait_success_prints_sketch_handoff(tmp_path, monkeypatch) -> Non
355
355
  })
356
356
  states = iter([
357
357
  {"status": "building", "build_log_tail": ""},
358
- {"status": "deployed", "build_log_tail": ""},
358
+ {"status": "deployed", "runtime_health": "ready", "build_log_tail": ""},
359
359
  ])
360
360
  monkeypatch.setattr("verulla_cli.main.get_deployment", lambda *args: next(states))
361
361
  monkeypatch.setattr("verulla_cli.main.get_sketch_status", lambda *args: {
@@ -389,7 +389,25 @@ def test_deploy_wait_failure_exits_nonzero_and_shows_build_log_tail(tmp_path, mo
389
389
  assert result.exit_code == 1
390
390
  assert "verulla logs demo-app" in result.output
391
391
  assert "build output tail" in result.output
392
- assert "Runtime/pod logs are not available yet" in result.output
392
+ assert "Runtime health is shown above" in result.output
393
+
394
+
395
+ def test_deploy_wait_crashing_reports_runtime_reason_and_hint(tmp_path, monkeypatch) -> None:
396
+ monkeypatch.setattr("verulla_cli.main.get_token", lambda: "tok")
397
+ monkeypatch.setattr("verulla_cli.main.create_deployment", lambda *args: {
398
+ "id": "d-crash", "app": "demo-app", "status": "queued",
399
+ })
400
+ monkeypatch.setattr("verulla_cli.main.get_deployment", lambda *args: {
401
+ "id": "d-crash", "status": "deployed", "runtime_health": "crashing",
402
+ "runtime_health_reason": "Error (exit code 1); sqlite3.OperationalError: unable to open database file",
403
+ "effective_port": 8000,
404
+ })
405
+ result = runner.invoke(app, ["deploy", str(_valid_project(tmp_path)), "--api-url", "http://api.test", "--wait"])
406
+ assert result.exit_code == 1
407
+ assert "crashing" in result.output
408
+ assert "unable to open database file" in result.output
409
+ assert "filesystem is read-only except /tmp" in result.output
410
+ assert "make sure the app listens on the port set in verulla.yml (8000)" in result.output
393
411
 
394
412
 
395
413
  def test_deploy_wait_timeout_exits_nonzero_with_inspection_action(tmp_path, monkeypatch) -> None:
@@ -397,13 +415,15 @@ def test_deploy_wait_timeout_exits_nonzero_with_inspection_action(tmp_path, monk
397
415
 
398
416
  monkeypatch.setattr(cli_main, "get_token", lambda: "tok")
399
417
  monkeypatch.setattr(cli_main, "create_deployment", lambda *args: {"id": "d-slow", "app": "demo-app", "status": "queued"})
400
- monkeypatch.setattr(cli_main, "get_deployment", lambda *args: {"status": "building"})
418
+ monkeypatch.setattr(cli_main, "get_deployment", lambda *args: {"status": "building", "runtime_health": "starting",
419
+ "runtime_health_reason": "app did not answer on port 8000; set port: in verulla.yml"})
401
420
  monkeypatch.setattr(cli_main.time, "monotonic", iter([0.0, 0.0, 2.0]).__next__)
402
421
  monkeypatch.setattr(cli_main.time, "sleep", lambda _: None)
403
422
  result = runner.invoke(app, ["deploy", str(_valid_project(tmp_path)), "--api-url", "http://api.test", "--wait", "--wait-timeout", "1"])
404
423
  assert result.exit_code == 1
405
424
  assert "Timed out after 1s" in result.output
406
425
  assert "verulla logs demo-app" in result.output
426
+ assert "app did not answer on port 8000" in result.output
407
427
 
408
428
 
409
429
  def test_deploy_logged_in_unreachable_api_fails_cleanly(tmp_path, monkeypatch) -> None:
@@ -480,7 +500,7 @@ def test_logs_fetches_and_prints_build_log(monkeypatch) -> None:
480
500
  assert result.exit_code == 0, result.output
481
501
  assert "status: failed" in result.output
482
502
  assert "compiler output" in result.output
483
- assert "Runtime/pod logs are not available yet." in result.output
503
+ assert "Runtime/pod logs are not included" in result.output
484
504
 
485
505
 
486
506
  def test_logs_reports_api_errors(monkeypatch) -> None:
@@ -527,10 +547,11 @@ def test_status_includes_plan_and_paid_term_fields(monkeypatch) -> None:
527
547
  monkeypatch.setattr("verulla_cli.main.get_app", lambda *args: {
528
548
  "app": "demo", "tier_id": "live", "pricing_version": "v1",
529
549
  "paid_through": "2026-11-25T00:00:00+00:00", "renewal_date": "2026-11-25", "status": "deployed",
550
+ "runtime_health": "crashing", "runtime_health_reason": "exit code 1",
530
551
  })
531
552
  result = runner.invoke(app, ["status", "demo", "--api-url", "https://api.test"])
532
553
  assert result.exit_code == 0, result.output
533
- for field in ("tier_id: live", "pricing_version: v1", "paid_through:", "renewal_date: 2026-11-25"):
554
+ for field in ("tier_id: live", "pricing_version: v1", "paid_through:", "renewal_date: 2026-11-25", "runtime_health: crashing", "runtime_health_reason: exit code 1"):
534
555
  assert field in result.output
535
556
 
536
557
 
@@ -4,4 +4,4 @@ Human + agent entry point: login (OIDC device flow), dev (local Docker
4
4
  emulation via verulla_manifest), deploy, secrets, logs.
5
5
  """
6
6
 
7
- __version__ = "0.0.3"
7
+ __version__ = "0.0.5"
@@ -339,7 +339,7 @@ def deploy(
339
339
  envvar="VERULLA_API_URL", show_default=True,
340
340
  help="Verulla control plane base URL.",
341
341
  ),
342
- wait: bool = typer.Option(False, "--wait", help="Wait for build/apply to finish, then print the Sketch hand-off."),
342
+ wait: bool = typer.Option(False, "--wait", help="Wait for runtime health to be ready; fail with the crash cause and port hint otherwise."),
343
343
  wait_timeout: int = typer.Option(600, "--wait-timeout", min=1, max=3600,
344
344
  help="Maximum seconds to wait (1-3600; default 600)."),
345
345
  ) -> None:
@@ -378,7 +378,7 @@ def deploy(
378
378
  for fn in deployment.get("functions", []):
379
379
  typer.echo(f" {fn['name']} ({fn['adapter']})")
380
380
  if wait:
381
- terminal = {"deployed", "build_failed", "apply_failed", "failed", "deleted", "delete_failed", "superseded", "suspended"}
381
+ terminal = {"build_failed", "apply_failed", "failed", "deleted", "delete_failed", "superseded", "suspended"}
382
382
  deadline = time.monotonic() + wait_timeout
383
383
  while True:
384
384
  try:
@@ -387,18 +387,37 @@ def deploy(
387
387
  typer.echo(f"Error checking deployment status: {exc}", err=True)
388
388
  raise typer.Exit(code=1) from exc
389
389
  status = latest.get("status")
390
- if status in terminal:
390
+ runtime_health = latest.get("runtime_health", "starting")
391
+ if status in terminal or runtime_health in {"crashing", "failed"} or (
392
+ status == "deployed" and runtime_health == "ready"
393
+ ):
391
394
  break
392
395
  remaining = deadline - time.monotonic()
393
396
  if remaining <= 0:
394
397
  typer.echo(
395
- f"Timed out after {wait_timeout}s waiting for deployment {deployment['id']} (last status: {status}). "
398
+ f"Timed out after {wait_timeout}s waiting for deployment {deployment['id']} "
399
+ f"(last status: {status}, runtime health: {runtime_health}). "
400
+ f"Runtime reason: {latest.get('runtime_health_reason') or '(none reported)'}. "
396
401
  f"Inspect with: verulla logs {deployment['app']}", err=True,
397
402
  )
398
403
  raise typer.Exit(code=1)
399
404
  time.sleep(min(2, remaining))
400
- if status != "deployed":
405
+ if status != "deployed" or runtime_health != "ready":
401
406
  typer.echo(f"Deployment {deployment['id']} ended with status {status}.", err=True)
407
+ if runtime_health in {"crashing", "failed"}:
408
+ reason = latest.get("runtime_health_reason") or "no runtime details reported"
409
+ typer.echo(f"App exited at startup: {reason}", err=True)
410
+ typer.echo(f"Runtime health: {runtime_health}", err=True)
411
+ port = latest.get("effective_port")
412
+ hint = (
413
+ f"make sure the app listens on the port set in verulla.yml ({port})"
414
+ if isinstance(port, int)
415
+ else "make sure the app listens on the port set in verulla.yml (default 8080)"
416
+ )
417
+ typer.echo(
418
+ f"Hint: app exited at startup; the filesystem is read-only except /tmp; {hint}.",
419
+ err=True,
420
+ )
402
421
  if latest.get("error"):
403
422
  typer.echo(f"Error: {latest['error']}", err=True)
404
423
  try:
@@ -410,7 +429,7 @@ def deploy(
410
429
  typer.echo("build_log_tail:", err=True)
411
430
  tail = logs.get("build_log_tail") if logs.get("deployment_id") == deployment["id"] else None
412
431
  typer.echo(tail or "(no matching build log available)", err=True)
413
- typer.echo("Runtime/pod logs are not available yet.", err=True)
432
+ typer.echo("Runtime health is shown above; pod log tails are not included in this output.", err=True)
414
433
  raise typer.Exit(code=1)
415
434
  try:
416
435
  receipt = _safe_sketch_receipt(get_sketch_status(api_url.rstrip("/"), token, deployment["app"]))
@@ -547,11 +566,11 @@ def logs(
547
566
  except AppsError as exc:
548
567
  typer.echo(f"Error: {exc}", err=True)
549
568
  raise typer.Exit(code=1) from exc
550
- for key in ("app", "deployment_id", "status", "error"):
569
+ for key in ("app", "deployment_id", "status", "runtime_health", "runtime_health_reason", "error"):
551
570
  typer.echo(f"{key}: {result.get(key)}")
552
571
  typer.echo("build_log_tail:")
553
572
  typer.echo(result.get("build_log_tail") or "(no build log available)")
554
- typer.echo("Runtime/pod logs are not available yet.")
573
+ typer.echo("Runtime/pod logs are not included; see runtime_health and runtime_health_reason above.")
555
574
 
556
575
 
557
576
  def _resolve_app(name: str | None) -> str:
@@ -587,7 +606,12 @@ def apps(
587
606
  typer.echo("No apps.")
588
607
  return
589
608
  for row in rows:
590
- typer.echo(f"{row['app']} {row['status']} {row.get('url') or '-'}")
609
+ typer.echo(
610
+ f"{row['app']} {row['status']} runtime={row.get('runtime_health', 'starting')} "
611
+ f"{row.get('url') or '-'}"
612
+ )
613
+ if row.get("runtime_health_reason"):
614
+ typer.echo(f" runtime_health_reason: {row['runtime_health_reason']}")
591
615
 
592
616
 
593
617
  @app.command()
@@ -727,10 +751,15 @@ def status(
727
751
  if app_name is None:
728
752
  rows = list_apps(api_url.rstrip("/"), token)
729
753
  for row in rows:
730
- typer.echo(f"{row['app']} {row['status']} {row.get('url') or '-'}")
754
+ typer.echo(
755
+ f"{row['app']} {row['status']} runtime={row.get('runtime_health', 'starting')} "
756
+ f"{row.get('url') or '-'}"
757
+ )
758
+ if row.get("runtime_health_reason"):
759
+ typer.echo(f" runtime_health_reason: {row['runtime_health_reason']}")
731
760
  else:
732
761
  row = get_app(api_url.rstrip("/"), token, app_name)
733
- for key in ("app", "tier_id", "pricing_version", "paid_through", "renewal_date", "status", "latest_deployment_id", "source_sha", "function_count", "url", "updated_at", "error", "functions"):
762
+ for key in ("app", "tier_id", "pricing_version", "paid_through", "renewal_date", "status", "runtime_health", "runtime_health_reason", "latest_deployment_id", "source_sha", "function_count", "url", "updated_at", "error", "functions"):
734
763
  if key in row:
735
764
  typer.echo(f"{key}: {row[key]}")
736
765
  except AppsError as exc:
@@ -1,4 +0,0 @@
1
- def test_import():
2
- import verulla_cli
3
-
4
- assert verulla_cli.__version__
File without changes