Skip to content

chore: remove dagger#4173

Open
tothandras wants to merge 3 commits intomainfrom
chore/remove-dagger
Open

chore: remove dagger#4173
tothandras wants to merge 3 commits intomainfrom
chore/remove-dagger

Conversation

@tothandras
Copy link
Copy Markdown
Contributor

@tothandras tothandras commented Apr 19, 2026

Summary by CodeRabbit

  • Chores
    • Removed Dagger-based build/config and migrated build/release flows to Nix and Makefile-driven tooling.
  • Chores / Packaging
    • Added cross-build, archive, and Helm chart packaging targets for releases.
  • Workflows / CI
    • Reworked GitHub Actions to use Nix, adjusted release triggers, concurrency, and tag-only guards.
  • Tools
    • Added a script to generate SQLC testdata from migrations.
  • Docs
    • Updated contributor guidance to remove Dagger-specific instructions.
  • Dev environment
    • Updated workspace and flake settings; added sentinel version variable for a collector binary.

@tothandras tothandras added the release-note/misc Miscellaneous changes label Apr 19, 2026
@tothandras tothandras requested a review from a team as a code owner April 19, 2026 18:24
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1d2c6fe5-8209-4572-9af2-b1c170a5a171

📥 Commits

Reviewing files that changed from the base of the PR and between 05fba54 and 4dc27ca.

📒 Files selected for processing (1)
  • cmd/benthos-collector/version.go

📝 Walkthrough

Walkthrough

This PR removes Dagger-based build/migration/release tooling and its config, replaces CI/release flows with Nix/Makefile/GitHub Actions, adds local migration testdata script and benthos-collector version ldflag support, and updates related lint/IDE/config exclusions and docs.

Changes

Cohort / File(s) Summary
Dagger project removed
.dagger/..., dagger.json, .dagger/.gitignore, .dagger/.gitattributes
Deleted entire .dagger source and config files; removed Dagger project metadata and ignore/linguist rules.
Dagger build/generate/migrate/release code deleted
.dagger/build.go, .dagger/generate.go, .dagger/migrate.go, .dagger/release.go, .dagger/utils.go, .dagger/versions.go, .dagger/versions_pinned.go
Removed build, generate, migration, release orchestration, utility helpers, and pinned-version constants previously implemented with Dagger.
CI/workflows revamped
.github/workflows/ci.yaml, .github/workflows/release.yaml, .github/workflows/npm-release.yaml, .github/workflows/sdk-javascript-dev-release.yaml
Replaced Dagger-based CI/release steps with Nix-driven workflows; added reusable NPM release workflow; removed old JS beta workflow; release broken into helm/binary/github-release jobs and tag gating.
Makefile / justfile / flake changes
Makefile, justfile, flake.nix
Expanded migrate-check into subchecks, added benthos-collector build/archive and Helm packaging targets; removed dagger calls and Dagger inputs from justfile and flake.
Local migration tooling added
tools/migrate/generate-sqlc-testdata.sh
Added script to generate SQLC testdata using docker-compose, migrate, pg_dump and sqlc; replaces prior Dagger-based generation flow.
CLI binary versioning added
cmd/benthos-collector/version.go
Added package-level version variable with runtime default "unknown" for ldflags-provided version.
CI/lint/config exclusions updated
.golangci.yaml, .golangci-fast.yaml, .fossa.yaml, .vscode/default.code-workspace
Removed .dagger paths from linter and FOSSA exclusions; removed .dagger from VS Code workspace folders.
Docs/test guidance
AGENTS.md, openmeter/testutils/pg_driver.go
Removed Dagger-specific contributor guidance; updated POSTGRES_HOST documentation in test utilities.

Sequence Diagram(s)

sequenceDiagram
    participant GH as GitHub Actions
    participant Nix as Nix dev shell
    participant Builder as Build steps (make/helm/go)
    participant Artifacts as GitHub Artifacts / OCI registry
    participant Release as GitHub Release / npm registry

    GH->>Nix: run nix develop / set up environment
    Nix->>Builder: execute build/package (helm, cross-build, archive)
    Builder->>Artifacts: upload artifacts (tgz, tar.gz)
    GH->>Artifacts: download artifacts (release job)
    GH->>Release: create release, attach assets, publish npm (via reusable workflow)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: remove dagger' is concise and directly summarizes the primary change: deleting all Dagger-based build, migration, release, and generation tooling from the repository.

