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
28 changes: 20 additions & 8 deletions .github/workflows/seal-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ name: Seal custom code (dispatch)
# When genuine out-of-band custom code is merged to this SDK repo's `main`
# (a direct staging commit, or a contribution pulled back from production),
# notify the config repo to reseal so the custom-code tracking JSON absorbs it
# promptly instead of waiting for the config repo's poll. stlc-authored commits
# promptly instead of waiting for the config repo's poll. generator-authored commits
# are skipped by the loop guards below, so the bot's own pushes (the "Build SDK"
# squash commit and any regen commit) cannot trigger a reseal loop.
#
# This workflow is itself custom code on the SDK repo: seal it once with
# `stlc build --commit` to bootstrap, after which scaffold preservation keeps it
# the generator's commit step to bootstrap, after which scaffold preservation keeps it
# across regenerations. If you would rather keep things simple, drop this file
# and rely on the config repo's scheduled `stlc-sync-tracking.yml` poll alone.
# and rely on the config repo's scheduled tracking-sync poll alone.
#
# Lives in the STAGING repo. Requires CONFIG_DISPATCH_TOKEN — a token that can
# Requires the GitHub App secrets (SDK_APP_ID, SDK_APP_PRIVATE_KEY) or, as a
# fallback, CONFIG_DISPATCH_TOKEN — a token that can
# send a repository_dispatch to the config repo.
on:
push:
# main only. stlc preview/integrated/codegen branches never push to main.
# main only. the generator's preview, integrated and codegen branches never push to main.
branches: [main]

concurrency:
Expand All @@ -31,21 +32,32 @@ permissions:
jobs:
dispatch:
runs-on: ubuntu-latest
if: github.repository == 'sentdm/sent-dm-python-staging'
if: github.repository == 'sentdm/sent-dm-python'
env:
CONFIG_REPO: sentdm/sent-dm-sdk-pipeline
HAS_APP: ${{ secrets.SDK_APP_ID != '' && secrets.SDK_APP_PRIVATE_KEY != '' }}
steps:
- name: Mint a pipeline token from the GitHub App
id: app
if: env.HAS_APP == 'true'
uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v3.3.0
with:
app-id: ${{ secrets.SDK_APP_ID }}
private-key: ${{ secrets.SDK_APP_PRIVATE_KEY }}
owner: sentdm
repositories: sent-dm-sdk-pipeline
Comment on lines 37 to +48

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 This public repository now names Sent's SDK pipeline repo in two places, and the PR adds the second one. CLAUDE.md forbids naming private repositories. The new repositories: sent-dm-sdk-pipeline at :48 sits alongside CONFIG_REPO: sentdm/sent-dm-sdk-pipeline at :37. The PR text also calls it the SDK pipeline. Fix: read the target from a repository variable or secret (for example vars.CONFIG_REPO) and use it for both the env and the token's repositories input, so no private repo name stays in the file.

Why this was flagged

CLAUDE.md says: "This repository is public. Nothing in it ... links to or names Sent's private repositories, internal systems or providers." REVIEW.md lists "A link to, or the name of, a private Sent repository ... anywhere in the diff" as Important. The added line 48 (repositories: sent-dm-sdk-pipeline) and the context line 37 (CONFIG_REPO: sentdm/sent-dm-sdk-pipeline) both name the config/pipeline repo, which the PR description describes as Sent's internal SDK pipeline. The header comments also still mention staging and production repos (line 6). Before this PR the job only ran on the staging repo. Now the file is active in the public repo, and the PR adds another mention of the name.

Verification: The PR adds repositories: sent-dm-sdk-pipeline at .github/workflows/seal-dispatch.yml:48 as a + line of the diff. CLAUDE.md says: "This repository is public. Nothing in it ... links to or names Sent's private repositories, internal systems or providers." The same name already appears in the base at line 37 (CONFIG_REPO: sentdm/sent-dm-sdk-pipeline), so the leak itself predates this PR.


