BC5 readiness: Go wrapper forward-compat audit + field-level drift check
Summary
The Go SDK is unique among 37signals' SDKs in having hand-written wrapper structs in go/pkg/basecamp/ that re-shape the generated types from go/pkg/generated/. PR 1 (#293) regenerated the generated Go client with BC5 forward-compat fields, but the wrappers were not updated — so external consumers (basecamp-cli Phase 1) couldn't see the new fields. A field-level audit (filed at go/BRIEF-bc5-forward-compat-wrappers.md by basecamp-cli's dev agent) revealed the gap predates BC5: ~65 fields across 22 wrapper structs were missing.
This PR closes the gap on three scope categories and installs a field-level drift check to prevent recurrence.
Stacked on: PR #293 (bc5-readiness-spec-foundations) because the generated fields in commit 7e9c4345 are inputs the wrapper propagation depends on. Will retarget to main after #293 merges.
Downstream impact: unblocks basecamp-cli Phase 1, which is blocked on this PR.
Scope
Category A — BC5 forward-compat (9 fields, original brief scope)
Todo.Steps []CardStepTodoset.{TodosCount, CompletedLooseTodosCount, TodosURL, AppTodosURL}Person.Tagline(alongside existingBio— surfaced as a separate wrapper field per the spec note)Notification.{BubbleUpURL, BubbleUpAt}(time.Timematching the existingReadAt/UnreadAtpattern)NotificationsResult.{BubbleUps, ScheduledBubbleUps}
Category B — Cross-cutting structural (~50 fields, pre-existing gaps)
Pervasive Recording-shaped fields (BookmarkURL, BoostsCount, BoostsURL, CommentsCount, CommentsURL, SubscriptionURL, InheritsStatus, VisibleToClients, Title) added to Recording, Comment, Message, MessageBoard, Forward, ForwardReply, CampfireLine, ScheduleEntry, QuestionAnswer, Todolist, TimesheetEntry, Inbox. One-offs: Campfire.{Topic, Position, BookmarkURL, SubscriptionURL}, MessageBoard.{AppMessagesURL, Position}, Template.{URL, AppURL, Dock []DockItem} (reusing existing DockItem), Person.{CanPing, CanAccessHillCharts, CanAccessTimesheet} (CanPing field existed; propagation didn't), Notification.{Creator, Participants, PreviewableAttachments} (new PreviewableAttachment companion type), Gauge.{Creator, Bucket}, GaugeNeedle.{Creator, Bucket, Parent}, Inbox.{Position, ForwardsCount, ForwardsURL}, Forward.{RepliesCount, RepliesURL}, plus Card-table fields surfaced by the drift audit: Card.BoostsURL, CardColumn.CommentsCount, CardStep.CompletionURL, Document.BoostsURL, Event.{BoostsCount, BoostsURL}, Todo.{VisibleToClients, SubscriptionURL, BoostsURL, CommentsCount, CommentsURL, CompletionURL, CompletionSubscribers}, Upload.BoostsURL.
Category C — Structural pattern fixes
- Standardize nested Person on
personFromGenerated— every*FromGeneratedthat built a nested*Personpreviously inlined a 6-field shallow copy that silently droppedBio,Tagline,Location,Title,PersonableType,AttachableSGID,Client,Employee,TimeZone,CanPing,CanAccessHillCharts,CanAccessTimesheet,CanManageProjects,CanManagePeople,Company,CreatedAt,UpdatedAt. Replaced withpersonFromGeneratedcalls. Pure refactor; makes commit 3'sPerson.Taglineflow through every nested context for free. - Direct-decode wrappers —
Notification,NotificationsResult,MyAssignment,Gauge,GaugeNeedledecode viajson.Unmarshalon raw bytes. Added the missing fields with the appropriate JSON tags; decode pattern unchanged.
Cadence (8 commits)
Each commit individually builds and passes existing tests. Ordering chosen so the drift check (commit 5) goes green at introduction.
wrappers: standardize nested Person on personFromGeneratedwrappers: cross-cutting Recording-shaped fieldswrappers: BC5 forward-compat fieldswrappers: one-off structural fields- (audit-driven)
wrappers: close remaining structural gaps surfaced by drift audit scripts: field-level wrapper drift checkwrappers: tests for new field propagationwrappers: gofmt long-tag struct alignment
Drift check
scripts/check-wrapper-drift/ (new), wired into make go-check-wrapper-drift and make check. Discovery is signature-based on *FromGenerated declarations plus an explicit map for the 5 direct-decode wrappers. Matching is keyed on JSON tag (not Go field name), so shape-equivalent collisions (URL vs Url, both tagged "url") are handled correctly. Opt-out marker format: // intentionally-omitted: <tag> - <reason> (ASCII hyphen + reason required, validated by regex). On the fully-fixed tree:
- 51 (wrapper, generated) pairs walked
- 842 generated fields verified
- 0 drift, 0
intentionally-omittedmarkers required
Self-tests in scripts/check-wrapper-drift/main_test.go exercise the parser, marker regex, exclusion logic, and an end-to-end happy/drift case.
Verification
| Gate | Result |
|---|---|
cd go && go build ./... | clean |
cd go && go test ./pkg/basecamp/... | all pass (21 new propagation tests) |
make go-check-drift (operation-level) | 196 / 203 operations (96%), no drift |
make go-check-wrapper-drift (NEW field-level) | 51 pairs, 842 fields, no drift |
make conformance-go | 68 / 0 / 0 (unchanged from baseline) |
make check | all checks passed |
make conformance-go-replay is not applicable on this branch (the replay target is part of PR 3, on a separate branch).
Risks + open questions
- Untyped JSON marshalling assertions in downstream consumers. Nested
Personvalues gain ~17 fields. Any user assertingJSONEqagainst the previously-truncated wrapper output sees additions. Mitigation: this is forward-compat additive (no removals or renames); basecamp-cli's bump-PR is well-understood. Person.{CreatedAt, UpdatedAt}in nested contexts.personFromGeneratedformats these as RFC3339 strings; nested contexts now also populate them when present (previously dropped). Forward-compat additive.- Shape-equivalent tag collisions. The drift check matches by JSON tag, not Go field name. Documented in
scripts/check-wrapper-drift/main.goheader. - Untouched
MyAssignmentDate semantics.StartsOn/DueOnalready usedstring(matchingTodo.DueOn); no change needed.
Coordination
basecamp-cli Phase 1 is blocked on this PR. Please notify the basecamp-cli five branch on merge so they can make bump-sdk and resume.
Summary by cubic
Propagates BC5 fields through the Go wrappers and upgrades the wrapper-drift check to flag both tag gaps and unassigned fields, including inline-converted and direct-decode wrappers. Also standardizes nested Person mapping, normalizes flexible embedded-person IDs, and fixes required-bool and timestamp serialization.
-
New Features
- Surface BC5 fields across wrappers:
Todo.Steps,Todoset.{TodosCount, CompletedLooseTodosCount, TodosURL, AppTodosURL},Person.Tagline,Notification.{BubbleUpURL, BubbleUpAt},NotificationsResult.{BubbleUps, ScheduledBubbleUps}. - Cross-cutting structural fields added where missing:
BookmarkURL,Boosts{Count,URL},Comments{Count,URL},SubscriptionURL,InheritsStatus,VisibleToClients,Title, plus card/vault/event/todo completions and URLs (e.g.,Card.BoostsURL,CardStep.CompletionURL,Event.{BoostsCount,BoostsURL},Document/Upload.BoostsURL,Todo.{VisibleToClients,SubscriptionURL,BoostsURL,Comments{Count,URL},CompletionURL,CompletionSubscribers}). - One-offs:
Notification.{Creator, Participants, PreviewableAttachments},Gauge.{Creator,Bucket},GaugeNeedle.{Creator,Bucket,Parent},Inbox.{Position, ForwardsCount, ForwardsURL},Forward.{RepliesCount, RepliesURL},Campfire.{Topic, Position, BookmarkURL, SubscriptionURL},MessageBoard.{AppMessagesURL, Position},Template.{URL, AppURL, Dock},Person.{CanAccessHillCharts, CanAccessTimesheet}.
- Surface BC5 fields across wrappers:
-
Refactors
- Standardize all nested
Personconversions onpersonFromGenerated; routeSubscription.Subscribersthrough it. Add embedded-person ID normalization soCreator/Participantsdecode in notifications and gauges even when IDs are strings or sentinels. - Wrapper-drift checker now verifies both tag presence and field population, including inline-converted wrappers via composite-literal/selector analysis; direct-decode wrappers are tag-checked. Coverage: 76 pairs, no drift.
make go-check-wrapper-driftruns checker tests before the drift pass. - Serialization/decode fixes: drop
omitemptyfrom requiredvisible_to_clients/inherits_statusbools onTodo,Comment,Message,MessageBoard,Inbox,Forward,ForwardReply,TimesheetEntry; changeNotification.BubbleUpAtto*time.Time. Tests pin required-bool serialization and field propagation. - Delegate
ProjectConstruction.ProjecttoprojectFromGenerated; sharedockItemFromGeneratedforProject/Template.
- Standardize all nested