✏️ 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 chore/remove-dagger

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (5)
AGENTS.md (1)

7-14: Tiny duplication heads-up 🙃

Lines 7 and 14 both now say essentially the same thing about Makefile being primary and justfile being seldom used. Not a blocker at all, but if you feel like tidying, you could drop one mention and leave the other as the canonical note.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` around lines 7 - 14, Duplicate note about using the Makefile
appears in AGENTS.md; remove one of the repeated sentences so the guidance is
only stated once. Edit the AGENTS.md content block that mentions "Development
commands are run via `Makefile`..." or the earlier line "Use the `Makefile` for
all common tasks..." (whichever you prefer to keep) and delete the other
redundant sentence, keeping a single canonical mention of `Makefile` and the
optional note about `justfile`; ensure the remaining paragraph reads smoothly
and no other contextual info is lost.
.github/workflows/release.yaml (2)

179-188: Consider marking pre-release tags as GitHub pre-releases.

gh release create defaults to a non-prerelease entry, so a v1.2.3-beta.1 tag will show up as a regular release on the Releases page and in "latest release" API responses. A tiny conditional keeps the Releases UI honest:

🏷️ Suggested tweak
         run: |
+          prerelease_flag=""
+          case "${GITHUB_REF_NAME}" in
+            *-beta.*|*-dev.*) prerelease_flag="--prerelease" ;;
+          esac
           gh release create "${GITHUB_REF_NAME}" \
             --title "${GITHUB_REF_NAME}" \
             --generate-notes \
-            --verify-tag \
+            --verify-tag \
+            $prerelease_flag \
             dist/benthos-collector_*.tar.gz \
             dist/checksums.txt
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release.yaml around lines 179 - 188, The GitHub release
step uses gh release create (invoked as gh release create "${GITHUB_REF_NAME}"
...) which always makes a full release; detect prerelease tags (e.g.
GITHUB_REF_NAME containing a hyphen like v1.2.3-beta.1) and pass the
--prerelease flag when true. Update the workflow to compute a boolean/variable
(e.g. PRERELEASE) from GITHUB_REF_NAME and conditionally include --prerelease in
the gh release create invocation so prerelease tags are marked correctly in
Releases.

67-71: Minor: prefer ${{ secrets.GITHUB_TOKEN }} over ${{ github.token }} for consistency, and consider using the helm OCI --registry-config flow.

Totally cosmetic — both github.token and secrets.GITHUB_TOKEN resolve to the same value, but the rest of the file uses secrets.GITHUB_TOKEN (e.g. the Nix setup steps), so using one style everywhere makes it easier to grep for auth flows. Also, piping the token through echo into helm registry login works fine; if you ever wanted to avoid token material on a pipeline, helm registry login --password-stdin from an env var (printenv GH_TOKEN | ...) is a common alternative. Not a blocker.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release.yaml around lines 67 - 71, Replace the use of `${{
github.token }}` with `${{ secrets.GITHUB_TOKEN }}` in the "Login to GitHub
Container Registry" step and switch the login to use an env-var + stdin or the
helm OCI `--registry-config` flow; specifically, update the `helm registry login
ghcr.io --username "${{ github.actor }}" --password-stdin` invocation in that
step to consume `GITHUB_TOKEN` from the environment (e.g., `echo "${{
secrets.GITHUB_TOKEN }}" | nix develop ... -c ... --password-stdin`) or refactor
to use `helm registry login --registry-config <path>` per your OCI config
convention so the token usage matches the rest of the workflow.
Makefile (1)

55-64: Nice guard, but consider resetting the tree if the check fails.

migrate-check-schema runs go generate -x ./openmeter/ent/... which can mutate the tree. On CI that's fine — the job fails and the runner is tossed. Locally though, a dev running make migrate-check will get a dirty worktree even when they intended only to validate. Totally optional, but a hint in the failure message telling them to git checkout -- openmeter/ent (or the schema-not-in-sync message already suggests regen + commit, which also works) keeps things friendly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Makefile` around lines 55 - 64, The failure of the migrate-check-schema
target leaves generated changes in the working tree; update the
migrate-check-schema Makefile recipe (the target named migrate-check-schema that
runs go generate -x ./openmeter/ent/...) so that when the check detects
differences it also resets the mutated files before exiting (e.g., run a git
checkout -- openmeter/ent or git restore --staged/--worktree for openmeter/ent)
and update the final echo to advise the user to either regenerate & commit or
run the provided reset command to revert local changes.
tools/migrate/generate-sqlc-testdata.sh (1)

