diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0aa5267..cb16d70 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,7 @@ on: jobs: push: + if: ${{ github.server_url == 'https://github.com' }} runs-on: ubuntu-latest permissions: contents: write diff --git a/test/opencode/smoke_test.rb b/test/opencode/smoke_test.rb index b911962..7e160a6 100644 --- a/test/opencode/smoke_test.rb +++ b/test/opencode/smoke_test.rb @@ -126,6 +126,57 @@ class SmokeTest < Minitest::Test assert_equal({}, response) end + def test_send_message_async_serializes_a_structured_child_prompt + schema = { + type: "object", + properties: { + requirement_suggestions: { + type: "array", + items: { type: "string" } + } + }, + required: [ "requirement_suggestions" ], + additionalProperties: false + } + invocation_query = + "Complete the bounded structured request from the preloaded worker skill and immutable Rails context." + expected_body = { + messageID: "msg_worker_1", + parts: [ { type: "text", text: invocation_query } ], + agent: "destination-list-curator", + format: { + type: "json_schema", + schema: schema, + retryCount: 0 + }, + system: "Immutable Rails context" + } + serialized_body = nil + + prompt = stub_request(:post, "#{BASE}/session/#{SESSION_ID}/prompt_async") + .with(body: expected_body.to_json) + .to_return do |request| + serialized_body = request.body + { status: 204, body: "" } + end + + @client.send_message_async( + SESSION_ID, + invocation_query, + agent: "destination-list-curator", + system: "Immutable Rails context", + message_id: "msg_worker_1", + format: { + type: "json_schema", + schema: schema, + retryCount: 0 + } + ) + + assert_equal expected_body.to_json, serialized_body + assert_requested prompt, times: 1 + end + def test_stream_returns_typed_Reply_Result_with_full_text stub_request(:post, "#{BASE}/session/#{SESSION_ID}/prompt_async") .to_return(status: 204, body: "") diff --git a/test/release_workflow_test.rb b/test/release_workflow_test.rb new file mode 100644 index 0000000..e9afa84 --- /dev/null +++ b/test/release_workflow_test.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require "minitest/autorun" +require "yaml" + +class ReleaseWorkflowTest < Minitest::Test + ROOT = File.expand_path("..", __dir__) + WORKFLOW_PATH = File.join(ROOT, ".github", "workflows", "release.yml") + + def workflow + @workflow ||= YAML.safe_load(File.read(WORKFLOW_PATH), aliases: false) + end + + def push_job + workflow.fetch("jobs").fetch("push") + end + + def test_release_job_is_inert_on_non_github_runners + assert_equal "${{ github.server_url == 'https://github.com' }}", push_job.fetch("if") + end + + def test_release_job_keeps_the_trusted_publisher_boundary + assert_equal "release", push_job.fetch("environment") + assert_equal( + { "contents" => "write", "id-token" => "write" }, + push_job.fetch("permissions") + ) + + steps = push_job.fetch("steps") + assert_equal 1, steps.count { |step| step["uses"] == "rubygems/release-gem@v1" } + refute steps.any? { |step| step.fetch("run", "").match?(/\bgem\s+push\b/) } + end +end