Skip to content

fix(otel-collector): unblock Docker build after #730 apps/ normalization#745

Closed
G4614 wants to merge 3 commits into
mainfrom
fix/otel-collector-build
Closed

fix(otel-collector): unblock Docker build after #730 apps/ normalization#745
G4614 wants to merge 3 commits into
mainfrom
fix/otel-collector-build

Conversation

@G4614

@G4614 G4614 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Two commits restore apps/otel-collector Docker build, broken since #730 normalized the monorepo into apps/:

  1. 16873628 add python3/make/g++ to build stage — node:alpine base lacks build toolchain; cpu-features@0.0.10 (transitive yarn workspace native add-on) fails to compile during yarn install --immutable.
  2. 385c404a fix builder-config pathsapps/otel-collector/builder-config.yaml still references pre-apps/ paths:
    • path: otel-collector/exporterapps/otel-collector/exporter
    • replaces: ../../../api-client-go../../../apps/api-client-go (and same for common-go)

Without these, OpenTelemetry collector builder errors with:

Error: invalid module configuration: filepath does not exist: /boxlite/otel-collector/exporter

Background

Split out from PR #724's CI iteration. PR #724 added a generic deploy-app-services workflow exercising Proxy / OtelCollector / SshGateway builds; Proxy + SshGateway built+deployed cleanly, OtelCollector hit these two pre-existing bugs. Fix kept on a dedicated branch so #724 stays scoped to CI automation.

Test plan

  • CI builds the OtelCollector Docker image without erroring at cpu-features build
  • OpenTelemetry collector builder resolves `path:` + `replaces:` correctly

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Ensure native add-ons compile during build by installing required toolchain components and updating local build paths for collector-related builds.
  • Bug Fixes
    • API schema defaults for assigned role IDs on organization invitations and member access updates now use empty arrays instead of placeholder values.

@G4614 G4614 requested a review from a team as a code owner June 12, 2026 10:07
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds native build toolchain to the otel-collector Docker build stage, updates builder-config.yaml paths to the apps/ layout, and changes two OpenAPI schema defaults for assignedRoleIds to empty arrays.

Changes

OTel Collector Build Configuration

Layer / File(s) Summary
Docker build dependencies
apps/otel-collector/Dockerfile
Installs python3, make, and g++ in the Node build stage to support native add-on compilation during yarn install.
Go module path corrections
apps/otel-collector/builder-config.yaml
Updates exporter source path to apps/otel-collector/exporter and changes replaces mappings to ../../../apps/api-client-go and ../../../apps/common-go.

API client OpenAPI defaults

Layer / File(s) Summary
assignedRoleIds defaults
apps/api-client-go/api/openapi.yaml
Sets assignedRoleIds default to [] in UpdateOrganizationMemberAccess and CreateOrganizationInvitation schemas.

🎯 3 (Moderate) | ⏱️ ~20 minutes


🐰 The builder hops, tools in tow,