17-56: Small robustness suggestion: validate VERSION and clean up on failure.

Two nits that'll make this script friendlier for folks hacking on it locally:

  1. Scratch DB leaks on failure. set -euo pipefail means any failure between creating and dropping the scratch DB (e.g., a broken migration) will leave sqlc_gen_<VERSION> behind, and a re-run will then DROP DATABASE IF EXISTS before recreating — which is mostly fine, but a trap cleanup is nicer and also covers interrupts.
  2. VERSION goes straight into SQL and a migrate CLI arg. It's expected to be a timestamp, but an early regex check would fail fast with a clear message instead of producing weird SQL errors.
🛡️ Suggested tweak
 if [[ -z "${VERSION:-}" ]]; then
 	echo "ERROR: VERSION is required (e.g. VERSION=20240826120919)" >&2
 	exit 1
 fi
+
+if [[ ! "${VERSION}" =~ ^[0-9]+$ ]]; then
+	echo "ERROR: VERSION must be a numeric migration timestamp (got: ${VERSION})" >&2
+	exit 1
+fi
@@
 SCRATCH_DB="sqlc_gen_${VERSION}"
+
+cleanup() {
+	psql -h "${PG_HOST}" -p "${PG_PORT}" -U "${PG_USER}" -d postgres \
+		-c "DROP DATABASE IF EXISTS ${SCRATCH_DB};" >/dev/null 2>&1 || true
+}
+trap cleanup EXIT

And then the explicit drop at the end can go away since the trap handles it.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tools/migrate/generate-sqlc-testdata.sh` around lines 17 - 56, The script can
leave the scratch DB (SCRATCH_DB) behind on failures and accepts any VERSION
string; add a sanity check and a cleanup trap: validate VERSION with a strict
regex (e.g., only digits of expected length) before using it, and register a
trap that drops SCRATCH_DB (using the same psql DROP DATABASE IF EXISTS
"${SCRATCH_DB}" command) on EXIT/INT/TERM so the DB is removed if migrate or
other steps fail; update places that reference VERSION, SCRATCH_DB, psql and
migrate to rely on the validated VERSION and remove the final explicit DROP if
the trap covers cleanup.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/release.yaml:
- Around line 220-227: The JS_SDK_RELEASE_TAG is hard-coded to "latest" which
will publish prereleases under the latest dist-tag; change the Publish NPM
package step to derive JS_SDK_RELEASE_TAG from github.ref_name instead of
hard-coding it (use a conditional expression or a small shell step) so that if
github.ref_name contains "beta" it becomes "beta", if it contains "dev" or
similar it becomes "dev"/"next", otherwise it remains "latest"; update the
environment variable JS_SDK_RELEASE_TAG used by the publish-javascript-sdk
target accordingly.

In `@Makefile`:
- Around line 110-124: Add a new file cmd/benthos-collector/version.go that
declares the package main, a package-level variable var version string, and an
init() that sets version = "unknown" when empty so the Makefile's -X
main.version linker flag can inject the build version; follow the same pattern
used by cmd/server/version.go (declare var version string and initialize to
"unknown" in init()).

---

Nitpick comments:
In @.github/workflows/release.yaml:
- Around line 179-188: The GitHub release step uses gh release create (invoked
as gh release create "${GITHUB_REF_NAME}" ...) which always makes a full
release; detect prerelease tags (e.g. GITHUB_REF_NAME containing a hyphen like
v1.2.3-beta.1) and pass the --prerelease flag when true. Update the workflow to
compute a boolean/variable (e.g. PRERELEASE) from GITHUB_REF_NAME and
conditionally include --prerelease in the gh release create invocation so
prerelease tags are marked correctly in Releases.
- Around line 67-71: Replace the use of `${{ github.token }}` with `${{
secrets.GITHUB_TOKEN }}` in the "Login to GitHub Container Registry" step and
switch the login to use an env-var + stdin or the helm OCI `--registry-config`
flow; specifically, update the `helm registry login ghcr.io --username "${{
github.actor }}" --password-stdin` invocation in that step to consume
`GITHUB_TOKEN` from the environment (e.g., `echo "${{ secrets.GITHUB_TOKEN }}" |
nix develop ... -c ... --password-stdin`) or refactor to use `helm registry
login --registry-config <path>` per your OCI config convention so the token
usage matches the rest of the workflow.

