Skip to content

fixes go worspace setup for cost-accuracy and load-test - #4585

Merged
akshaydeo merged 1 commit into
devfrom
06-21-fixes_go_worspace_setup_for_cost-accuracy_and_load-test
Jun 21, 2026
Merged

fixes go worspace setup for cost-accuracy and load-test#4585
akshaydeo merged 1 commit into
devfrom
06-21-fixes_go_worspace_setup_for_cost-accuracy_and_load-test

Conversation

@akshaydeo

@akshaydeo akshaydeo commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

The go.work file is gitignored and must be regenerated in CI environments. Without it, builds in cost-accuracy-test.sh and load-test.sh resolve core, framework, and plugins from the published versions pinned in transports/go.mod rather than the local workspace copies. This PR ensures the Go workspace is initialized before any build steps run in those scripts.

Changes

  • Added a call to setup-go-workspace.sh at the start of both cost-accuracy-test.sh and load-test.sh, executed from the repo root so that the relative go work use ./core paths resolve correctly and the resulting go.work file is auto-discovered by subsequent go build invocations.

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

Trigger the cost-accuracy and load-test CI workflows and confirm that the builds resolve local module versions rather than the published ones pinned in transports/go.mod.

# Manually verify workspace setup
cd <repo-root>
source .github/workflows/scripts/setup-go-workspace.sh
go build ./transports/...

Breaking changes

  • Yes
  • No

Related issues

Security considerations

None.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e39ef04f-b204-45c8-b598-e500b6224b39

📥 Commits

Reviewing files that changed from the base of the PR and between f325e92 and b59d97f.

📒 Files selected for processing (2)
  • .github/workflows/scripts/cost-accuracy-test.sh
  • .github/workflows/scripts/load-test.sh

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Improved build system configuration in CI/CD workflows to ensure correct local dependency resolution during testing and cost accuracy checks.

Walkthrough

Two CI test scripts (cost-accuracy-test.sh and load-test.sh) are updated to source setup-go-workspace.sh from the repository root at startup. This regenerates the gitignored go.work file so that subsequent go build calls resolve local core/framework/plugins modules rather than the versions pinned in transports/go.mod.

Changes

Go Workspace Initialization in CI Scripts

Layer / File(s) Summary
Source go-workspace setup in both CI test scripts
.github/workflows/scripts/cost-accuracy-test.sh, .github/workflows/scripts/load-test.sh
Both scripts gain an early block that changes into the repo root and sources setup-go-workspace.sh, regenerating go.work (gitignored) before any go build step so local module replacements are used instead of pinned transports/go.mod versions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • maximhq/bifrost#4561: Introduces the same CI harness scripts (cost-accuracy-test.sh, load-test.sh) in the release pipeline that this PR modifies to source setup-go-workspace.sh.

Suggested reviewers

  • danpiths

Poem

🐇 Hop, hop into the workspace root I go,
Sourcing scripts so local modules flow,
No more pinned deps from transports afar,
go.work regenerates like a bright star,
Build steps now resolve what's truly near —
This bunny keeps the module graph clear! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The linked issue #123 concerns Files API Support for providers like OpenAI/Anthropic, which is completely unrelated to the Go workspace setup fixes for cost-accuracy and load-test scripts in this PR. Review and update the linked issues. The current linked issue #123 appears to be incorrectly associated with this PR. Either unlink issue #123 or link issues actually related to Go workspace setup.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is partially related to the changeset. It mentions fixing Go workspace setup but contains a typo ('worspace' instead of 'workspace'), which is a minor issue. The title accurately reflects the main changes to cost-accuracy and load-test scripts.
Description check ✅ Passed The PR description is well-structured and follows the template. It provides a clear summary, specific changes made, correct type selection (Chore/CI), and testing instructions. While some optional sections lack detail, all critical information is present.
Out of Scope Changes check ✅ Passed The changes are narrowly scoped and focused on fixing Go workspace setup in two CI scripts by adding workspace regeneration calls, which aligns with the PR's stated objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 06-21-fixes_go_worspace_setup_for_cost-accuracy_and_load-test

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

akshaydeo commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@akshaydeo
akshaydeo marked this pull request as ready for review June 21, 2026 12:30
@akshaydeo
akshaydeo requested a review from a team as a code owner June 21, 2026 12:30
@coderabbitai
coderabbitai Bot requested a review from danpiths June 21, 2026 12:31
@greptile-apps

greptile-apps Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

Safe to merge; the core workspace setup correctly writes go.work to the repo root so subsequent go build calls auto-discover it.

Both scripts correctly initialize the Go workspace before building binaries, which is the key fix. The only gap is that GOTOOLCHAIN=auto, exported inside the subshell, does not reach the parent shell where go build actually runs — a minor robustness concern that would only surface if the CI-installed Go version diverges from the workspace's go directive.

No files require special attention; both changed scripts are straightforward CI helpers.

Important Files Changed

