apheris-foundry-cli 2.1.1__tar.gz → 2.3.0__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 (66) hide show
  1. {apheris_foundry_cli-2.1.1/src/apheris_foundry_cli.egg-info → apheris_foundry_cli-2.3.0}/PKG-INFO +70 -2
  2. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/README.md +69 -1
  3. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/pyproject.toml +1 -1
  4. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0/src/apheris_foundry_cli.egg-info}/PKG-INFO +70 -2
  5. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apheris_foundry_cli.egg-info/SOURCES.txt +2 -0
  6. apheris_foundry_cli-2.3.0/src/apherisfold_cli/commands/docs.py +105 -0
  7. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/commands/weights.py +5 -1
  8. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/hub_requests.py +29 -3
  9. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/main.py +11 -4
  10. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/skills/apheris-foundry-hub/SKILL.md +46 -0
  11. apheris_foundry_cli-2.3.0/src/apherisfold_cli/version.py +1 -0
  12. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_cli.py +88 -7
  13. apheris_foundry_cli-2.3.0/tests/test_docs.py +102 -0
  14. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_documents.py +64 -1
  15. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_hub_requests.py +41 -0
  16. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_weights.py +32 -5
  17. apheris_foundry_cli-2.1.1/src/apherisfold_cli/version.py +0 -1
  18. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/LICENSE +0 -0
  19. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/setup.cfg +0 -0
  20. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apheris_foundry_cli.egg-info/dependency_links.txt +0 -0
  21. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apheris_foundry_cli.egg-info/entry_points.txt +0 -0
  22. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apheris_foundry_cli.egg-info/requires.txt +0 -0
  23. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apheris_foundry_cli.egg-info/top_level.txt +0 -0
  24. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/__init__.py +0 -0
  25. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/commands/__init__.py +0 -0
  26. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/commands/compounds.py +0 -0
  27. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/commands/foundry.py +0 -0
  28. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/commands/login.py +0 -0
  29. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/commands/settings.py +0 -0
  30. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/commands/skills.py +0 -0
  31. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/__init__.py +0 -0
  32. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/auth.py +0 -0
  33. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/config.py +0 -0
  34. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/context.py +0 -0
  35. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/documents.py +0 -0
  36. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/errors.py +0 -0
  37. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/input_archive.py +0 -0
  38. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/io.py +0 -0
  39. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/limits.py +0 -0
  40. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/login_profiles.py +0 -0
  41. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/msa.py +0 -0
  42. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/pubchem.py +0 -0
  43. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/render.py +0 -0
  44. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/result_artifacts.py +0 -0
  45. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/core/transient.py +0 -0
  46. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/src/apherisfold_cli/handlers.py +0 -0
  47. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_auth.py +0 -0
  48. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_auth_lifecycle.py +0 -0
  49. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_benchmark_examples.py +0 -0
  50. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_config.py +0 -0
  51. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_dry_run_guard.py +0 -0
  52. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_foundry_helpers.py +0 -0
  53. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_foundry_warnings.py +0 -0
  54. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_handlers.py +0 -0
  55. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_input_archive.py +0 -0
  56. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_io.py +0 -0
  57. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_jobs_metadata.py +0 -0
  58. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_jobs_update.py +0 -0
  59. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_login_callback.py +0 -0
  60. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_main.py +0 -0
  61. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_model_discovery.py +0 -0
  62. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_msa.py +0 -0
  63. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_pubchem.py +0 -0
  64. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_render.py +0 -0
  65. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_result_artifacts.py +0 -0
  66. {apheris_foundry_cli-2.1.1 → apheris_foundry_cli-2.3.0}/tests/test_skills.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apheris-foundry-cli
3
- Version: 2.1.1
3
+ Version: 2.3.0
4
4
  Summary: Command-line interface for Apheris Foundry workflows.
5
5
  Author: Apheris
6
6
  License-Expression: LicenseRef-Apheris-Foundry-Software-License
@@ -367,7 +367,68 @@ apheris-foundry jobs get --help
367
367
 
368
368
  `--name` optionally names the run. Omitted or blank names submit an unnamed run.
369
369
 
370
- `--model-params` accepts an inline JSON object or a JSON/YAML parameter file. Use an inline object for short overrides, or prefix a `.json`, `.yaml` or `.yml` filename with `@` to load the object from that file. Before submitting the run, the CLI retrieves the selected model version, weight, and capability schema from Hub and validates the object. Use `workflows models` to discover available model IDs and weights.
370
+ ### Choosing how to pass settings
371
+
372
+ Workflow instructions describe the configuration and its meaning; the CLI maps
373
+ that configuration to submission options:
374
+
375
+ | Configuration | CLI option | Where to find accepted values |
376
+ | --- | --- | --- |
377
+ | Model and weight selection | `--model <id> --weight <version-or-enabled-id>` | `workflows models --workflow <id> --json` |
378
+ | Top-level workflow setting | Repeat `--param name=value` | `workflows get --workflow <id> --json` and the workflow docs |
379
+ | Model-parameter object, when the workflow supports it | `--model-params '<JSON object>'` or `--model-params @file.json` / `@file.yaml` | The selected task's parameter schema and workflow restrictions |
380
+ | Input data or a workflow-specific configuration file | `--input <file-or-folder>` | The workflow's input contract and preparation instructions |
381
+
382
+ Read `workflows docs --workflow <id>` and the workflow skill for supported model
383
+ parameters, restrictions and defaults. Model parameters configure how the model
384
+ runs and which outputs it writes. In model discovery, `modelParamsTask` identifies the entry in
385
+ `schemas.tasks[]` whose `parameters` defines field types, enums and constraints. A task
386
+ schema can include fields controlled by the workflow or unsupported by that
387
+ workflow; it is not a promise that every field works as a model override.
388
+ The same model can support different overrides in different workflows.
389
+
390
+ `--model-params` accepts an inline JSON object or a JSON/YAML parameter file.
391
+ Use an inline object for short overrides, or prefix a `.json`, `.yaml` or `.yml`
392
+ filename with `@` to load the object from that file. The CLI retrieves the
393
+ selected model and validates the object against its parameter schema before
394
+ submission. Hub validates declared task-parameter objects before staging a run;
395
+ the workflow also enforces its implementation restrictions. Keep exact field
396
+ names and JSON types, such as `true` rather than `"true"`, and pass only intended
397
+ overrides. Task-schema defaults can differ from workflow defaults, so do not
398
+ copy every schema default into the object.
399
+
400
+ Model task schemas retain their required fields. Hub's `modelParamsSuppliedFields`
401
+ identifies the fields supplied by the workflow; only those may be omitted despite
402
+ being required by the task. Structural fine-tuning requires a positive integer
403
+ `max_steps` inside `--model-params`, for example `'{"max_steps":5000}'`.
404
+ There is no implicit 1,000-step workflow default or unlimited sentinel. Hub also
405
+ checks required fields when the whole model parameter object is omitted.
406
+
407
+ For example, benchmark's batch size is a workflow setting, while its seed and
408
+ detailed-score preference are model parameters:
409
+
410
+ ```bash
411
+ apheris-foundry workflows run --workflow benchmark --input prepared-benchmark/ \
412
+ --model openfold3 \
413
+ --param batchSize=5 \
414
+ --model-params '{"seeds":[42],"write_detailed_scores":true}'
415
+ ```
416
+
417
+ Structural fine-tuning uses the same model-parameter option for its training
418
+ task. Dataset preparation is a separate task configured through `datasetParams`:
419
+
420
+ ```bash
421
+ apheris-foundry workflows run --workflow structural-finetune --input prepared-training/ \
422
+ --model-params '{"max_steps":5000,"learning_rate":0.001}' \
423
+ --param 'datasetParams={"validation_failures":"ignore"}'
424
+ ```
425
+
426
+ Check that the deployed workflow supports these fields before submission.
427
+ The detailed-score preference belongs only in the model-parameter object.
428
+ Do not flatten a model field into `--param write_detailed_scores=false`, pass raw
429
+ `--param modelParams=...`, or translate an uploaded config file's keys into
430
+ flags. Use the route the selected workflow documents; `--help` describes the
431
+ installed CLI syntax.
371
432
 