In `@AGENTS.md`:
- Around line 7-14: Duplicate note about using the Makefile appears in
AGENTS.md; remove one of the repeated sentences so the guidance is only stated
once. Edit the AGENTS.md content block that mentions "Development commands are
run via `Makefile`..." or the earlier line "Use the `Makefile` for all common
tasks..." (whichever you prefer to keep) and delete the other redundant
sentence, keeping a single canonical mention of `Makefile` and the optional note
about `justfile`; ensure the remaining paragraph reads smoothly and no other
contextual info is lost.

In `@Makefile`:
- Around line 55-64: The failure of the migrate-check-schema target leaves
generated changes in the working tree; update the migrate-check-schema Makefile
recipe (the target named migrate-check-schema that runs go generate -x
./openmeter/ent/...) so that when the check detects differences it also resets
the mutated files before exiting (e.g., run a git checkout -- openmeter/ent or
git restore --staged/--worktree for openmeter/ent) and update the final echo to
advise the user to either regenerate & commit or run the provided reset command
to revert local changes.

In `@tools/migrate/generate-sqlc-testdata.sh`:
- Around line 17-56: The script can leave the scratch DB (SCRATCH_DB) behind on
failures and accepts any VERSION string; add a sanity check and a cleanup trap:
validate VERSION with a strict regex (e.g., only digits of expected length)
before using it, and register a trap that drops SCRATCH_DB (using the same psql
DROP DATABASE IF EXISTS "${SCRATCH_DB}" command) on EXIT/INT/TERM so the DB is
removed if migrate or other steps fail; update places that reference VERSION,
SCRATCH_DB, psql and migrate to rely on the validated VERSION and remove the
final explicit DROP if the trap covers cleanup.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a2c92f65-d3de-4fad-81cb-2314e9a82ee7

📥 Commits

Reviewing files that changed from the base of the PR and between 13d183b and 5b0b075.