Filename Overview
.github/workflows/scripts/cost-accuracy-test.sh Adds Go workspace bootstrap via subshell-sourced setup-go-workspace.sh before building binaries; the go.work file is correctly created at ROOT_DIR so go build auto-discovers it, but GOTOOLCHAIN=auto exported inside the subshell is not inherited by the parent shell's subsequent go build calls.
.github/workflows/scripts/load-test.sh Same Go workspace bootstrap added; uses SCRIPT_DIR (which resolves to the same directory as setup-go-workspace.sh) and REPO_ROOT as the working directory, so module paths are correct. GOTOOLCHAIN=auto has the same scoping concern as in cost-accuracy-test.sh.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Script starts] --> B[Resolve ROOT_DIR / REPO_ROOT]
    B --> C["Subshell: cd REPO_ROOT &&\nsource setup-go-workspace.sh"]
    C --> D{go.work\nalready exists?}
    D -- Yes --> E[Skip init, return]
    D -- No --> F["go work init\ngo work use ./core ./framework\n./plugins/* ./transports ./cli"]
    F --> G[go.work written to REPO_ROOT]
    E --> H[Subshell exits]
    G --> H
    H --> I[Parent shell continues\nwithout GOTOOLCHAIN=auto]
    I --> J["go build -o bifrost-http\n(auto-discovers go.work)"]
    J --> K[Binary uses local module sources]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[Script starts] --> B[Resolve ROOT_DIR / REPO_ROOT]
    B --> C["Subshell: cd REPO_ROOT &&\nsource setup-go-workspace.sh"]
    C --> D{go.work\nalready exists?}
    D -- Yes --> E[Skip init, return]
    D -- No --> F["go work init\ngo work use ./core ./framework\n./plugins/* ./transports ./cli"]
    F --> G[go.work written to REPO_ROOT]
    E --> H[Subshell exits]
    G --> H
    H --> I[Parent shell continues\nwithout GOTOOLCHAIN=auto]
    I --> J["go build -o bifrost-http\n(auto-discovers go.work)"]
    J --> K[Binary uses local module sources]
Loading

Reviews (1): Last reviewed commit: "fixes go worspace setup for cost-accurac..." | Re-trigger Greptile

# versions pinned in transports/go.mod. Run with repo root as CWD because
# setup-go-workspace.sh's `go work use ./core` paths are repo-root-relative; the
# go.work file it writes at ${ROOT_DIR} is then auto-discovered by `go build`.
( cd "${ROOT_DIR}" && source "${ROOT_DIR}/.github/workflows/scripts/setup-go-workspace.sh" )

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 GOTOOLCHAIN=auto is exported inside the subshell but does not propagate to the parent shell where the go build calls in build_binaries run. If the installed Go version in CI differs from the go directive in the generated go.work file, the builds can fail with a toolchain-version mismatch. Exporting GOTOOLCHAIN=auto in the parent shell before the subshell is the minimal fix.

Suggested change
( cd "${ROOT_DIR}" && source "${ROOT_DIR}/.github/workflows/scripts/setup-go-workspace.sh" )
export GOTOOLCHAIN=auto
( cd "${ROOT_DIR}" && source "${ROOT_DIR}/.github/workflows/scripts/setup-go-workspace.sh" )

# versions pinned in transports/go.mod. Run with repo root as CWD because
# setup-go-workspace.sh's `go work use ./core` paths are repo-root-relative; the
# go.work file it writes at ${REPO_ROOT} is then auto-discovered by `go build`.
( cd "${REPO_ROOT}" && source "${SCRIPT_DIR}/setup-go-workspace.sh" )

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Same GOTOOLCHAIN=auto scoping issue as in cost-accuracy-test.sh — the export is confined to the subshell and is not visible to the go build call in build_bifrost_http. Exporting it in the parent shell guards against toolchain-version errors.

Suggested change
( cd "${REPO_ROOT}" && source "${SCRIPT_DIR}/setup-go-workspace.sh" )
export GOTOOLCHAIN=auto
( cd "${REPO_ROOT}" && source "${SCRIPT_DIR}/setup-go-workspace.sh" )

akshaydeo commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Jun 21, 12:51 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 21, 12:52 PM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo
akshaydeo merged commit 0442005 into dev Jun 21, 2026
15 of 16 checks passed
@akshaydeo
akshaydeo deleted the 06-21-fixes_go_worspace_setup_for_cost-accuracy_and_load-test branch June 21, 2026 12:52
akshaydeo added a commit that referenced this pull request Jun 21, 2026
* build fix