372
433
  ### YAML model parameters
373
434
 
@@ -445,6 +506,13 @@ identity and ownership. `--dry-run true weights enable ...` prints the request
445
506
  without submission. Verify selection in the target workflow's model catalog
446
507
  before reuse.
447
508
 
509
+ Enabling weights can take several minutes while Hub copies and verifies large
510
+ checkpoints. The HTTP timeout defaults to 300 seconds; use `--timeout 1800` to
511
+ allow 30 minutes, or another positive integer number of seconds (minimum: 1).
512
+ This setting applies only to the enable request and cannot override a shorter server or
513
+ network timeout. If the outcome is uncertain, check `weights list --run-id`
514
+ before retrying; the CLI does not automatically retry the write.
515
+
448
516
  **Sharing.** Enabled weights are private. `--public` shares a weight with every
449
517
  authenticated user of this Hub; they can list, inspect and run with it, but only
450
518
  the owner can update or delete it. Hub fixes visibility when enabling: to stop
@@ -341,7 +341,68 @@ apheris-foundry jobs get --help
341
341
 
342
342
  `--name` optionally names the run. Omitted or blank names submit an unnamed run.
343
343
 
344
- `--model-params` accepts an inline JSON object or a JSON/YAML parameter file. Use an inline object for short overrides, or prefix a `.json`, `.yaml` or `.yml` filename with `@` to load the object from that file. Before submitting the run, the CLI retrieves the selected model version, weight, and capability schema from Hub and validates the object. Use `workflows models` to discover available model IDs and weights.
344
+ ### Choosing how to pass settings
345
+
346
+ Workflow instructions describe the configuration and its meaning; the CLI maps
347
+ that configuration to submission options:
348
+
349
+ | Configuration | CLI option | Where to find accepted values |
350
+ | --- | --- | --- |
351
+ | Model and weight selection | `--model <id> --weight <version-or-enabled-id>` | `workflows models --workflow <id> --json` |
352
+ | Top-level workflow setting | Repeat `--param name=value` | `workflows get --workflow <id> --json` and the workflow docs |
353
+ | Model-parameter object, when the workflow supports it | `--model-params '<JSON object>'` or `--model-params @file.json` / `@file.yaml` | The selected task's parameter schema and workflow restrictions |
354
+ | Input data or a workflow-specific configuration file | `--input <file-or-folder>` | The workflow's input contract and preparation instructions |
355
+
356
+ Read `workflows docs --workflow <id>` and the workflow skill for supported model
357
+ parameters, restrictions and defaults. Model parameters configure how the model
358
+ runs and which outputs it writes. In model discovery, `modelParamsTask` identifies the entry in
359
+ `schemas.tasks[]` whose `parameters` defines field types, enums and constraints. A task
360
+ schema can include fields controlled by the workflow or unsupported by that
361
+ workflow; it is not a promise that every field works as a model override.
362
+ The same model can support different overrides in different workflows.
363
+
364
+ `--model-params` accepts an inline JSON object or a JSON/YAML parameter file.
365
+ Use an inline object for short overrides, or prefix a `.json`, `.yaml` or `.yml`
366
+ filename with `@` to load the object from that file. The CLI retrieves the
367
+ selected model and validates the object against its parameter schema before
368
+ submission. Hub validates declared task-parameter objects before staging a run;
369
+ the workflow also enforces its implementation restrictions. Keep exact field
370
+ names and JSON types, such as `true` rather than `"true"`, and pass only intended
371
+ overrides. Task-schema defaults can differ from workflow defaults, so do not
372
+ copy every schema default into the object.
373
+
374
+ Model task schemas retain their required fields. Hub's `modelParamsSuppliedFields`
375
+ identifies the fields supplied by the workflow; only those may be omitted despite
376
+ being required by the task. Structural fine-tuning requires a positive integer
377
+ `max_steps` inside `--model-params`, for example `'{"max_steps":5000}'`.
378
+ There is no implicit 1,000-step workflow default or unlimited sentinel. Hub also
379
+ checks required fields when the whole model parameter object is omitted.
380
+
381
+ For example, benchmark's batch size is a workflow setting, while its seed and
382
+ detailed-score preference are model parameters:
383
+
384
+ ```bash
385
+ apheris-foundry workflows run --workflow benchmark --input prepared-benchmark/ \
386
+ --model openfold3 \
387
+ --param batchSize=5 \
388
+ --model-params '{"seeds":[42],"write_detailed_scores":true}'
389
+ ```
390
+
391
+ Structural fine-tuning uses the same model-parameter option for its training
392
+ task. Dataset preparation is a separate task configured through `datasetParams`:
393
+
394
+ ```bash
395
+ apheris-foundry workflows run --workflow structural-finetune --input prepared-training/ \
396
+ --model-params '{"max_steps":5000,"learning_rate":0.001}' \
397
+ --param 'datasetParams={"validation_failures":"ignore"}'
398
+ ```
399
+
400
+ Check that the deployed workflow supports these fields before submission.
401
+ The detailed-score preference belongs only in the model-parameter object.
402
+ Do not flatten a model field into `--param write_detailed_scores=false`, pass raw
403
+ `--param modelParams=...`, or translate an uploaded config file's keys into
404
+ flags. Use the route the selected workflow documents; `--help` describes the
405
+ installed CLI syntax.
345
406
 
346
407
  ### YAML model parameters
347
408
 
@@ -419,6 +480,13 @@ identity and ownership. `--dry-run true weights enable ...` prints the request
419
480
  without submission. Verify selection in the target workflow's model catalog
420
481
  before reuse.
421
482
 
483
+ Enabling weights can take several minutes while Hub copies and verifies large
484
+ checkpoints. The HTTP timeout defaults to 300 seconds; use `--timeout 1800` to
485
+ allow 30 minutes, or another positive integer number of seconds (minimum: 1).
486
+ This setting applies only to the enable request and cannot override a shorter server or
487
+ network timeout. If the outcome is uncertain, check `weights list --run-id`
488
+ before retrying; the CLI does not automatically retry the write.
489
+
422
490
  **Sharing.** Enabled weights are private. `--public` shares a weight with every
423
491
  authenticated user of this Hub; they can list, inspect and run with it, but only
424
492
  the owner can update or delete it. Hub fixes visibility when enabling: to stop
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "apheris-foundry-cli"
7
- version = "2.1.1"
7
+ version = "2.3.0"
8
8
  description = "Command-line interface for Apheris Foundry workflows."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apheris-foundry-cli
3
- Version: 2.1.1
3
+ Version: 2.3.0
4
4
  Summary: Command-line interface for Apheris Foundry workflows.
5
5
  Author: Apheris
6
6
  License-Expression: LicenseRef-Apheris-Foundry-Software-License
@@ -367,7 +367,68 @@ apheris-foundry jobs get --help
367
367
 