- name: Loop-guard and send reseal dispatch
env:
DISPATCH_TOKEN: ${{ secrets.CONFIG_DISPATCH_TOKEN }}
DISPATCH_TOKEN: ${{ steps.app.outputs.token || secrets.CONFIG_DISPATCH_TOKEN }}
Comment on lines +40 to +52

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 (optional) If minting the App token fails, the reseal dispatch is never sent, even when CONFIG_DISPATCH_TOKEN is set as the documented fallback. The mint step at :40-48 runs whenever both App secrets are non-empty. When it errors (App not installed on the target repo, bad key), the job stops before the fallback at :52 is tried. Fix: add continue-on-error: true to the mint step so steps.app.outputs.token is empty and the || at :52 uses CONFIG_DISPATCH_TOKEN. Also update the "CONFIG_DISPATCH_TOKEN not set" message at :73 to name both credentials.

Why this was flagged

Trigger: SDK_APP_ID and SDK_APP_PRIVATE_KEY are set, so HAS_APP at :38 is 'true', but actions/create-github-app-token fails. For example, the App is not installed on the target repository or lacks access. The step at .github/workflows/seal-dispatch.yml:40 has no continue-on-error, so the job fails there. The dispatch step with DISPATCH_TOKEN: ${{ steps.app.outputs.token || secrets.CONFIG_DISPATCH_TOKEN }} at :52 never runs. The header comment at :17-19 promises CONFIG_DISPATCH_TOKEN as a fallback, and the PR description says the token is minted from the App "falling back to the old dispatch token". The fallback only covers missing secrets, not a failed mint. On the base, the job used CONFIG_DISPATCH_TOKEN directly and had no step that could fail this way.

Verification: SDK_APP_ID and SDK_APP_PRIVATE_KEY are both set and CONFIG_DISPATCH_TOKEN is also set, but the App token mint fails. In .github/workflows/seal-dispatch.yml:40-48 the mint step has no continue-on-error, so the job stops and the || fallback at :52 never gets used. No seal-custom-code dispatch reaches the config repo.

HEAD_MSG: ${{ github.event.head_commit.message }}
HEAD_AUTHOR_NAME: ${{ github.event.head_commit.author.name }}
SHA: ${{ github.sha }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail

# Loop guard 1: skip the stlc "Build SDK" squash commit (it carries
# Loop guard 1: skip the generator's "Build SDK" squash commit (it carries
# the Stainless-Generated-From trailer in its message).
if printf '%s' "$HEAD_MSG" | grep -q 'Stainless-Generated-From'; then
echo "Head commit is an stlc build — skipping reseal dispatch."
Comment on lines 32 to 63

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 (optional) Comments edited in this PR still name the generator, which breaks the CLAUDE.md rule "No provenance comments". That rule says to remove such comments from a block you are already editing. The rewording swapped "stlc" for "the generator" but did not drop the references. Fix: remove every comment and message in this file that names the generator or its tooling, which covers the 6 sites listed. Same pattern at 6 sites (seal-dispatch.yml:8, seal-dispatch.yml:13, seal-dispatch.yml:22, seal-dispatch.yml:60, seal-dispatch.yml:63, seal-dispatch.yml:67).

Why this was flagged

CLAUDE.md says: "Don't add a comment that marks code as hand-written or names the generator, and remove one from a block you are already editing." REVIEW.md reports "A comment that ... names the generator" as Important. The diff rewrites lines 8, 13, 22 and 60 to "generator-authored commits", "the generator's commit step", "the generator's preview, integrated and codegen branches" and "the generator's "Build SDK" squash commit". All of them still name the generator. Line 63 still echoes "Head commit is an stlc build", and lines 67-69 still mention stlc-bot. These sit in hunks the PR edits, so the rule's remove-while-editing clause applies, and this public repo keeps carrying the provenance text.

Verification: The diff rewrites comments at .github/workflows/seal-dispatch.yml lines 8, 13, 22 and 60, and each one still refers to the generator. The PR edits the run: block at line 60, but that same block keeps references to the generator's own tooling name. So the rule to remove such comments from a block you are already editing was not followed. Nothing breaks at runtime.

Expand Down
70 changes: 0 additions & 70 deletions .github/workflows/stlc-promote.yml

This file was deleted.

74 changes: 0 additions & 74 deletions .github/workflows/stlc-sync-from-production.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/trigger-back-sync-on-release.yml

This file was deleted.

69 changes: 0 additions & 69 deletions .github/workflows/trunk-sync-lock.yml

This file was deleted.

Loading