* fixes go worspace setup for cost-accuracy and load-test (#4585)

## Summary

The `go.work` file is gitignored and must be regenerated in CI environments. Without it, builds in `cost-accuracy-test.sh` and `load-test.sh` resolve `core`, `framework`, and `plugins` from the published versions pinned in `transports/go.mod` rather than the local workspace copies. This PR ensures the Go workspace is initialized before any build steps run in those scripts.

## Changes

- Added a call to `setup-go-workspace.sh` at the start of both `cost-accuracy-test.sh` and `load-test.sh`, executed from the repo root so that the relative `go work use ./core` paths resolve correctly and the resulting `go.work` file is auto-discovered by subsequent `go build` invocations.

## Type of change

- [ ] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Documentation
- [x] Chore/CI

## Affected areas

- [ ] Core (Go)
- [ ] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [ ] Docs

## How to test

Trigger the cost-accuracy and load-test CI workflows and confirm that the builds resolve local module versions rather than the published ones pinned in `transports/go.mod`.

```sh
# Manually verify workspace setup
cd <repo-root>
source .github/workflows/scripts/setup-go-workspace.sh
go build ./transports/...
```

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

## Security considerations

None.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable

* enterprise changelog (#4586)

## Summary

Adds the changelog for Bifrost Enterprise v1.4.13 (2026-06-21) and registers it in the docs navigation.

## Changes

- Added `docs/changelogs/ent-v1.4.13.mdx` documenting all features, bug fixes, and plugin dependency versions for the v1.4.13 release, built on `transports/v1.5.16`.
- Registered the new changelog page in `docs/docs.json` so it appears at the top of the Enterprise changelogs section.

Key highlights documented in the release:
- Business-unit and user attribution fields (`business_unit_id`, `business_unit_name`, `user_id`, `user_name`) added to BigQuery and Datadog plugins for cost/usage attribution.
- Durable, resumable background job runner for SCIM provisioning across all supported IdPs, with a `GET /api/scim/provision/jobs/{operation_id}` status endpoint.
- Datadog session-grouped traces via `group_traces_by_session`, pinning requests sharing an `x-bf-session-id` to a single APM trace.
- Cluster node `region` exposed via the cluster API and rendered in the UI.
- New `(Logs, Update)` RBAC permission with an accompanying migration for existing installs.
- Inline `409 Conflict` name-collision errors across access profiles, API keys, MCP tool groups, prompt deployments, roles, business units, and teams.
- Auto-assignment of access profiles to existing role members during config-file reconciliation.
- Group search input and selection indicators in the provisioning sync sheet.
- Fixed ghost-node double-counting on access-profile reloads.
- Fixed `409` vs `500` on duplicate-name violations across multiple resource endpoints.
- Fixed Okta provisioning deduplication, `Retry-After` handling, and multi-header `Link` parsing.
- Fixed `ListModels` spuriously enforcing provider/model allowlists when no virtual key is present.

## Type of change

- [ ] Bug fix
- [ ] Feature
- [ ] Refactor
- [x] Documentation
- [ ] Chore/CI

## Affected areas

- [ ] Core (Go)
- [ ] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [x] Docs

## How to test

Navigate to the Enterprise changelogs section of the docs site and confirm the v1.4.13 entry appears at the top of the list and renders correctly, including the warning callout, feature/fix sections, and dependency block.

## Screenshots/Recordings

N/A — documentation-only change.

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

N/A

## Security considerations

None. This is a documentation-only change.

## Checklist

- [x] I read `docs/contributing/README.md` and followed the guidelines
- [x] I added/updated tests where appropriate
- [x] I updated documentation where needed
- [x] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
abdenasseraroukhsiss added a commit to abdenasseraroukhsiss/bifrost that referenced this pull request Jun 22, 2026
* origin/dev: (76 commits)
  fix: deterministic MCP tool ordering for prompt cache stability (maximhq#4588)
  enterprise changelog (maximhq#4586)
  Adds changelog for v1.5.16 --skip-ci
  transports: update dependencies --skip-ci
  fixes go worspace setup for cost-accuracy and load-test (maximhq#4585)
  plugins/telemetry: bump core to v1.5.22 and framework to v1.3.22 --skip-ci
  plugins/semanticcache: bump core to v1.5.22 and framework to v1.3.22 --skip-ci
  plugins/prompts: bump core to v1.5.22 and framework to v1.3.22 --skip-ci
  plugins/otel: bump core to v1.5.22 and framework to v1.3.22 --skip-ci
  plugins/modelcatalogresolver: bump core to v1.5.22 and framework to v1.3.22 --skip-ci
  plugins/mocker: bump core to v1.5.22 and framework to v1.3.22 --skip-ci
  plugins/maxim: bump core to v1.5.22 and framework to v1.3.22 --skip-ci
  plugins/logging: bump core to v1.5.22 and framework to v1.3.22 --skip-ci
  plugins/jsonparser: bump core to v1.5.22 and framework to v1.3.22 --skip-ci
  plugins/governance: bump core to v1.5.22 and framework to v1.3.22 --skip-ci
  plugins/compat: bump core to v1.5.22 and framework to v1.3.22 --skip-ci
  framework: bump core to v1.5.22 --skip-ci
  build fix (maximhq#4584)
  build fix
  chore: regenerate openapi.json --skip-ci
  ...

# Conflicts:
#	.github/workflows/scripts/cost-accuracy-test.sh
#	core/changelog.md
#	tests/config.json
#	tests/integrations/python/config.json
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.

2 participants