368
368
  `--name` optionally names the run. Omitted or blank names submit an unnamed run.
369
369
 
370
- `--model-params` accepts an inline JSON object or a JSON/YAML parameter file. Use an inline object for short overrides, or prefix a `.json`, `.yaml` or `.yml` filename with `@` to load the object from that file. Before submitting the run, the CLI retrieves the selected model version, weight, and capability schema from Hub and validates the object. Use `workflows models` to discover available model IDs and weights.
370
+ ### Choosing how to pass settings
371
+
372
+ Workflow instructions describe the configuration and its meaning; the CLI maps
373
+ that configuration to submission options:
374
+
375
+ | Configuration | CLI option | Where to find accepted values |
376
+ | --- | --- | --- |
377
+ | Model and weight selection | `--model <id> --weight <version-or-enabled-id>` | `workflows models --workflow <id> --json` |
378
+ | Top-level workflow setting | Repeat `--param name=value` | `workflows get --workflow <id> --json` and the workflow docs |
379
+ | Model-parameter object, when the workflow supports it | `--model-params '<JSON object>'` or `--model-params @file.json` / `@file.yaml` | The selected task's parameter schema and workflow restrictions |
380
+ | Input data or a workflow-specific configuration file | `--input <file-or-folder>` | The workflow's input contract and preparation instructions |
381
+
382
+ Read `workflows docs --workflow <id>` and the workflow skill for supported model
383
+ parameters, restrictions and defaults. Model parameters configure how the model
384
+ runs and which outputs it writes. In model discovery, `modelParamsTask` identifies the entry in
385
+ `schemas.tasks[]` whose `parameters` defines field types, enums and constraints. A task
386
+ schema can include fields controlled by the workflow or unsupported by that
387
+ workflow; it is not a promise that every field works as a model override.
388
+ The same model can support different overrides in different workflows.
389
+
390
+ `--model-params` accepts an inline JSON object or a JSON/YAML parameter file.
391
+ Use an inline object for short overrides, or prefix a `.json`, `.yaml` or `.yml`
392
+ filename with `@` to load the object from that file. The CLI retrieves the
393
+ selected model and validates the object against its parameter schema before
394
+ submission. Hub validates declared task-parameter objects before staging a run;
395
+ the workflow also enforces its implementation restrictions. Keep exact field
396
+ names and JSON types, such as `true` rather than `"true"`, and pass only intended
397
+ overrides. Task-schema defaults can differ from workflow defaults, so do not
398
+ copy every schema default into the object.
399
+
400
+ Model task schemas retain their required fields. Hub's `modelParamsSuppliedFields`
401
+ identifies the fields supplied by the workflow; only those may be omitted despite
402
+ being required by the task. Structural fine-tuning requires a positive integer
403
+ `max_steps` inside `--model-params`, for example `'{"max_steps":5000}'`.
404
+ There is no implicit 1,000-step workflow default or unlimited sentinel. Hub also
405
+ checks required fields when the whole model parameter object is omitted.
406
+
407
+ For example, benchmark's batch size is a workflow setting, while its seed and
408
+ detailed-score preference are model parameters:
409
+
410
+ ```bash
411
+ apheris-foundry workflows run --workflow benchmark --input prepared-benchmark/ \
412
+ --model openfold3 \
413
+ --param batchSize=5 \
414
+ --model-params '{"seeds":[42],"write_detailed_scores":true}'
415
+ ```
416
+
417
+ Structural fine-tuning uses the same model-parameter option for its training
418
+ task. Dataset preparation is a separate task configured through `datasetParams`:
419
+
420
+ ```bash
421
+ apheris-foundry workflows run --workflow structural-finetune --input prepared-training/ \
422
+ --model-params '{"max_steps":5000,"learning_rate":0.001}' \
423
+ --param 'datasetParams={"validation_failures":"ignore"}'
424
+ ```
425
+
426
+ Check that the deployed workflow supports these fields before submission.
427
+ The detailed-score preference belongs only in the model-parameter object.
428
+ Do not flatten a model field into `--param write_detailed_scores=false`, pass raw
429
+ `--param modelParams=...`, or translate an uploaded config file's keys into
430
+ flags. Use the route the selected workflow documents; `--help` describes the
431
+ installed CLI syntax.
371
432
 
372
433
  ### YAML model parameters
373
434
 
@@ -445,6 +506,13 @@ identity and ownership. `--dry-run true weights enable ...` prints the request
445
506
  without submission. Verify selection in the target workflow's model catalog
446
507
  before reuse.
447
508
 
509
+ Enabling weights can take several minutes while Hub copies and verifies large
510
+ checkpoints. The HTTP timeout defaults to 300 seconds; use `--timeout 1800` to
511
+ allow 30 minutes, or another positive integer number of seconds (minimum: 1).
512
+ This setting applies only to the enable request and cannot override a shorter server or
513
+ network timeout. If the outcome is uncertain, check `weights list --run-id`
514
+ before retrying; the CLI does not automatically retry the write.
515
+
448
516
  **Sharing.** Enabled weights are private. `--public` shares a weight with every
449
517
  authenticated user of this Hub; they can list, inspect and run with it, but only
450
518
  the owner can update or delete it. Hub fixes visibility when enabling: to stop
@@ -13,6 +13,7 @@ src/apherisfold_cli/main.py
13
13
  src/apherisfold_cli/version.py
14
14
  src/apherisfold_cli/commands/__init__.py
15
15
  src/apherisfold_cli/commands/compounds.py
16
+ src/apherisfold_cli/commands/docs.py
16
17
  src/apherisfold_cli/commands/foundry.py
17
18
  src/apherisfold_cli/commands/login.py
18
19
  src/apherisfold_cli/commands/settings.py
@@ -40,6 +41,7 @@ tests/test_auth_lifecycle.py
40
41
  tests/test_benchmark_examples.py
41
42
  tests/test_cli.py
42
43
  tests/test_config.py
44
+ tests/test_docs.py
43
45
  tests/test_documents.py
44
46
  tests/test_dry_run_guard.py
45
47
  tests/test_foundry_helpers.py