⛔ Files ignored due to path filters (4)
  • .dagger/go.mod is excluded by !**/*.mod
  • .dagger/go.sum is excluded by !**/*.sum, !**/*.sum
  • api/client/javascript/Makefile is excluded by !api/client/**
  • flake.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (23)
  • .dagger/.gitattributes
  • .dagger/.gitignore
  • .dagger/build.go
  • .dagger/generate.go
  • .dagger/main.go
  • .dagger/migrate.go
  • .dagger/release.go
  • .dagger/utils.go
  • .dagger/versions.go
  • .dagger/versions_pinned.go
  • .fossa.yaml
  • .github/workflows/ci.yaml
  • .github/workflows/release.yaml
  • .golangci-fast.yaml
  • .golangci.yaml
  • .vscode/default.code-workspace
  • AGENTS.md
  • Makefile
  • dagger.json
  • flake.nix
  • justfile
  • openmeter/testutils/pg_driver.go
  • tools/migrate/generate-sqlc-testdata.sh
💤 Files with no reviewable changes (16)
  • .golangci.yaml
  • .golangci-fast.yaml
  • .dagger/.gitignore
  • .vscode/default.code-workspace
  • .dagger/.gitattributes
  • .dagger/versions_pinned.go
  • .dagger/main.go
  • .dagger/versions.go
  • .dagger/generate.go
  • .dagger/utils.go
  • dagger.json
  • .fossa.yaml
  • flake.nix
  • .dagger/release.go
  • .dagger/migrate.go
  • .dagger/build.go

Comment thread .github/workflows/release.yaml Outdated
Comment thread Makefile
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
.github/workflows/release.yaml (1)

236-248: ⚠️ Potential issue | 🟠 Major

Keep prerelease tags off npm latest, and make beta versions rerunnable.

Because lines 5-8 include -dev/-beta tags, the tag branch here still sends prereleases to latest. Also, non-tag publishes use only the short SHA, so a manual rerun for the same commit tries to republish the same immutable npm version.

Suggested metadata tweak
       - name: Determine version and npm dist-tag
         id: meta
         env:
           REF_TYPE: ${{ github.ref_type }}
+          RUN_NUMBER: ${{ github.run_number }}
         run: |
           if [[ "$REF_TYPE" == "tag" ]]; then
-            echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
-            echo "dist-tag=latest" >> "$GITHUB_OUTPUT"
+            echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
+            case "$GITHUB_REF_NAME" in
+              *-beta.*) echo "dist-tag=beta" >> "$GITHUB_OUTPUT" ;;
+              *-dev.*) echo "dist-tag=dev" >> "$GITHUB_OUTPUT" ;;
+              *) echo "dist-tag=latest" >> "$GITHUB_OUTPUT" ;;
+            esac
           else
             short_sha="${GITHUB_SHA:0:12}"
-            echo "version=1.0.0-beta-${short_sha}" >> "$GITHUB_OUTPUT"
+            echo "version=1.0.0-beta-${short_sha}.${RUN_NUMBER}" >> "$GITHUB_OUTPUT"
             echo "dist-tag=beta" >> "$GITHUB_OUTPUT"
           fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release.yaml around lines 236 - 248, Update the "Determine
version and npm dist-tag" step (id: meta) so prerelease tags don't get
dist-tag=latest and non-tag beta versions are unique per workflow run: when
REF_TYPE=="tag" check GITHUB_REF_NAME for a prerelease marker (e.g., contains
'-') and only set dist-tag=latest for normal semver tags, otherwise set
dist-tag=beta; when not a tag, append a run-unique value (use GITHUB_RUN_ID or
GITHUB_RUN_NUMBER) to the generated beta version (instead of only the short SHA)
so reruns produce a new npm version; keep references to GITHUB_REF_NAME and
GITHUB_SHA usage in the same step.
🧹 Nitpick comments (2)
tools/migrate/generate-sqlc-testdata.sh (1)

48-93: Consider a cleanup trap so scratch DBs don't linger on failure.

If migrate goto, pg_dump, or sqlc generate fail, the script exits via set -e and leaves sqlc_gen_<VERSION> behind. It's self-healing (next run drops-if-exists), but an EXIT trap keeps things tidy and also protects against Ctrl-C mid-run.

♻️ Suggested tweak
 echo ">>> Creating scratch database ${SCRATCH_DB}"
 psql -h "${PG_HOST}" -p "${PG_PORT}" -U "${PG_USER}" -d postgres \
 	-c "DROP DATABASE IF EXISTS ${SCRATCH_DB};" \
 	-c "CREATE DATABASE ${SCRATCH_DB};"
+
+cleanup() {
+	psql -h "${PG_HOST}" -p "${PG_PORT}" -U "${PG_USER}" -d postgres \
+		-c "DROP DATABASE IF EXISTS ${SCRATCH_DB};" >/dev/null 2>&1 || true
+}
+trap cleanup EXIT

…and then you can drop the explicit drop block at lines 91–93.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tools/migrate/generate-sqlc-testdata.sh` around lines 48 - 93, Add a shell
EXIT trap to always drop the scratch DB (using SCRATCH_DB with psql) so failures
or Ctrl-C won't leave sqlc_gen_<VERSION> behind; implement the trap near the top
of the script (after SCRATCH_DB is set) and call psql -c "DROP DATABASE IF
EXISTS ${SCRATCH_DB};" in the trap, then remove the explicit final DROP block
after sqlc generate; ensure the trap runs regardless of where migrate, pg_dump,
or sqlc generate fail and that any necessary environment variables (PG_HOST,
PG_PORT, PG_USER) are available to the trap.
AGENTS.md (1)

7-14: Trim the duplicate Makefile/justfile note.

Lines 7 and 14 now say the same thing. I’d keep the short Quick Reference entry and remove or shorten the second mention so this guidance doesn’t drift later.

Based on learnings, AGENTS.md should fold guidance into the most relevant section and remove stale or duplicate notes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` around lines 7 - 14, The AGENTS.md contains duplicated notes about
using the Makefile and justfile (the same guidance appears in the Quick
Reference and again later); edit AGENTS.md to keep the short Quick Reference
entry that states "Use the `Makefile` for all common tasks. A `justfile` also
exists but is seldom used." and remove or condense the later paragraph that
repeats this guidance so only one clear reference to `Makefile`/`justfile`
remains; ensure the remaining text is folded into the most relevant section and
eliminate the second mention to prevent drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/release.yaml:
- Around line 250-263: The sdk-javascript-release job can be manually triggered
from any branch; add a guard so that when the event is workflow_dispatch it only
runs for main branch or tag refs. Update the sdk-javascript-release job (the
block with name "JavaScript SDK Release" and uses:
./.github/workflows/npm-release.yaml) to include an if condition that permits
execution when github.event_name != 'workflow_dispatch' OR (github.ref ==
'refs/heads/main' OR startsWith(github.ref, 'refs/tags/')), thereby preventing
beta releases from arbitrary branches.

In `@tools/migrate/generate-sqlc-testdata.sh`:
- Around line 53-56: The DB_URL construction embeds PG_PASSWORD into the command
line used by migrate, exposing secrets; update the script to avoid including
PG_PASSWORD in DB_URL and rely on the already-exported PGPASSWORD environment
variable (or build a URL without the password) before calling migrate -database
"${DB_URL}" so the password is not visible in process args; adjust references to
DB_URL and the migrate invocation (the lines that set DB_URL and call migrate
-path "${MIGRATIONS_DIR}" -database "${DB_URL}" goto "${VERSION}") accordingly
and ensure any downstream consumers still receive a valid connection string
without the embedded password.

---

Duplicate comments:
In @.github/workflows/release.yaml:
- Around line 236-248: Update the "Determine version and npm dist-tag" step (id:
meta) so prerelease tags don't get dist-tag=latest and non-tag beta versions are
unique per workflow run: when REF_TYPE=="tag" check GITHUB_REF_NAME for a
prerelease marker (e.g., contains '-') and only set dist-tag=latest for normal
semver tags, otherwise set dist-tag=beta; when not a tag, append a run-unique
value (use GITHUB_RUN_ID or GITHUB_RUN_NUMBER) to the generated beta version
(instead of only the short SHA) so reruns produce a new npm version; keep
references to GITHUB_REF_NAME and GITHUB_SHA usage in the same step.

---

Nitpick comments:
In `@AGENTS.md`:
- Around line 7-14: The AGENTS.md contains duplicated notes about using the
Makefile and justfile (the same guidance appears in the Quick Reference and
again later); edit AGENTS.md to keep the short Quick Reference entry that states
"Use the `Makefile` for all common tasks. A `justfile` also exists but is seldom
used." and remove or condense the later paragraph that repeats this guidance so
only one clear reference to `Makefile`/`justfile` remains; ensure the remaining
text is folded into the most relevant section and eliminate the second mention
to prevent drift.

In `@tools/migrate/generate-sqlc-testdata.sh`:
- Around line 48-93: Add a shell EXIT trap to always drop the scratch DB (using
SCRATCH_DB with psql) so failures or Ctrl-C won't leave sqlc_gen_<VERSION>
behind; implement the trap near the top of the script (after SCRATCH_DB is set)
and call psql -c "DROP DATABASE IF EXISTS ${SCRATCH_DB};" in the trap, then
remove the explicit final DROP block after sqlc generate; ensure the trap runs
regardless of where migrate, pg_dump, or sqlc generate fail and that any
necessary environment variables (PG_HOST, PG_PORT, PG_USER) are available to the
trap.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7ec5df1c-a3d5-436d-9474-e7743b7531e8

📥 Commits

Reviewing files that changed from the base of the PR and between 5b0b075 and 05fba54.

⛔ Files ignored due to path filters (4)
  • .dagger/go.mod is excluded by !**/*.mod
  • .dagger/go.sum is excluded by !**/*.sum, !**/*.sum
  • api/client/javascript/Makefile is excluded by !api/client/**
  • flake.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (25)
  • .dagger/.gitattributes
  • .dagger/.gitignore
  • .dagger/build.go
  • .dagger/generate.go
  • .dagger/main.go
  • .dagger/migrate.go
  • .dagger/release.go
  • .dagger/utils.go
  • .dagger/versions.go
  • .dagger/versions_pinned.go
  • .fossa.yaml
  • .github/workflows/ci.yaml
  • .github/workflows/npm-release.yaml
  • .github/workflows/release.yaml
  • .github/workflows/sdk-javascript-dev-release.yaml
  • .golangci-fast.yaml
  • .golangci.yaml
  • .vscode/default.code-workspace
  • AGENTS.md
  • Makefile
  • dagger.json
  • flake.nix
  • justfile
  • openmeter/testutils/pg_driver.go
  • tools/migrate/generate-sqlc-testdata.sh
💤 Files with no reviewable changes (17)
  • .fossa.yaml
  • .golangci-fast.yaml
  • .vscode/default.code-workspace
  • .dagger/.gitignore
  • .golangci.yaml
  • dagger.json
  • .dagger/main.go
  • .dagger/versions.go
  • .dagger/generate.go
  • .github/workflows/sdk-javascript-dev-release.yaml
  • .dagger/versions_pinned.go
  • .dagger/.gitattributes
  • flake.nix
  • .dagger/utils.go
  • .dagger/migrate.go
  • .dagger/build.go
  • .dagger/release.go
✅ Files skipped from review due to trivial changes (2)
  • openmeter/testutils/pg_driver.go
  • .github/workflows/ci.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • justfile
  • Makefile

Comment on lines +250 to +263
sdk-javascript-release:
name: JavaScript SDK Release
# Runs on both tag pushes (stable/pre-release) and main pushes (per-commit beta).
# npm's trusted publisher entry is keyed on caller workflow file + environment,
# so this single caller must serve both channels.
needs: [sdk-javascript-meta]
uses: ./.github/workflows/npm-release.yaml
with:
version: ${{ needs.sdk-javascript-meta.outputs.version }}
dist-tag: ${{ needs.sdk-javascript-meta.outputs.dist-tag }}
permissions:
contents: read
id-token: write
secrets: inherit
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.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find .github/workflows -name "release.yaml" -o -name "release.yml"

Repository: openmeterio/openmeter

Length of output: 95


🏁 Script executed:

cat -n .github/workflows/release.yaml

Repository: openmeterio/openmeter

Length of output: 13443


Add a guard to prevent beta JS SDK releases from arbitrary branches.

The workflow_dispatch trigger lets anyone manually kick off this workflow from any branch, which would publish a beta release to npm for that branch. Since beta packages should only come from main or release tags, add the guard to keep things tidy.

Suggested fix
   sdk-javascript-release:
     name: JavaScript SDK Release
     # Runs on both tag pushes (stable/pre-release) and main pushes (per-commit beta).
     # npm's trusted publisher entry is keyed on caller workflow file + environment,
     # so this single caller must serve both channels.
+    if: github.ref_type == 'tag' || github.ref_name == 'main'
     needs: [sdk-javascript-meta]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release.yaml around lines 250 - 263, The
sdk-javascript-release job can be manually triggered from any branch; add a
guard so that when the event is workflow_dispatch it only runs for main branch
or tag refs. Update the sdk-javascript-release job (the block with name
"JavaScript SDK Release" and uses: ./.github/workflows/npm-release.yaml) to
include an if condition that permits execution when github.event_name !=
'workflow_dispatch' OR (github.ref == 'refs/heads/main' OR
startsWith(github.ref, 'refs/tags/')), thereby preventing beta releases from
arbitrary branches.

Comment on lines +53 to +56
DB_URL="postgres://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:${PG_PORT}/${SCRATCH_DB}?sslmode=disable&x-migrations-table=schema_om"

echo ">>> Migrating ${SCRATCH_DB} to version ${VERSION}"
migrate -path "${MIGRATIONS_DIR}" -database "${DB_URL}" goto "${VERSION}"
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.

⚠️ Potential issue | 🟡 Minor

Heads-up: password leaks into process args via DB_URL.

migrate -database "${DB_URL}" puts PG_PASSWORD on the command line, where it's visible to anyone running ps on the host (and may land in shell/CI logs if migrate echoes its args on error). For a local dev script against a throwaway scratch DB this is pretty low-risk, but since PGPASSWORD is already exported you could also just rely on that and omit the password from the URL — or at least be aware before anyone reuses this pattern in CI against a non-default credential.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tools/migrate/generate-sqlc-testdata.sh` around lines 53 - 56, The DB_URL
construction embeds PG_PASSWORD into the command line used by migrate, exposing
secrets; update the script to avoid including PG_PASSWORD in DB_URL and rely on
the already-exported PGPASSWORD environment variable (or build a URL without the
password) before calling migrate -database "${DB_URL}" so the password is not
visible in process args; adjust references to DB_URL and the migrate invocation
(the lines that set DB_URL and call migrate -path "${MIGRATIONS_DIR}" -database
"${DB_URL}" goto "${VERSION}") accordingly and ensure any downstream consumers
still receive a valid connection string without the embedded password.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/misc Miscellaneous changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant