Repository navigation
Validate Component build steps, build tools and artifact includes - #130
Conversation
Adds spec.buildTools, spec.build and spec.artifact to the Component schema and SDK model (S-002), and makes config validate refuse a step whose command[0] is not a declared build tool, absolute or climbing paths, and buildTools or artifact without build. Running the steps is issue 115. Fixes #113 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The schema accepted a tab in workingDirectory or include, and a trailing newline in any build path, tool name or version (JSON Schema $ matches before a final newline), while the SDK value objects refuse them. config validate passed and inventory loading then raised ValueError. A controlCharacterFree def now makes the schema refuse the same inputs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8a24d23 to
79db436
Compare
|
@romamo Decided without waiting: the Component build-step validation adds the error code Why: S-002-11 asks for the refusals but names no codes; a dedicated code only where the schema can't express the rule (a step's tool missing from Reply with a comment starting with |
Summary
Adds the S-002 build contract to the Component schema and the SDK model, and makes
cloudfall config validateenforce it. Running the steps inartifact buildis #115 and out of scope here.config/schemas/v1/component.schema.json: optionalspec.buildTools(bare tool name to a dotted numeric minimum version),spec.build(ordered steps:workingDirectorywith the same relative, no-..rule asrepository.subdirectory;commandas an argv list of non-empty strings, never a shell string; optionaltimeoutSeconds1..3600, default 900) andspec.artifact.include(unique relative paths, same rule).dependentRequiredmakesbuildToolsandartifactrequirebuildsdk/src/cloudfall/domain.py: value objectsRelativeRepositoryPath,BuildToolName,BuildToolVersion,BuildCommand,BuildTimeoutSecondsthat enforce the same rules as the schemasdk/src/cloudfall/inventory.py:ComponentBuild,ComponentBuildStep,ComponentBuildTool, andComponentInventory.build(None withoutbuild).as_dict()addsbuildTools,buildandartifactonly whenbuildis declared, so inventory output for existing Components is unchangedsdk/src/cloudfall/validation.py: a step whosecommand[0]is not a key ofbuildToolsfails withcomponent_build_tool_undeclaredand the fieldspec.build.<i>.command.0. Absolute or..paths andbuildTools/artifactwithoutbuildfail in the schema asschema_validation_failedExample configs and existing Components are untouched;
config validate --project config/examplesstill passes with the same counts.Test plan
uv run pytest sdk/tests/test_component_build_validation.py sdk/tests/test_validation.py sdk/tests/test_inventory.py engine/tests/test_artifact_builder.py engine/tests/test_ansible_inventory.py: 50 passeduv run ruff check .,uv run mypy,uv run cloudfall config validate --project config/examples: cleanFixes #113
Plan
command[0]check in validationtest_s002_1_*), S-002-11 (test_s002_11_*) in sdk/tests/test_component_build_validation.py🤖 Generated with Claude Code