@@ -0,0 +1,105 @@
1
+ """Read the selected Hub's private documentation using its navigation."""
2
+
3
+ import hashlib
4
+ import re
5
+ from typing import Annotated, Any
6
+
7
+ import typer
8
+ from rich import box
9
+ from rich.markdown import Markdown
10
+ from rich.table import Table
11
+ from rich.text import Text
12
+
13
+ from apherisfold_cli.core.errors import EXIT_INPUT_DATA, EXIT_USAGE, CLIError
14
+ from apherisfold_cli.core.hub_requests import get_hub_document, get_hub_documentation_index
15
+ from apherisfold_cli.handlers import run_simple_listing
16
+
17
+ app = typer.Typer(no_args_is_help=True, help="Read private release notes, known issues and guides from your Hub.")
18
+
19
+
20
+ def _invalid() -> CLIError:
21
+ return CLIError(
22
+ code=EXIT_INPUT_DATA, category="input-data", message="Hub returned invalid documentation.", task="docs"
23
+ )
24
+
25
+
26
+ def _pages(entries: Any, depth: int = 0) -> list[dict[str, str]]:
27
+ if not isinstance(entries, list) or not entries or depth > 20:
28
+ raise _invalid()
29
+ pages = []
30
+ for entry in entries:
31
+ if not isinstance(entry, dict) or not isinstance(entry.get("title"), str):
32
+ raise _invalid()
33
+ path = entry.get("path")
34
+ if path is not None:
35
+ if (
36
+ not isinstance(path, str)
37
+ or not path.endswith(".md")
38
+ or any(part in {"", ".", ".."} for part in path.split("/"))
39
+ or any(char in path for char in "\\?#:%")
40
+ ):
41
+ raise _invalid()
42
+ pages.append({"title": entry["title"], "path": path})
43
+ else:
44
+ pages.extend(_pages(entry.get("children"), depth + 1))
45
+ return pages
46
+
47
+
48
+ def _index() -> tuple[dict[str, Any], list[dict[str, str]]]:
49
+ payload = get_hub_documentation_index()
50
+ if not isinstance(payload.get("hubVersion"), str):
51
+ raise _invalid()
52
+ return payload, _pages(payload.get("navigation"))
53
+
54
+
55
+ @app.command("list", help="List the private documents available on the selected Hub.")
56
+ def list_docs(
57
+ json_output: Annotated[bool, typer.Option("--json", help="Return the original navigation as JSON.")] = False,
58
+ ) -> None:
59
+ payload, pages = _index()
60
+ if json_output:
61
+ run_simple_listing(payload=payload)
62
+ return
63
+ table = Table("Document", "Path", box=box.SIMPLE_HEAD)
64
+ for page in pages:
65
+ table.add_row(Text(page["title"]), Text(page["path"]))
66
+ run_simple_listing(payload=payload, renderable_output=table)
67
+
68
+
69
+ @app.command("show", help="Read a document path from 'docs list'. Use --raw to export its original Markdown.")
70
+ def show_doc(
71
+ path: Annotated[str, typer.Argument(help="Document path from docs list.")],
72
+ json_output: Annotated[
73
+ bool, typer.Option("--json", help="Return source Markdown, version and digest as JSON.")
74
+ ] = False,
75
+ raw: Annotated[
76
+ bool, typer.Option("--raw", help="Write exact source Markdown to stdout for offline reading.")
77
+ ] = False,
78
+ ) -> None:
79
+ if raw and json_output:
80
+ raise typer.BadParameter("Use either --raw or --json.")
81
+ _, pages = _index()
82
+ if path not in {page["path"] for page in pages}:
83
+ raise CLIError(
84
+ code=EXIT_USAGE,
85
+ category="usage",
86
+ message="Document is not listed by this Hub. Run 'apheris-foundry docs list'.",
87
+ task="docs.show",
88
+ )
89
+ payload = get_hub_document(path)
90
+ content = payload.get("content")
91
+ if (
92
+ payload.get("path") != path
93
+ or not isinstance(content, str)
94
+ or not content.strip()
95
+ or payload.get("sha256") != hashlib.sha256(content.encode("utf-8")).hexdigest()
96
+ or any(not isinstance(payload.get(key), str) for key in ("hubVersion", "type", "title"))
97
+ ):
98
+ raise _invalid()
99
+ if raw:
100
+ typer.echo(content, nl=False)
101
+ elif json_output:
102
+ run_simple_listing(payload=payload)
103
+ else:
104
+ body = re.sub(r"\A---\r?\n[\s\S]*?\r?\n---(?:\r?\n|\Z)", "", content, count=1)
105
+ run_simple_listing(payload=payload, renderable_output=Markdown(body))
@@ -234,6 +234,10 @@ def enable_weight(
234
234
  help="Share with every authenticated user of this Hub. Cannot be changed later; private by default.",
235
235
  ),
236
236
  ] = False,
237
+ timeout: Annotated[
238
+ int,
239
+ typer.Option("--timeout", min=1, help="HTTP timeout in seconds while Hub copies and registers the weights."),
240
+ ] = 300,
237
241
  json_output: Annotated[bool, typer.Option("--json")] = False,
238
242
  ) -> None:
