Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

- Prefer direct method calls over Ruby reflection (`send`, `__send__`, or `public_send`) for internal SDK plumbing. When an internal method must be callable across components without becoming supported public API, keep the method public for direct dispatch and mark it `@api private`. Keep its RBI and RBS declarations at the same visibility.

## Release maintenance

When regenerating `gemfiles/bedrock.gemfile.lock`, preserve the
`x-release-please` markers around the local `openai` version. Release Please
uses them to update this lockfile; Bundler can remove them when rewriting it.

## Security requirements

- Never commit real API keys, access tokens, signing keys, credentials, or
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ $ BUNDLE_GEMFILE=gemfiles/bedrock.gemfile bundle install
$ BUNDLE_GEMFILE=gemfiles/bedrock.gemfile bundle exec rake test:bedrock
```

When regenerating `gemfiles/bedrock.gemfile.lock`, preserve the
`x-release-please` markers around the local `openai` version. Release Please
uses them to update this lockfile; Bundler can remove them when rewriting it.
Comment thread
apcha-oai marked this conversation as resolved.

### Running examples end-to-end

The live example suite executes every example marked as `covered` in
Expand Down
2 changes: 2 additions & 0 deletions gemfiles/bedrock.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ GIT
PATH
remote: ..
specs:
# x-release-please-start-version
openai (0.80.0)
# x-release-please-end
connection_pool (>= 2.2.3)
logger

Expand Down
3 changes: 2 additions & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"release-type": "ruby",
"version-file": "lib/openai/version.rb",
"extra-files": [
"README.md"
"README.md",
"gemfiles/bedrock.gemfile.lock"
]
}
39 changes: 39 additions & 0 deletions test/scripts/release_workflow_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# frozen_string_literal: true

require "minitest/autorun"
require "json"

require_relative "../../lib/openai/version"

class ReleaseWorkflowTest < Minitest::Test
ROOT = File.expand_path("../..", __dir__)
BEDROCK_LOCKFILE = "gemfiles/bedrock.gemfile.lock"

def test_release_please_updates_bedrock_lockfile
config = JSON.parse(File.read(File.join(ROOT, "release-please-config.json")))
package = config.merge(config.fetch("packages").fetch("."))

assert_includes(package.fetch("extra-files"), BEDROCK_LOCKFILE)
end

def test_bedrock_release_markers_update_only_the_sdk_version
lockfile = File.read(File.join(ROOT, BEDROCK_LOCKFILE))
markers = %w[x-release-please-start-version x-release-please-end]
sdk_entry = " openai (#{OpenAI::VERSION})"

assert_equal(markers, lockfile.scan(/x-release-please-[\w-]+/))
assert_includes(
lockfile,
" # #{markers.first}\n#{sdk_entry}\n # #{markers.last}\n",
"Restore the release-please markers around only the openai version after regenerating the lockfile"
)

# Simulate the generic updater's stable-version replacement inside marked blocks.
next_version = "#{OpenAI::VERSION.split(".").first.to_i + 1}.0.0"
updated = lockfile.gsub(/x-release-please-start-version\n.*?x-release-please-end/m) do |block|
block.gsub(/\d+\.\d+\.\d+/, next_version)
end

assert_equal(lockfile.sub(sdk_entry, " openai (#{next_version})"), updated)
end
end