feat(templates): model start_date on project construction

Merged
JE
3mo ago
+438-6

What

POST /templates/:id/project_constructions.json has accepted project[start_date] since 2022 (bc3 project_operations.rb#project_from_template_params), but ProjectConstructionAttributes modeled only name and description, so no SDK could anchor a constructed project's template dates to a chosen week. Surfaced by basecamp-cli#659; tracked on this card. The bc3 doc side is basecamp/bc3#13259.

  • spec/basecamp.smithy: ProjectConstructionAttributes.start_date: ISO8601Date, optional, with the anchoring rule in its doc comment — template dates are relative to the template's first week, weeks start on Sunday, so the project's dates land on the Sunday on or before start_date; omitted, they anchor to the week the construction is processed (Template::RelativeDates#rebase, Template::ProjectBuilder#new_project_start_date).
  • All six SDKs regenerated (make generate). Five of them take the request body as a generated struct or plain map, so they pick the field up with no hand-written change. The Go wrapper's CreateProject(ctx, templateID, name, description) is positional, so it gains a variadic ...*CreateProjectOptions{StartDate} in the CreateLine/CreateLineOptions idiom; the existing call shape compiles unchanged, and an empty StartDate is omitted from the wire rather than sent blank.
  • Not a repin: the field predates the current provenance pin, so spec/api-provenance.json is untouched.

Tests

  • conformance/tests/project_constructions.json (2 cases), dispatched in all six runners — CreateProjectFromTemplate had no dispatch arm anywhere until now. Case 1 pins the literal wire body {"project":{"name","description","start_date":"2026-09-01"}} via nested requestBody assertions plus requestBodyAbsent on the top-level keys; case 2 pins that an unset start_date is absent, not null/"". SPEC §19 Test Categories and Appendix D carry the new fixture's rows.
  • Per-SDK unit tests from each SDK's own request capture: Go (TestTemplatesService_CreateProjectStartDate, both the carried and the omitted shape), TypeScript, Ruby, Python, Kotlin, Swift.

Gate

make check-targets -k locally on macOS: every target green including all six conformance runners (228 cases, my two executed in each) and check-fixture-execution, except lint-actions, which reports the 7 pre-existing zizmor self-repository lows that are unrelated to this change. doc-constants-check re-run after the SPEC rows.

breaking label

CI's apidiff reports one incompatible change: (*TemplatesService).CreateProject changed from func(context.Context, int64, string, string) to func(context.Context, int64, string, string, ...*CreateProjectOptions). Every existing call compiles unchanged; only a func value or an interface naming the old signature has to add the parameter. The label acknowledges the verdict, and MIGRATING.md carries the note under Unreleased. The other five SDKs take the attributes as a struct or map and are additive (ProjectConstructionAttributes.StartDate and CreateProjectOptions are apidiff's two compatible additions).

I'm babysitting the review loop on this PR through to convergence.

Release note: Features (enhancement).


Summary by cubic

Adds optional start_date to project construction so SDKs can anchor a template-built project's dates to a chosen week. The endpoint has accepted project[start_date] since 2022, but ProjectConstructionAttributes only modeled name and description.

  • Regenerates all six SDKs; the Go wrapper takes the field via a new variadic CreateProjectOptions (more than one options argument is rejected), so existing CreateProject calls compile unchanged.
  • Adds two conformance cases pinning the wire body: start_date under the project envelope when given, omitted when not.
  • Template dates anchor to the Sunday on or before start_date; omitted, they anchor to the week the construction is processed.
  • MIGRATING.md documents the Go signature change; code holding CreateProject as a func value or in an interface must add the variadic parameter.