239
243
  """Enable weights from a job artifact in Hub's weight catalog; this does not run prediction.
@@ -265,7 +269,7 @@ def enable_weight(
265
269
  json_output=json_output,
266
270
  )
267
271
  return
268
- payload = deploy_model_weight(body)
272
+ payload = deploy_model_weight(body, timeout=timeout)
269
273
  if json_output:
270
274
  run_simple_listing(payload=payload)
271
275
  return
@@ -191,6 +191,7 @@ def _request_json(
191
191
  task: str,
192
192
  body: dict[str, Any] | None = None,
193
193
  content_type: str = "application/json",
194
+ timeout: float = 30,
194
195
  ) -> dict[str, Any]:
195
196
  url = _hub_url(path)
196
197
  payload: bytes | None = None
@@ -205,7 +206,7 @@ def _request_json(
205
206
  method=method,
206
207
  )
207
208
 
208
- raw = _read_with_auth_retry(build_request=build_request, timeout=30, task=task, url=url)
209
+ raw = _read_with_auth_retry(build_request=build_request, timeout=timeout, task=task, url=url)
209
210
  return _decode_json(raw, task=task, url=url)
210
211
 
211
212
 
@@ -300,6 +301,27 @@ def get_foundry_workflow_docs(workflow_id: str) -> dict[str, Any]:
300
301
  return _request_json(path=f"/api/v1/foundry/workflows/{encoded}/docs", method="GET", task="foundry.workflows.docs")
301
302
 
302
303
 
304
+ def _request_hub_documentation(path: str, task: str) -> dict[str, Any]:
305
+ try:
306
+ return _request_json(path=path, method="GET", task=task)
307
+ except CLIError as error:
308
+ status = (error.details or {}).get("status_code")
309
+ if status == 404:
310
+ error.message = "This document is unavailable, or the selected Hub does not support private documentation. Check the Hub version and run 'apheris-foundry docs list'."
311
+ elif status in {401, 403}:
312
+ error.message = "Private documentation requires Hub login and access to this deployment. Run 'apheris-foundry login' with an authorized account."
313
+ raise
314
+
315
+
316
+ def get_hub_documentation_index() -> dict[str, Any]:
317
+ return _request_hub_documentation("/api/v1/docs", "docs.list")
318
+
319
+
320
+ def get_hub_document(path: str) -> dict[str, Any]:
321
+ encoded = urllib.parse.quote(path, safe="/")
322
+ return _request_hub_documentation(f"/api/v1/docs/pages/{encoded}", "docs.show")
323
+
324
+
303
325
  def get_foundry_workflow_skill(workflow_id: str) -> dict[str, Any]:
304
326
  encoded = urllib.parse.quote(workflow_id, safe="")
305
327
  return _request_json(path=f"/api/v1/foundry/workflows/{encoded}/skill", method="GET", task="foundry.skills.get")
@@ -511,9 +533,13 @@ def list_model_weights(
511
533
  return _request_json(path="/api/v1/weights" + suffix, method="GET", task="weights.list")
512
534
 
513
535
 
514
- def deploy_model_weight(body: dict[str, Any]) -> dict[str, Any]:
536
+ def deploy_model_weight(body: dict[str, Any], *, timeout: float = 300) -> dict[str, Any]:
515
537
  try:
516
- return _request_json(path="/api/v1/weights/deploy", method="POST", body=body, task="weights.deploy")
538
+ # Hub copies, hashes and syncs multi-GB checkpoints before responding.
539
+ # Allow a longer wait without extending ordinary API reads or retrying writes.
540
+ return _request_json(
541
+ path="/api/v1/weights/deploy", method="POST", body=body, task="weights.deploy", timeout=timeout
542
+ )
517
543
  except CLIError as exc:
518
544
  if (exc.details or {}).get("status_code") != 409:
519
545
  raise
@@ -19,6 +19,7 @@ from typer.core import TyperGroup
19
19
 
20
20
  from apherisfold_cli.commands import login
21
21
  from apherisfold_cli.commands.compounds import app as compounds_app
22
+ from apherisfold_cli.commands.docs import app as docs_app
22
23
  from apherisfold_cli.commands.foundry import (
23
24
  _DEFAULT_LIST_LIMIT,
24
25
  RESEARCH_PREVIEW_NOTICE,
@@ -123,6 +124,7 @@ app.add_typer(login.app, name="login", help="Log in to a Hub instance or inspect
123
124
  app.add_typer(workflows_app, name="workflows")
124
125
  app.add_typer(jobs_app, name="jobs")
125
126
  app.add_typer(skills_app, name="skills")
127
+ app.add_typer(docs_app, name="docs")
126
128
  app.add_typer(settings_app, name="settings")
127
129
  app.add_typer(weights_app, name="weights")
128
130
  app.add_typer(tools_app, name="tools")
@@ -773,8 +775,11 @@ def _resolve_foundry_model_selection(
773
775
  def _foundry_model_params_schema(model: dict[str, Any]) -> dict[str, Any]:
774
776
  schemas = model.get("schemas")
775
777
  tasks = schemas.get("tasks") if isinstance(schemas, dict) else None
778
+ task_name = model.get("modelParamsTask")
779
+ if not isinstance(task_name, str) or not task_name:
780
+ raise typer.BadParameter("Hub did not declare a modelParams task for the selected model")
776
781
  task = (
777
- next((item for item in tasks if isinstance(item, dict) and item.get("name") == "predict"), None)
782
+ next((item for item in tasks if isinstance(item, dict) and item.get("name") == task_name), None)
778
783
  if isinstance(tasks, list)
779
784
  else None
780
785
  )
@@ -782,9 +787,11 @@ def _foundry_model_params_schema(model: dict[str, Any]) -> dict[str, Any]:
782
787
  properties = parameters.get("properties") if isinstance(parameters, dict) else None
783
788
  if not isinstance(properties, dict):
784
789
  raise typer.BadParameter("Hub did not provide model parameter schema for the selected model")
785
- # These are overrides; the workflow supplies required execution fields.
786
- # Keep definitions so model-published $ref constraints still resolve.
787
- return {**parameters, "required": []}
790
+ # Only fields explicitly supplied by the workflow may be omitted.
791
+ supplied = model.get("modelParamsSuppliedFields", [])
792
+ if not isinstance(supplied, list) or any(not isinstance(field, str) for field in supplied):
793
+ raise typer.BadParameter("Hub provided invalid workflow-supplied model parameter fields")
794
+ return {**parameters, "required": [field for field in parameters.get("required", []) if field not in supplied]}
788
795
 
789
796
 
790
797
  def _generic_input_files(input_paths: list[Path] | None) -> dict[str, str] | None:
@@ -69,6 +69,41 @@ Hub package deployment, not choosing one arbitrarily.
69
69
  actual settings, artifact locations, and limitations; execution success alone
70
70
  does not demonstrate a scientific improvement.
71
71
 
72
+ ### Passing workflow and model settings
73
+
74
+ Translate the selected workflow's client-neutral instructions into the CLI's
75
+ submission options. Discover supported settings with `workflows get` and
76
+ `workflows docs`, and model schemas with `workflows models`, each for the chosen
77
+ workflow. Use command-specific `--help` for the installed syntax.
78
+
79
+ - Select a model and weight with `--model` and `--weight` using catalog values.
80
+ - Pass a top-level workflow setting with `--param name=value`, repeated as needed.
81
+ - When the workflow supports a model-parameter object, pass it with
82
+ `--model-params '<JSON object>'` or `--model-params @file.json` / `@file.yaml`.
83
+ - Stage input manifests and workflow-specific configuration files through
84
+ `--input` as the workflow documents; their keys are not automatically flags.
85
+
86
+ Model parameters configure how the model runs and which outputs it writes.
87
+ Use `modelParamsTask` in model discovery to select the task's parameter schema;
88
+ preserve required fields except those listed in `modelParamsSuppliedFields`.
89
+ Structural fine-tuning requires an explicit positive `max_steps`; omission,
90
+ `null`, zero and negative values are invalid.
91
+ Apply the schema's types and constraints together with the workflow's restrictions. A model schema can advertise workflow-owned or
92
+ unsupported fields; CLI schema validation does not replace workflow validation.
93
+ Preserve field names, JSON booleans, arrays and numbers. Submit only intended
94
+ overrides: copying task-schema defaults can replace different workflow defaults.
95
+
96
+ For example, a documented `write_detailed_scores` model parameter goes inside
97
+ `--model-params '{"write_detailed_scores":true}'`; a documented `batchSize`
98
+ workflow setting uses `--param batchSize=5`. Do not rename fields, flatten model
99
+ fields into `--param`, or pass raw `--param modelParams=...`.
100
+ For structural fine-tuning, training fields such as `max_steps` and
101
+ `learning_rate` go in `--model-params`. Dataset-task overrides use the separate
102
+ workflow parameter, for example `--param 'datasetParams={"validation_failures":"ignore"}'`.
103
+ Hub validates both declared objects before staging a run.
104
+ These examples apply only when the deployed workflow
105
+ supports those settings; discover them before use.
106
+
72
107
  ### Research previews
73
108
 
74
109
  Workflow and model JSON may include `researchPreview: true`. When the selected
@@ -329,6 +364,17 @@ apheris-foundry weights enable --name <unique-weight-name> --run-id <training-jo
329
364
  does not run prediction or upload local weights. On Hub versions containing
330
365
  hub#3142, enabled weights survive deletion of the producing job.
331
366
 
367
+ Hub copies and verifies the checkpoint before replying, so large weights may
368
+ need several minutes. `weights enable --timeout SECONDS` controls the CLI's
369
+ HTTP wait: the default is 300 seconds (five minutes), and the minimum is one second.
370
+ For larger weights, add `--timeout 1800` to allow 30 minutes; use a positive
371
+ integer number of seconds. Confirm the installed command exposes this option with
372
+ `weights enable --help`. A longer CLI timeout cannot override a shorter server
373
+ or network timeout. On a timeout or lost response, check
374
+ `weights list --run-id <training-job-id> --json` and the target model catalog
375
+ before retrying: Hub may have applied the request. The CLI does not automatically
376
+ retry an uncertain write.
377
+
332
378
  A 409 means inspect existing weights and the reported conflict before
333
379
  retrying. A listing alone does not prove backing files still exist. Deleted
334
380
  records (`--include-deleted`) are historical, not selectable weights.
@@ -0,0 +1 @@
1
+ __version__ = "2.3.0"
@@ -12,6 +12,7 @@ from typing import Any
12
12
  from unittest.mock import patch
13
13
 
14
14
  import pytest
15
+ from rich.console import Console
15
16
  from rich.text import Text
16
17
  from typer.testing import CliRunner
17
18
 
@@ -383,6 +384,8 @@ def hub_api_fixture(monkeypatch):
383
384
  "seeds": [42],
384
385
  }
385
386
  },
387
+ "modelParamsTask": "predict",
388
+ "modelParamsSuppliedFields": ["weights"],
386
389
  "schemas": {
387
390
  "tasks": [
388
391
  {
@@ -414,6 +417,7 @@ def hub_api_fixture(monkeypatch):
414
417
  "type": "array",
415
418
  "items": {"type": "string"},
416
419
  },
420
+ "write_detailed_scores": {"type": "boolean", "default": False},
417
421
  },
418
422
  },
419
423
  }
@@ -566,25 +570,66 @@ def _workflow_docs_payload(content: str = "# OpenFold3 Prediction\n\nPredict str
566
570
  }
567
571
 
568
572
 
569
- def test_foundry_workflows_docs_renders_the_package_readme(monkeypatch) -> None:
573
+ @pytest.fixture
574
+ def workflow_docs_markdown() -> str:
575
+ return """# Example workflow
576
+
577
+ ## Inputs
578
+
579
+ **Include both files.** Compute allocation is managed by Hub.
580
+
581
+ - Upload `input.csv`.
582
+ - Upload `config.json`.
583
+
584
+ | Setting | Meaning | Default |
585
+ | --- | --- | --- |
586
+ | `limit` | Maximum rows | 10 |
587
+
588
+ ```json
589
+ {"limit": 5}
590
+ ```
591
+
592
+ ## Results
593
+
594
+ 1. Download `result.json`.
595
+ 2. Inspect missing values.
596
+ """
597
+
598
+
599
+ @pytest.mark.parametrize("force_terminal", [False, True])
600
+ def test_foundry_workflows_docs_renders_the_package_readme(monkeypatch, workflow_docs_markdown, force_terminal) -> None:
570
601
  requested: list[str] = []
602
+ console = Console(force_terminal=force_terminal, color_system="standard", width=100)
603
+ monkeypatch.setattr("apherisfold_cli.handlers._CONSOLE", console)
571
604
 
572
605
  def fake_get_foundry_workflow_docs(workflow_id):
573
606
  requested.append(workflow_id)
574
- return _workflow_docs_payload()
607
+ return _workflow_docs_payload(workflow_docs_markdown)
575
608
 
576
609
  monkeypatch.setattr("apherisfold_cli.main.get_foundry_workflow_docs", fake_get_foundry_workflow_docs)
577
610
  result = runner.invoke(app, ["workflows", "docs", "--workflow", "predict"])
578
611
 
579
612
  assert result.exit_code == 0
580
- assert "OpenFold3 Prediction" in result.stdout
581
- assert "# OpenFold3" not in result.stdout
582
- assert "Predict structures." in result.stdout
613
+ rendered = Text.from_ansi(result.stdout)
614
+ output = rendered.plain
615
+ assert "Example workflow" in output
616
+ assert "Inputs" in output and "Results" in output
617
+ assert "Upload input.csv." in output and "Upload config.json." in output
618
+ assert "1 Download result.json." in output and "2 Inspect missing values." in output
619
+ assert "Setting" in output and "Meaning" in output and "Default" in output
620
+ assert "limit" in output and "Maximum rows" in output and "10" in output
621
+ assert '{"limit": 5}' in output
622
+ assert "Include both files." in output and "Compute allocation is managed by Hub." in output
623
+ for marker in ("# Example", "## Inputs", "**", "```", "| Setting |", "| --- |"):
624
+ assert marker not in output
625
+ if force_terminal:
626
+ assert rendered.get_style_at_offset(console, output.index("Include both files.")).bold
627
+ assert not rendered.get_style_at_offset(console, output.index("Compute allocation")).bold
583
628
  assert requested == ["predict"]
584
629
 
585
630
 
586
- def test_foundry_workflows_docs_json_output(monkeypatch) -> None:
587
- payload = _workflow_docs_payload()
631
+ def test_foundry_workflows_docs_json_output(monkeypatch, workflow_docs_markdown) -> None:
632
+ payload = _workflow_docs_payload(workflow_docs_markdown)
588
633
  monkeypatch.setattr("apherisfold_cli.main.get_foundry_workflow_docs", lambda workflow_id: payload)
589
634
  result = runner.invoke(app, ["workflows", "docs", "--workflow", "predict", "--json"])
590
635
 
@@ -810,6 +855,40 @@ def test_foundry_workflows_run_preserves_pocket_example_queries(tmp_path: Path,
810
855
  ]
811
856
 
812
857
 
858
+ @pytest.mark.parametrize("enabled", [True, False])
859
+ @pytest.mark.parametrize("from_file", [True, False])
860
+ def test_foundry_workflows_run_forwards_explicit_detailed_scores(
861
+ tmp_path: Path, hub_api_fixture, enabled: bool, from_file: bool
862
+ ) -> None:
863
+ request = tmp_path / "input.json"
864
+ request.write_text('{"queries": []}', encoding="utf-8")
865
+ model_params = {"num_diffusion_samples": 5, "seeds": [42], "write_detailed_scores": enabled}
866
+ encoded = json.dumps(model_params)
867
+ if from_file:
868
+ params_file = tmp_path / "model-params.json"
869
+ params_file.write_text(encoded, encoding="utf-8")
870
+ encoded = f"@{params_file}"
871
+
872
+ result = runner.invoke(
873
+ app,
874
+ [
875
+ "workflows",
876
+ "run",
877
+ "--workflow",
878
+ "predict",
879
+ "--input",
880
+ str(request),
881
+ "--model",
882
+ "openfold3",
883
+ "--model-params",
884
+ encoded,
885
+ ],
886
+ )
887
+
888
+ assert result.exit_code == 0, result.output
889
+ assert json.loads(hub_api_fixture["create_foundry_run"][0]["params"]["modelParams"]) == model_params
890
+
891
+
813
892
  def test_foundry_workflows_run_loads_model_params_from_json_file(tmp_path: Path, hub_api_fixture) -> None:
814
893
  request = tmp_path / "input.json"
815
894
  request.write_text('{"queries": []}', encoding="utf-8")
@@ -883,6 +962,8 @@ def test_foundry_workflows_run_rejects_missing_input_before_submission(workflow:
883
962
  "models": [
884
963
  {
885
964
  "id": "openfold3",
965
+ "modelParamsTask": "predict",
966
+ "modelParamsSuppliedFields": ["weights"],
886
967
  "schemas": {
887
968
  "tasks": [
888
969
  {
@@ -0,0 +1,102 @@
1
+ import hashlib
2
+ import json
3
+
4
+ import pytest
5
+ from typer.testing import CliRunner
6
+
7
+ from apherisfold_cli.commands import docs
8
+ from apherisfold_cli.core import hub_requests
9
+ from apherisfold_cli.core.errors import CLIError
10
+ from apherisfold_cli.main import app
11
+
12
+ runner = CliRunner()
13
+ PATH = "releases/example/notes.md"
14
+ CONTENT = "---\r\ndocument_type: release-notes\r\n---\r\n# Release\r\n\r\n| Name | Value |\r\n| --- | --- |\r\n| CLI | `docs list` |\r\n\r\n```bash\napheris-foundry login status\n```\n"
15
+
16
+
17
+ @pytest.fixture
18
+ def document(monkeypatch):
19
+ index = {
20
+ "hubVersion": "example",
21
+ "navigation": [{"title": "Releases", "children": [{"title": "Notes", "path": PATH}]}],
22
+ }
23
+ payload = {
24
+ "hubVersion": "example",
25
+ "title": "Notes",
26
+ "path": PATH,
27
+ "type": "release-notes",
28
+ "content": CONTENT,
29
+ "sha256": hashlib.sha256(CONTENT.encode()).hexdigest(),
30
+ }
31
+ monkeypatch.setattr(docs, "get_hub_documentation_index", lambda: index)
32
+ monkeypatch.setattr(docs, "get_hub_document", lambda path: payload)
33
+ return payload
34
+
35
+
36
+ def test_list_and_formatted_document(document):
37
+ result = runner.invoke(app, ["docs", "list"])
38
+ assert result.exit_code == 0, result.output
39
+ assert PATH in result.output
40
+ result = runner.invoke(app, ["docs", "show", PATH])
41
+ assert result.exit_code == 0, result.output
42
+ assert "Release" in result.output
43
+ assert "docs list" in result.output
44
+ assert "apheris-foundry login status" in result.output
45
+ assert "document_type" not in result.output
46
+ assert "| --- |" not in result.output
47
+
48
+
49
+ def test_export_preserves_exact_source_and_digest(document):
50
+ raw = runner.invoke(app, ["docs", "show", PATH, "--raw"])
51
+ assert raw.exit_code == 0, raw.output
52
+ assert raw.stdout_bytes == CONTENT.encode()
53
+ exported = runner.invoke(app, ["docs", "show", PATH, "--json"])
54
+ assert exported.exit_code == 0, exported.output
55
+ assert json.loads(exported.output) == document
56
+
57
+
58
+ @pytest.mark.parametrize(
59
+ "change", [{"content": "tampered"}, {"sha256": "bad"}, {"path": "other.md"}, {"content": None}]
60
+ )
61
+ def test_invalid_content_never_exported(document, change):
62
+ document.update(change)
63
+ result = runner.invoke(app, ["docs", "show", PATH, "--raw"])
64
+ assert result.exit_code != 0
65
+ assert not result.stdout_bytes
66
+
67
+
68
+ def test_unlisted_path_does_not_fetch(document, monkeypatch):
69
+ def unexpected(path):
70
+ pytest.fail("Unlisted path was fetched")
71
+
72
+ monkeypatch.setattr(docs, "get_hub_document", unexpected)
73
+ result = runner.invoke(app, ["docs", "show", "../secret.md"])
74
+ assert result.exit_code != 0
75
+ assert isinstance(result.exception, CLIError)
76
+ assert "docs list" in result.exception.message
77
+
78
+
79
+ @pytest.mark.parametrize("status", [401, 403, 404, 503])
80
+ def test_document_http_errors_preserve_status_and_help(status, monkeypatch):
81
+ def failed(**kwargs):
82
+ raise CLIError(
83
+ code=4, category="upstream", message="Original failure", task="docs", details={"status_code": status}
84
+ )
85
+
86
+ monkeypatch.setattr(hub_requests, "_request_json", failed)
87
+ with pytest.raises(CLIError) as error:
88
+ hub_requests.get_hub_documentation_index()
89
+ assert error.value.details["status_code"] == status
90
+ if status in {401, 403}:
91
+ assert "login" in error.value.message
92
+ elif status == 404:
93
+ assert "Hub" in error.value.message and "docs list" in error.value.message
94
+ else:
95
+ assert error.value.message == "Original failure"
96
+
97
+
98
+ def test_document_path_encoding(monkeypatch):
99
+ calls = []
100
+ monkeypatch.setattr(hub_requests, "_request_json", lambda **kwargs: calls.append(kwargs) or {})
101
+ hub_requests.get_hub_document("releases/example/a page.md")
102
+ assert calls[0]["path"] == "/api/v1/docs/pages/releases/example/a%20page.md"
@@ -18,6 +18,8 @@ def test_model_schema_references_are_preserved_for_yaml_overrides():
18
18
  }
19
19
  schema = _foundry_model_params_schema(
20
20
  {
21
+ "modelParamsTask": "predict",
22
+ "modelParamsSuppliedFields": ["weights"],
21
23
  "schemas": {"tasks": [{"name": "predict", "parameters": parameters}]},
22
24
  }
23
25
  )
@@ -98,9 +100,70 @@ def test_yaml_rejects_overflow_and_nested_duplicate_keys():
98
100
 
99
101
  def test_model_boolean_property_schemas_are_preserved():
100
102
  parameters = {"type": "object", "properties": {"allowed": True, "blocked": False}, "additionalProperties": False}
101
- schema = _foundry_model_params_schema({"schemas": {"tasks": [{"name": "predict", "parameters": parameters}]}})
103
+ schema = _foundry_model_params_schema(
104
+ {
105
+ "modelParamsTask": "predict",
106
+ "modelParamsSuppliedFields": ["weights"],
107
+ "schemas": {"tasks": [{"name": "predict", "parameters": parameters}]},
108
+ }
109
+ )
102
110
  validate({"allowed": {"anything": [1, 2]}}, schema)
103
111
  for overrides in ({"blocked": 1}, {"unknown": 1}):
104
112
  with pytest.raises(ValidationError):
105
113
  validate(overrides, schema)
106
114
  assert "required" not in parameters
115
+
116
+
117
+ @pytest.mark.parametrize("task_name", ["predict", "finetune", "custom-task"])
118
+ def test_model_parameter_task_is_declared_by_hub(task_name):
119
+ model = {
120
+ "modelParamsTask": task_name,
121
+ "schemas": {
122
+ "tasks": [
123
+ {"name": "unrelated", "parameters": {"type": "object", "properties": {"wrong": {"type": "string"}}}},
124
+ {
125
+ "name": task_name,
126
+ "parameters": {
127
+ "type": "object",
128
+ "properties": {"new_parameter": {"type": "number"}},
129
+ "additionalProperties": False,
130
+ },
131
+ },
132
+ ]
133
+ },
134
+ }
135
+ schema = _foundry_model_params_schema(model)
136
+ validate({"new_parameter": 0.01}, schema)
137
+ with pytest.raises(ValidationError):
138
+ validate({"wrong": "value"}, schema)
139
+ del model["modelParamsTask"]
140
+ with pytest.raises(Exception, match="did not declare a modelParams task"):
141
+ _foundry_model_params_schema(model)
142
+
143
+
144
+ @pytest.mark.parametrize("supplied", [[], ["weights"]])
145
+ def test_required_model_fields_remain_required(supplied):
146
+ parameters = {
147
+ "type": "object",
148
+ "required": ["weights", "max_steps"],
149
+ "properties": {
150
+ "weights": {"type": "string"},
151
+ "max_steps": {"type": "integer", "exclusiveMinimum": 0},
152
+ "options": {"type": "object", "required": ["count"], "properties": {"count": {"type": "integer"}}},
153
+ },
154
+ }
155
+ schema = _foundry_model_params_schema(
156
+ {
157
+ "modelParamsTask": "finetune",
158
+ "modelParamsSuppliedFields": supplied,
159
+ "schemas": {"tasks": [{"name": "finetune", "parameters": parameters}]},
160
+ }
161
+ )
162
+ for value in ({}, {"max_steps": None}, {"max_steps": -1}, {"max_steps": 0}):
163
+ with pytest.raises(ValidationError):
164
+ validate({"weights": "base", **value}, schema)
165
+ valid = {"max_steps": 5000} if supplied else {"max_steps": 5000, "weights": "base"}
166
+ validate(valid, schema)
167
+ with pytest.raises(ValidationError, match="count"):
168
+ validate({**valid, "options": {}}, schema)
169
+ assert parameters["required"] == ["weights", "max_steps"]
@@ -14,6 +14,7 @@ from apherisfold_cli.core.errors import CLIError
14
14
  from apherisfold_cli.core.hub_requests import (
15
15
  _request_json,
16
16
  create_foundry_run,
17
+ deploy_model_weight,
17
18
  download_foundry_run_archive,
18
19
  download_foundry_run_artifact,
19
20
  get_foundry_run,
@@ -39,6 +40,46 @@ class FakeResponse:
39
40
  return self._payload
40
41
 
41
42
 
43
+ @pytest.mark.parametrize("timeout_kwargs, expected_timeout", [({}, 300), ({"timeout": 1800}, 1800)])
44
+ def test_enable_waits_for_large_checkpoint_copy_without_extending_normal_requests(
45
+ tmp_path, monkeypatch, timeout_kwargs, expected_timeout
46
+ ) -> None:
47
+ _save_refreshable_session(tmp_path, monkeypatch)
48
+ timeouts = []
49
+ body = {"runId": "run-1", "path": "output/finetune/checkpoints/epoch=227-step=456.ckpt", "name": "Ranked"}
50
+
51
+ def fake_urlopen(request, *, timeout, **_kwargs):
52
+ timeouts.append(timeout)
53
+ if request.get_method() == "POST":
54
+ assert request.full_url.endswith("/api/v1/weights/deploy")
55
+ assert json.loads(request.data) == body
56
+ if timeout < 60:
57
+ raise TimeoutError("Checkpoint copy takes longer than 30 seconds")
58
+ return FakeResponse(b'{"id":"weight-1"}')
59
+ return FakeResponse(b'{"id":"run-1"}')
60
+
61
+ monkeypatch.setattr("apherisfold_cli.core.hub_requests.urllib.request.urlopen", fake_urlopen)
62
+ assert deploy_model_weight(body, **timeout_kwargs) == {"id": "weight-1"}
63
+ assert get_foundry_run("run-1") == {"id": "run-1"}
64
+ assert timeouts == [expected_timeout, 30]
65
+
66
+
67
+ def test_enable_timeout_is_not_retried_and_preserves_uncertain_outcome(tmp_path, monkeypatch) -> None:
68
+ _save_refreshable_session(tmp_path, monkeypatch)
69
+ calls = []
70
+
71
+ def fake_urlopen(request, **_kwargs):
72
+ calls.append(request.get_method())
73
+ raise TimeoutError("Checkpoint storage did not respond")
74
+
75
+ monkeypatch.setattr("apherisfold_cli.core.hub_requests.urllib.request.urlopen", fake_urlopen)
76
+ with pytest.raises(CLIError) as failure:
77
+ deploy_model_weight({"runId": "run-1", "path": "output/last.ckpt", "name": "Last"})
78
+ assert calls == ["POST"]
79
+ assert failure.value.details["may_have_applied"] is True
80
+ assert "may still have applied" in failure.value.message
81
+
82
+
42
83
  def _save_refreshable_session(tmp_path: Path, monkeypatch) -> None:
43
84
  monkeypatch.setenv("APHERISFOLD_CONFIG_DIR", str(tmp_path))
44
85
  config = RuntimeAuthConfig(
@@ -48,7 +48,10 @@ def test_list_query_encodes_filters(monkeypatch):
48
48
  }
49
49
 
50
50
 
51
- def test_enable_uses_run_relative_bundle_and_server_identity(monkeypatch):
51
+ @pytest.mark.parametrize(
52
+ "timeout_args, expected_timeout", [([], 300), (["--timeout", "1800"], 1800), (["--timeout", "1"], 1)]
53
+ )
54
+ def test_enable_uses_run_relative_bundle_and_server_identity(monkeypatch, timeout_args, expected_timeout):
52
55
  calls = []
53
56
  response = {
54
57
  "id": "weight_test",
@@ -71,7 +74,8 @@ def test_enable_uses_run_relative_bundle_and_server_identity(monkeypatch):
71
74
  "--description",
72
75
  "Four epoch trial",
73
76
  "--json",
74
- ],
77
+ ]
78
+ + timeout_args,
75
79
  )
76
80
  assert result.exit_code == 0, result.output
77
81
  assert json.loads(result.stdout) == response
@@ -80,6 +84,7 @@ def test_enable_uses_run_relative_bundle_and_server_identity(monkeypatch):
80
84
  "path": "/api/v1/weights/deploy",
81
85
  "method": "POST",
82
86
  "task": "weights.deploy",
87
+ "timeout": expected_timeout,
83
88
  "body": {
84
89
  "name": "Affinity head trial",
85
90
  "runId": "foundry_test",
@@ -90,6 +95,28 @@ def test_enable_uses_run_relative_bundle_and_server_identity(monkeypatch):
90
95
  ]
91
96
 
92
97
 
98
+ @pytest.mark.parametrize("timeout", ["0", "-1", "1.5", "nan", "inf", "invalid"])
99
+ def test_enable_rejects_invalid_timeout_before_request(monkeypatch, timeout):
100
+ monkeypatch.setattr(hub_requests, "_request_json", lambda **_: pytest.fail("must not submit invalid timeout"))
101
+ result = runner.invoke(
102
+ app,
103
+ [
104
+ "weights",
105
+ "enable",
106
+ "--name",
107
+ "Trial",
108
+ "--run-id",
109
+ "foundry_test",
110
+ "--path",
111
+ "output/weights",
112
+ "--timeout",
113
+ timeout,
114
+ ],
115
+ )
116
+ assert result.exit_code == 2
117
+ assert "--timeout" in Text.from_ansi(result.output).plain
118
+
119
+
93
120
  @pytest.mark.parametrize(
94
121
  "path", ["/tmp/weights", "../weights", "output/../weights", "C:\\weights", "https://host/weights", " "]
95
122
  )
@@ -154,7 +181,7 @@ def test_enable_rejects_invalid_name_before_request(monkeypatch, name):
154
181
  @pytest.mark.parametrize("name", ["A", "é" * 255])
155
182
  def test_enable_accepts_name_character_boundaries(monkeypatch, name):
156
183
  calls = []
157
- monkeypatch.setattr(weights, "deploy_model_weight", lambda body: calls.append(body) or {"id": "weight_test"})
184
+ monkeypatch.setattr(weights, "deploy_model_weight", lambda body, **_: calls.append(body) or {"id": "weight_test"})
158
185
  result = runner.invoke(
159
186
  app, ["weights", "enable", "--name", name, "--run-id", "foundry_test", "--path", "output/weights", "--json"]
160
187
  )
@@ -553,7 +580,7 @@ def test_mutation_dry_runs_only_read(monkeypatch, args, expected):
553
580
 
554
581
  def test_enable_shares_and_tags_only_when_requested(monkeypatch):
555
582
  calls = []
556
- monkeypatch.setattr(weights, "deploy_model_weight", lambda body: calls.append(body) or {"id": "weight_test"})
583
+ monkeypatch.setattr(weights, "deploy_model_weight", lambda body, **_: calls.append(body) or {"id": "weight_test"})
557
584
  base = ["weights", "enable", "--name", "Trial", "--run-id", "foundry_test", "--path", "output/weights"]
558
585
  result = runner.invoke(app, [*base, "--tag", "benchmark", "--tag", "v1", "--public", "--json"])
559
586
  assert result.exit_code == 0, result.output
@@ -585,7 +612,7 @@ def test_help_documents_lifecycle():
585
612
 
586
613
 
587
614
  def test_enable_reports_success_in_ui_terms(monkeypatch):
588
- monkeypatch.setattr(weights, "deploy_model_weight", lambda body: {**WEIGHT, **body})
615
+ monkeypatch.setattr(weights, "deploy_model_weight", lambda body, **_: {**WEIGHT, **body})
589
616
  result = runner.invoke(
590
617
  app, ["weights", "enable", "--name", "Trial", "--run-id", "foundry_test", "--path", "output/weights"]
591
618
  )
@@ -1 +0,0 @@
1
- __version__ = "2.1.1"