Projects have their own name, description and goal; the template is shown only as origin
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 52s
Work Records / validate (push) Successful in 12s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: sonnet
Assistant-Process: 295952@bnt-lap001
Assistant-Session: e93f64ad-516c-46eb-9666-aad8d300c477
This commit is contained in:
tegwick 2026-09-29 14:12:21 +02:00
parent 334e0d3eb6
commit f8ce4717a8
8 changed files with 125 additions and 24 deletions

View file

@ -197,10 +197,13 @@ def test_runs_of_other_projects_do_not_count(repo):
def test_instantiate_template_records_origin_merges_values_and_lists_needs(repo):
reg = Registry([repo])
out = J.instantiate(reg, "lighthouse-watch", "harbour-north", "rehearsal", {"keeper": "Ada", "logdir": "/tmp/rtut-harbour"})
out = J.instantiate(reg, "lighthouse-watch", "harbour-north", "rehearsal", {"keeper": "Ada", "logdir": "/tmp/rtut-harbour"},
title="North harbour watch", description="Our own harbour", goal="Both lights keep watch")
made = yaml.safe_load(out.read_text())
assert made["spec"] == "project/v0.1" and made["template"] == "lighthouse-watch" and made["environment"] == "rehearsal"
assert made["attributes"]["keeper"] == "Ada" and made["goal"].startswith("The night watch")
assert made["attributes"]["keeper"] == "Ada"
assert made["title"] == "North harbour watch" and made["description"] == "Our own harbour" and made["goal"] == "Both lights keep watch"
assert "The night watch is played through" not in out.read_text() and "A watch at a lighthouse" not in out.read_text() # nothing of the template's text is copied
assert set(made["targets"]) == {"north-light", "south-light"}
reg = Registry([repo])
assert reg.projects["harbour-north"].ok and J.validate(reg, reg.projects["harbour-north"]) == []
@ -235,3 +238,14 @@ def test_set_attributes_validates_against_the_consuming_runbooks(repo):
def test_attribute_notes_survive_resolution(repo):
reg = Registry([repo])
assert "Who keeps this light" in fold(set_layers(reg, "harbour-defaults"))["keeper"]["note"]
def test_project_without_a_given_name_uses_its_id_never_the_templates_title(repo):
reg = Registry([repo])
out = J.instantiate(reg, "lighthouse-watch", "plain-one", "staging")
made = yaml.safe_load(out.read_text())
assert made["title"] == "plain-one" and "goal" not in made and "description" not in made
with pytest.raises(ValueError, match="3 characters"):
J.instantiate(reg, "lighthouse-watch", "ab", "staging")
with pytest.raises(ValueError, match="secret"):
J.instantiate(reg, "lighthouse-watch", "leaky-one", "staging", description="token hvs.ABCDEFGHIJKLMN")