python, make, and g++ in a row,
Paths aligned to apps/ with care,
Schemas start empty — tidy and fair,
A tiny hop forward, code light as air.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: fixing the otel-collector Docker build by addressing path normalization issues from PR #730.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/otel-collector-build

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/api-client-go/api/openapi.yaml`:
- Line 9568: Constructors NewUpdateOrganizationMemberAccessWithDefaults and
NewCreateOrganizationInvitationWithDefaults leave AssignedRoleIds as nil which
causes ToMap()/MarshalJSON() to emit null instead of the OpenAPI default [];
update these constructors (and any similar factory funcs referenced around the
other occurrence) to initialize AssignedRoleIds to an empty slice (e.g.,
make([]Type, 0)) so the generated ToMap()/MarshalJSON() serializes
assignedRoleIds as [] and matches the OpenAPI default; reference
AssignedRoleIds, NewUpdateOrganizationMemberAccessWithDefaults,
NewCreateOrganizationInvitationWithDefaults, and ToMap()/MarshalJSON() when
making the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cdb481ed-7798-4402-af2c-337fba48b1cd

📥 Commits

Reviewing files that changed from the base of the PR and between 385c404 and 3b12c3a.

📒 Files selected for processing (1)
  • apps/api-client-go/api/openapi.yaml

assignedRoleIds:
default:
- 00000000-0000-0000-0000-000000000001
default: []

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether generated client defaults/serialization align with OpenAPI default: []

set -euo pipefail

echo "Checking UpdateOrganizationMemberAccess defaults + serialization"
rg -n -A12 -B3 'func NewUpdateOrganizationMemberAccessWithDefaults\(\)' apps/api-client-go/model_update_organization_member_access.go
rg -n -A12 -B3 'func \(o UpdateOrganizationMemberAccess\) ToMap\(\)' apps/api-client-go/model_update_organization_member_access.go

echo "Checking CreateOrganizationInvitation defaults + serialization"
rg -n -A12 -B3 'func NewCreateOrganizationInvitationWithDefaults\(\)' apps/api-client-go/model_create_organization_invitation.go
rg -n -A12 -B3 'func \(o CreateOrganizationInvitation\) ToMap\(\)' apps/api-client-go/model_create_organization_invitation.go

echo "Checking required-property validation on assignedRoleIds"
rg -n -A10 -B2 'requiredProperties := \[]string\{' apps/api-client-go/model_create_organization_invitation.go

Repository: boxlite-ai/boxlite

Length of output: 2912


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "OpenAPI context around 9568/9598"
sed -n '9545,9615p' apps/api-client-go/api/openapi.yaml

echo "Inspect UpdateOrganizationMemberAccess struct fields + AssignedRoleIds type"
rg -n "type UpdateOrganizationMemberAccess struct" -n apps/api-client-go/model_update_organization_member_access.go
rg -n "AssignedRoleIds" apps/api-client-go/model_update_organization_member_access.go | head -n 50
sed -n '1,140p' apps/api-client-go/model_update_organization_member_access.go

echo "Inspect CreateOrganizationInvitation struct fields + AssignedRoleIds type"
rg -n "type CreateOrganizationInvitation struct" -n apps/api-client-go/model_create_organization_invitation.go
rg -n "AssignedRoleIds" apps/api-client-go/model_create_organization_invitation.go | head -n 80
sed -n '1,230p' apps/api-client-go/model_create_organization_invitation.go

echo "Find how ToMap() output is used/JSON marshaled in request bodies"
rg -n "ToMap\(\)" apps/api-client-go | rg -n "UpdateOrganizationMemberAccess|CreateOrganizationInvitation" | head -n 80
rg -n "UpdateOrganizationMemberAccessWithDefaults|CreateOrganizationInvitationWithDefaults" apps/api-client-go | head -n 80

# Also check whether request code uses json.Marshal(ToMap) or something that could transform nil->[].
rg -n "json\.Marshal\(.*ToMap\(\)" apps/api-client-go | head -n 80
rg -n "ToMap\(\).*json" apps/api-client-go | head -n 80

Repository: boxlite-ai/boxlite

Length of output: 14920


OpenAPI default [] for assignedRoleIds isn’t applied by the Go client defaults

UpdateOrganizationMemberAccess.assignedRoleIds and CreateOrganizationInvitation.assignedRoleIds are required and set to default: [] in apps/api-client-go/api/openapi.yaml, but both NewUpdateOrganizationMemberAccessWithDefaults() and NewCreateOrganizationInvitationWithDefaults() only set Role and leave AssignedRoleIds as the Go zero value (nil slice). Since ToMap()/MarshalJSON() always serializes assignedRoleIds from AssignedRoleIds, requests built from these defaults can send assignedRoleIds: null instead of [], creating a schema/contract mismatch.

Also applies to: 9598-9598

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/api-client-go/api/openapi.yaml` at line 9568, Constructors
NewUpdateOrganizationMemberAccessWithDefaults and
NewCreateOrganizationInvitationWithDefaults leave AssignedRoleIds as nil which
causes ToMap()/MarshalJSON() to emit null instead of the OpenAPI default [];
update these constructors (and any similar factory funcs referenced around the
other occurrence) to initialize AssignedRoleIds to an empty slice (e.g.,
make([]Type, 0)) so the generated ToMap()/MarshalJSON() serializes
assignedRoleIds as [] and matches the OpenAPI default; reference
AssignedRoleIds, NewUpdateOrganizationMemberAccessWithDefaults,
NewCreateOrganizationInvitationWithDefaults, and ToMap()/MarshalJSON() when
making the change.

G4614 added a commit that referenced this pull request Jun 12, 2026
Merging the substantive bits of #745 and #746 here so PR #724's
deploy-app-services CI can actually push an otel-collector image:

* otel-collector/builder-config.yaml: fix module paths after #730
  moved everything under apps/ (was: ../../../api-client-go etc.,
  now: ../../../apps/api-client-go). The OCB build was failing with
  `filepath does not exist: /boxlite/otel-collector/exporter`. (#745)
* otel-collector/Dockerfile: apk add python3 make g++ so node-gyp
  can compile any musl-incompatible native add-on during workspace
  `yarn install`. Kept even after dropping dockerode below — small
  safety net in case future deps reintroduce a native build. (#745)
* apps/package.json: drop unused dockerode + @types/dockerode. They
  were inherited from the Daytona import in #460 but never imported
  in source. Drops the dockerode -> docker-modem -> ssh2 ->
  cpu-features chain; cpu-features was the optional native addon
  that forced the toolchain workaround in the first place. (#746)
* apps/yarn.lock: regenerated (-161 lines).
* apps/api-client-go/api/openapi.yaml: regenerate to catch up with
  main's existing `assignedRoleIds.default: []` drift so the
  api-client-drift PR check passes.
G4614 added a commit that referenced this pull request Jun 12, 2026
… gone

The previous commit kept #745's apk add as a safety net, but cpu-features
was the only musl-incompatible native dep in the workspace and it came
in only via the now-removed dockerode chain. Verified locally: yarn
install on node:22-alpine completes without any compiler toolchain.
@G4614

G4614 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Closing — see follow-up plan

@G4614 G4614 closed this Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant