Skip to content

refactor: rename eventstore-macros to kurrentdb-macros#228

Merged
w1am merged 3 commits into
masterfrom
w1am/dev-1680-replace-eventstore-macros-with-internal-kurrentdb-macros
May 5, 2026
Merged

refactor: rename eventstore-macros to kurrentdb-macros#228
w1am merged 3 commits into
masterfrom
w1am/dev-1680-replace-eventstore-macros-with-internal-kurrentdb-macros

Conversation

@w1am
Copy link
Copy Markdown

@w1am w1am commented May 4, 2026

Summary

  • Rename the internal proc-macro crate eventstore-macroskurrentdb-macros so we can publish it under a name we control on crates.io
  • Update the workspace member, kurrentdb's dependency line, all use eventstore_macros::... imports across 11 call-site files, and the publish workflow
  • Reset version to 0.0.1 since this is effectively a new crate on crates.io

Why

The eventstore-macros name on crates.io is no longer under our control, which blocks us from publishing new versions of the macro alongside kurrentdb releases. Rust requires proc-macros to live in a separate crate, so the simplest fix is renaming and keeping it as an internal workspace member.

Considered (and rejected) rewriting options! as a macro_rules! to fold it back into kurrentdb. That would eliminate the second published crate, but at the cost of API churn for ~25 call sites — not worth it just to avoid one extra cargo publish.

Closes DEV-1680

Test plan

  • cargo check --workspace passes locally
  • CI green
  • Reserve kurrentdb-macros on crates.io and run the manual publish workflow before the next kurrentdb release

The eventstore-macros crate name on crates.io is no longer under our
control. Rename the internal proc-macro crate to kurrentdb-macros so we
can publish it under a name we own.

Reset the version to 0.0.1 since this is effectively a new crate on
crates.io and update the publish workflow accordingly.

Closes DEV-1680
@linear
Copy link
Copy Markdown

linear Bot commented May 4, 2026

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Rename eventstore-macros to kurrentdb-macros for controlled crate publication

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Rename internal proc-macro crate from eventstore-macros to kurrentdb-macros
• Update all import statements across 11 call-site files in kurrentdb
• Reset version to 0.0.1 for new crate publication on crates.io
• Update workspace configuration and CI publish workflow accordingly
Diagram
flowchart LR
  A["eventstore-macros crate"] -->|rename| B["kurrentdb-macros crate"]
  B -->|version reset| C["0.0.1"]
  D["11 import statements"] -->|update| E["kurrentdb_macros imports"]
  F["Cargo.toml configs"] -->|update| G["workspace & dependencies"]
  H["publish-macros.yml"] -->|update| I["CI workflow"]
Loading

Grey Divider

File Changes

1. kurrentdb/src/operations/mod.rs Refactoring +1/-1

Update macro import to kurrentdb_macros

kurrentdb/src/operations/mod.rs


2. kurrentdb/src/options/append_to_stream.rs Refactoring +1/-1

Update macro import to kurrentdb_macros

kurrentdb/src/options/append_to_stream.rs


3. kurrentdb/src/options/batch_append.rs Refactoring +1/-1

Update macro import to kurrentdb_macros

kurrentdb/src/options/batch_append.rs


View more (13)
4. kurrentdb/src/options/delete_stream.rs Refactoring +1/-1

Update macro import to kurrentdb_macros

kurrentdb/src/options/delete_stream.rs


5. kurrentdb/src/options/persistent_subscription.rs Refactoring +1/-1

Update macro import to kurrentdb_macros

kurrentdb/src/options/persistent_subscription.rs


6. kurrentdb/src/options/projections.rs Refactoring +1/-1

Update macro import to kurrentdb_macros

kurrentdb/src/options/projections.rs


7. kurrentdb/src/options/read_all.rs Refactoring +1/-1

Update macro import to kurrentdb_macros

kurrentdb/src/options/read_all.rs


8. kurrentdb/src/options/read_stream.rs Refactoring +1/-1

Update macro import to kurrentdb_macros

kurrentdb/src/options/read_stream.rs


9. kurrentdb/src/options/subscribe_to_all.rs Refactoring +1/-1

Update macro import to kurrentdb_macros

kurrentdb/src/options/subscribe_to_all.rs


10. kurrentdb/src/options/subscribe_to_stream.rs Refactoring +1/-1

Update macro import to kurrentdb_macros

kurrentdb/src/options/subscribe_to_stream.rs


11. kurrentdb/src/options/tombstone_stream.rs Refactoring +1/-1

Update macro import to kurrentdb_macros

kurrentdb/src/options/tombstone_stream.rs


12. .github/workflows/publish-macros.yml ⚙️ Configuration changes +6/-6

Update workflow for kurrentdb-macros publication

.github/workflows/publish-macros.yml


13. Cargo.toml ⚙️ Configuration changes +1/-1

Update workspace member to kurrentdb-macros

Cargo.toml


14. kurrentdb-macros/Cargo.toml ⚙️ Configuration changes +3/-3

Rename package and reset version to 0.0.1

kurrentdb-macros/Cargo.toml


15. kurrentdb/Cargo.toml Dependencies +1/-1

Update dependency to kurrentdb-macros 0.0.1

kurrentdb/Cargo.toml


16. kurrentdb-macros/src/lib.rs Additional files +0/-0

...

kurrentdb-macros/src/lib.rs


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented May 4, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Context used
✅ Tickets: DEV-1680

Grey Divider


Remediation recommended

1. Fragile version precheck 🐞 Bug ☼ Reliability
Description
The publish workflow’s crates.io precheck can silently treat the remote version as empty (e.g., if
cargo search fails or returns no exact match), causing the version gate to pass without actually
validating what’s published. This makes the workflow unreliable by masking lookup failures and
deferring detection to the later cargo publish step.
Code

.github/workflows/publish-macros.yml[R15-25]

      - name: Verify version is new
        run: |
          LOCAL=$(cargo metadata --no-deps --format-version 1 \
-            | jq -r '.packages[] | select(.name=="eventstore-macros") | .version')
-          REMOTE=$(cargo search eventstore-macros --limit 1 \
-            | sed -nE 's/^eventstore-macros = "([^"]+)".*/\1/p')
+            | jq -r '.packages[] | select(.name=="kurrentdb-macros") | .version')
+          REMOTE=$(cargo search kurrentdb-macros --limit 1 \
+            | sed -nE 's/^kurrentdb-macros = "([^"]+)".*/\1/p')
          echo "local=$LOCAL remote=$REMOTE"
          if [ "$LOCAL" = "$REMOTE" ]; then
-            echo "Version $LOCAL is already published on crates.io. Bump eventstore-macros/Cargo.toml first."
+            echo "Version $LOCAL is already published on crates.io. Bump kurrentdb-macros/Cargo.toml first."
            exit 1
          fi
Evidence
The workflow derives REMOTE from cargo search ... | sed ... and then only blocks when `LOCAL ==
REMOTE; if REMOTE` is empty (no match / transient failure), the check always passes and the
workflow proceeds to publishing.

.github/workflows/publish-macros.yml[15-25]
.github/workflows/publish-macros.yml[30-32]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The crates.io version check in the publish workflow can proceed with an empty/unknown `REMOTE` version (e.g., due to lookup failure or no exact match), so it doesn’t reliably enforce the “bump version before publishing” guard.

### Issue Context
`cargo search` is used in a bash command substitution without strict error handling, and the script only compares strings; an empty `REMOTE` value will always bypass the guard.

### Fix Focus Areas
- .github/workflows/publish-macros.yml[15-25]

### Suggested fix
- Add strict bash settings (`set -euo pipefail`).
- Make the search unambiguous (e.g., use a regex query that matches only the exact crate name) and explicitly handle the `REMOTE==""` case:
 - If the crate is expected to already exist, fail with a clear error when `REMOTE` is empty.
 - If first publish is allowed, print an explicit message like “crate not found on crates.io; assuming first publish” so this isn’t mistaken for a successful remote version lookup.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

w1am added 2 commits May 5, 2026 10:54
Switch the manual publish workflow from `rust-lang/crates-io-auth-action`
(OIDC trusted publishing) to a `CARGO_REGISTRY_TOKEN` repository secret.
The previous OIDC config was tied to an account we no longer have access
to, so we publish under a different account using a plain API token.
@w1am w1am merged commit 478eef1 into master May 5, 2026
40 checks passed
@w1am w1am deleted the w1am/dev-1680-replace-eventstore-macros-with-internal-kurrentdb-macros branch May 5, 2026 07:18
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.

1 participant