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
5 changes: 2 additions & 3 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# CodeRabbit Configuration File
# Reference: https://docs.coderabbit.ai/spec/configuration
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify schema URL is accessible and validate configuration properties

# Check if schema URL returns valid JSON
echo "Fetching schema from URL..."
curl -s -f "https://coderabbit.ai/integrations/schema.v2.json" -o /tmp/coderabbit-schema.json
if [ $? -eq 0 ]; then
  echo "✓ Schema URL is accessible"
  echo "Schema content preview:"
  cat /tmp/coderabbit-schema.json | jq -r 'keys' 2>/dev/null || cat /tmp/coderabbit-schema.json | head -20
else
  echo "✗ Schema URL is not accessible or returned an error"
fi

# Check documentation URL
echo -e "\nChecking documentation URL..."
curl -s -f -I "https://docs.coderabbit.ai/spec/configuration" > /dev/null
if [ $? -eq 0 ]; then
  echo "✓ Documentation URL is accessible"
else
  echo "✗ Documentation URL is not accessible"
fi

Repository: GoHyperrr/commerce

Length of output: 377


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Checking schema URL response (follow redirects) =="
SCHEMA_URL="https://coderabbit.ai/integrations/schema.v2.json"

# Capture headers and status code
curl -sS -L -o /tmp/coderabbit-schema-raw.json \
  -w "\nHTTP_STATUS=%{http_code}\nCONTENT_TYPE=%{content_type}\n" \
  "$SCHEMA_URL" | sed -n '1,3p'

# Quick sanity: does it look like JSON?
head -c 200 /tmp/coderabbit-schema-raw.json; echo
python3 - <<'PY'
import json
p="/tmp/coderabbit-schema-raw.json"
try:
    with open(p,"r",encoding="utf-8",errors="replace") as f:
        data=f.read().lstrip()
    json.loads(data)
    print("JSON_PARSE=ok")
except Exception as e:
    print("JSON_PARSE=fail:", type(e).__name__, str(e)[:200])
PY

echo
echo "== Checking documentation URL response =="
DOC_URL="https://docs.coderabbit.ai/spec/configuration"
curl -sS -L -I "$DOC_URL" | head -n 20

Repository: GoHyperrr/commerce

Length of output: 2084


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== .coderabbit.yaml (relevant lines) =="
nl -ba .coderabbit.yaml | sed -n '1,120p'

echo
echo "== Validate .coderabbit.yaml against schema =="
python3 - <<'PY'
import os, sys, json, urllib.request
from urllib.error import HTTPError, URLError

# Install deps if missing (sandbox usually allows pip installs)
import pkgutil, subprocess
def ensure(pkg, import_name=None):
    if import_name is None: import_name = pkg
    if pkgutil.find_loader(import_name) is not None:
        return
    subprocess.check_call([sys.executable, "-m", "pip", "install", pkg])

ensure("pyyaml", "yaml")
ensure("jsonschema", "jsonschema")

import yaml
from jsonschema import Draft202012Validator

schema_url = "https://coderabbit.ai/integrations/schema.v2.json"
schema_raw = urllib.request.urlopen(schema_url).read().decode("utf-8", errors="replace")
schema = json.loads(schema_raw)

with open(".coderabbit.yaml","r",encoding="utf-8") as f:
    cfg_raw = f.read()

# yaml-language-server directive is a YAML comment; parse YAML anyway
cfg = yaml.safe_load(cfg_raw) or {}
# Some YAML files may parse into non-dict; normalize
if not isinstance(cfg, dict):
    print("CONFIG_PARSE=non-object:", type(cfg).__name__)
    sys.exit(0)

validator = Draft202012Validator(schema)
errors = sorted(validator.iter_errors(cfg), key=lambda e: list(e.path))

print("CONFIG_KEYS=", sorted(cfg.keys()))
print("SCHEMA_HAS_tone_instructions=", "tone_instructions" in (schema.get("properties") or {}))
print("SCHEMA_HAS_tone_instruction=", "tone_instruction" in (schema.get("properties") or {}))

if errors:
    print(f"VALIDATION=FAIL errors={len(errors)}")
    for e in errors[:20]:
        path = ".".join(str(p) for p in e.path) if e.path else "(root)"
        print(f"- path={path} validator={e.validator} message={e.message}")
else:
    print("VALIDATION=OK")
PY

Repository: GoHyperrr/commerce

Length of output: 163


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== .coderabbit.yaml (relevant lines) =="
cat -n .coderabbit.yaml | sed -n '1,200p'

echo
echo "== Validate .coderabbit.yaml against schema =="
python3 - <<'PY'
import sys, json, urllib.request, yaml
from jsonschema import Draft202012Validator

schema_url = "https://coderabbit.ai/integrations/schema.v2.json"
schema_raw = urllib.request.urlopen(schema_url).read().decode("utf-8", errors="replace")
schema = json.loads(schema_raw)

with open(".coderabbit.yaml","r",encoding="utf-8") as f:
    cfg_raw = f.read()

cfg = yaml.safe_load(cfg_raw) or {}
if not isinstance(cfg, dict):
    print("CONFIG_PARSE=non-object:", type(cfg).__name__)
    sys.exit(0)

validator = Draft202012Validator(schema)
errors = sorted(validator.iter_errors(cfg), key=lambda e: list(e.path))

props = schema.get("properties") or {}
print("CONFIG_KEYS=", sorted(cfg.keys()))
print("SCHEMA_HAS_tone_instructions=", "tone_instructions" in props)
print("SCHEMA_HAS_tone_instruction=", "tone_instruction" in props)

if errors:
    print(f"VALIDATION=FAIL errors={len(errors)}")
    for e in errors[:30]:
        path = ".".join(str(p) for p in e.path) if e.path else "(root)"
        print(f"- path={path} validator={e.validator} message={e.message}")
else:
    print("VALIDATION=OK")
PY

Repository: GoHyperrr/commerce

Length of output: 3361


🏁 Script executed:

#!/bin/bash
set -euo pipefail

SCHEMA_URL="https://coderabbit.ai/integrations/schema.v2.json"
SCHEMA_PATH="/tmp/coderabbit-schema.json"

echo "== Fetch schema via curl (bypass python SSL) =="
curl -sS -L "$SCHEMA_URL" -o "$SCHEMA_PATH"

python3 - <<'PY'
import sys, json, yaml, os
from jsonschema import Draft202012Validator

schema_path="/tmp/coderabbit-schema.json"
with open(schema_path,"r",encoding="utf-8") as f:
    schema=json.load(f)

with open(".coderabbit.yaml","r",encoding="utf-8") as f:
    cfg=yaml.safe_load(f) or {}

if not isinstance(cfg, dict):
    print("CONFIG_PARSE=non-object:", type(cfg).__name__)
    sys.exit(0)

validator=Draft202012Validator(schema)
errors=sorted(validator.iter_errors(cfg), key=lambda e: list(e.path))

# Check for tone_instructions location in schema (best-effort)
props=schema.get("properties") or {}
reviews_props=(props.get("reviews") or {}).get("properties") or {}
tone_instructions_in_schema="tone_instructions" in (reviews_props or {})
print("CONFIG_KEYS=", sorted(cfg.keys()))
print("SCHEMA_HAS_reviews_tone_instructions=", tone_instructions_in_schema)

if errors:
    print(f"VALIDATION=FAIL errors={len(errors)}")
    for e in errors[:50]:
        path=".".join(str(p) for p in e.path) if e.path else "(root)"
        print(f"- path={path} validator={e.validator} message={e.message}")
else:
    print("VALIDATION=OK")
PY

Repository: GoHyperrr/commerce

Length of output: 213


🏁 Script executed:

#!/bin/bash
set -euo pipefail

SCHEMA_PATH="/tmp/coderabbit-schema.json"

echo "== tone_instructions occurrences =="
grep -R --line-number -o '"tone_instructions"' "$SCHEMA_PATH" | head -n 20 || true
echo "== tone_instruction occurrences =="
grep -R --line-number -o '"tone_instruction"' "$SCHEMA_PATH" | head -n 20 || true

echo
echo "== reviews object shape (best-effort) =="
python3 - <<'PY'
import json
p="/tmp/coderabbit-schema.json"
with open(p,"r",encoding="utf-8") as f:
    schema=json.load(f)

props=schema.get("properties",{})
reviews=props.get("reviews",{})
print("schema.properties.reviews keys:", sorted(list(reviews.keys())))
print("reviews.properties keys (if present):", sorted(list((reviews.get("properties") or {}).keys())))

# Also check recursively for any property names containing 'tone'
def find_keys(obj, needle):
    out=set()
    if isinstance(obj, dict):
        for k,v in obj.items():
            if needle in k:
                out.add(k)
            out |= find_keys(v, needle)
    elif isinstance(obj, list):
        for it in obj:
            out |= find_keys(it, needle)
    return out

tone_keys=find_keys(schema,"tone_")
print("keys containing 'tone_':", sorted(tone_keys))
PY

Repository: GoHyperrr/commerce

Length of output: 1185


Schema URL accepts the config (docs link is 404)

  • The yaml-language-server schema at https://coderabbit.ai/integrations/schema.v2.json is reachable, returns valid JSON, and .coderabbit.yaml validates against it.
  • reviews.tone_instructions is recognized by the schema (no unrecognized-property issue).
  • https://docs.coderabbit.ai/spec/configuration currently returns 404; update the reference URL if you want it to work.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.coderabbit.yaml at line 3, The schema URL in .coderabbit.yaml currently
points to https://coderabbit.ai/integrations/schema.v2.json (which is valid for
validation) but the human-facing docs link referenced in your config points to a
404 at https://docs.coderabbit.ai/spec/configuration; update that documentation
URL to the correct, reachable docs page (or remove the dead docs reference) so
users can follow the spec; check any occurrences of reviews.tone_instructions in
the file remain valid per the schema after updating the URL.


language: "en-US"
tone_instruction: "Review code as a senior Go software engineer with a focus on commerce domain structures, data isolation, event-native patterns, and API contracts."

reviews:
profile: "assertive"
tone_instructions: "Review code as a senior Go software engineer with a focus on commerce domain structures, data isolation, event-native patterns, and API contracts."
auto_review:
enabled: true
drafts: false
high_level_summary: true
reviews_per_file: true
collapse_dependency_reviews: true

chat:
auto_reply: true
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Checkout commerce
uses: actions/checkout@v4
- name: Checkout mdk
uses: actions/checkout@v4
with:
repository: GoHyperrr/mdk
ref: ${{ github.head_ref || github.ref_name }}
path: mdk
- name: Move mdk to parent directory
run: mv mdk ../mdk
Comment on lines +23 to +24

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add defensive checks for the move operation.

The mv command has no safeguards:

  • If ../mdk already exists (e.g., from runner caching or a previous step), mv will fail
  • If the checkout step failed silently, mdk/ may not exist
  • The error message won't clearly indicate the root cause

Consider adding an explicit cleanup step before the move:

🛡️ Proposed fix: Add defensive cleanup
+      - name: Clean up any existing mdk in parent
+        run: rm -rf ../mdk
       - name: Move mdk to parent directory
         run: mv mdk ../mdk

Alternatively, verify the move succeeded:

       - name: Move mdk to parent directory
-        run: mv mdk ../mdk
+        run: |
+          mv mdk ../mdk
+          test -d ../mdk || { echo "Failed to move mdk to parent directory"; exit 1; }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 23 - 24, The "Move mdk to parent
directory" step uses "mv mdk ../mdk" with no guards; update that step to first
check that the source "mdk" exists and fail with a clear message if not, remove
or rename the destination "../mdk" if it already exists (e.g., rm -rf ../mdk)
before performing the move, perform the move ("mv mdk ../mdk") and then verify
success (check that ../mdk now exists) and fail with an explicit error message
if the move failed; reference the step name "Move mdk to parent directory" and
the command "mv mdk ../mdk" when making the changes.

- uses: actions/setup-go@v5
with:
go-version: '1.25'
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

All notable changes to this project will be documented in this file.

## [0.1.0] - 2026-06-05

### Added

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add blank line before heading.

The heading should be surrounded by blank lines per Markdown best practices.

📝 Proposed fix
 ## [0.1.0] - 2026-06-05
-
+
 ### Added
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 7-7: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CHANGELOG.md` at line 7, Insert a blank line before the "### Added" heading
in CHANGELOG.md so the heading is separated by an empty line from the preceding
content; update the file to ensure the "### Added" line is surrounded by blank
lines to follow Markdown best practices.

Source: Linters/SAST tools

- Catalog product variant options, pricing normalizations, and image relations.
- Decoupled commerce/seo and commerce/taxonomy packages.
- Refactored test suites to link to mdk/mdktest.
11 changes: 11 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Security Policy

## Supported Versions

For pre-1.0 releases we support the latest release or the latest patch series (e.g., 0.1.x), and for 1.0+ we support the latest major release branch.

## Reporting a Vulnerability

If you discover a security vulnerability within Hyperrr or any of its modules, please do not disclose it publicly. Report it directly by emailing security@hyperrr.org or opening a draft security advisory on GitHub.

We will acknowledge receipt of your report within 48 hours and work with you to patch the issue promptly.
9 changes: 5 additions & 4 deletions analytics/analytics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ import (
"time"

"github.com/GoHyperrr/mdk"
"github.com/GoHyperrr/mdk/mdktest"
"github.com/glebarez/sqlite"
"gorm.io/gorm"
)

func TestAnalyticsModule(t *testing.T) {
database, _ := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
rt := mdk.NewTestRuntime(database)
rt := mdktest.NewTestRuntime(database)

testProj := &mdk.TestProjector{}
ctxMod := &mdk.TestContextModule{Proj: testProj}
testProj := &mdktest.TestProjector{}
ctxMod := &mdktest.ProjectorModule{Proj: testProj}
rt.SetModule("core.context", ctxMod)

mod := NewModule()
Expand All @@ -26,7 +27,7 @@ func TestAnalyticsModule(t *testing.T) {
now := time.Now()
ended := now.Add(time.Second)
testProj.Lineages = []mdk.LineageData{
mdk.TestLineageData{
mdktest.TestLineageData{
ID: "wf1",
Name: "test",
State: "COMPLETED",
Expand Down
16 changes: 8 additions & 8 deletions cart/cart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import (
"context"
"testing"

"github.com/GoHyperrr/mdk"
"github.com/GoHyperrr/mdk/mdktest"
"github.com/glebarez/sqlite"
"gorm.io/gorm"
)

func TestCartWorkflow(t *testing.T) {
t.Run("Add Item Workflow", func(t *testing.T) {
database, _ := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
rt := mdk.NewTestRuntime(database)
rt := mdktest.NewTestRuntime(database)

mod := NewModule()
_ = mod.Init(context.Background(), rt)
_ = database.AutoMigrate(mod.Models()...)
runner := rt.Workflows().(*mdk.TestWorkflowEngine)
runner := rt.Workflows().(*mdktest.TestWorkflowEngine)

c := &Cart{ID: "cart1", CustomerID: "cust1", Status: CartActive}
mod.Repo().Save(context.Background(), c)
Expand All @@ -34,12 +34,12 @@ func TestCartWorkflow(t *testing.T) {

t.Run("Remove Item Workflow", func(t *testing.T) {
database, _ := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
rt := mdk.NewTestRuntime(database)
rt := mdktest.NewTestRuntime(database)

mod := NewModule()
_ = mod.Init(context.Background(), rt)
_ = database.AutoMigrate(mod.Models()...)
runner := rt.Workflows().(*mdk.TestWorkflowEngine)
runner := rt.Workflows().(*mdktest.TestWorkflowEngine)

c := &Cart{ID: "cart1", Items: []CartItem{{ID: "i1", CartID: "cart1", ProductID: "p1", Quantity: 1}}, Status: CartActive}
mod.Repo().Save(context.Background(), c)
Expand All @@ -56,12 +56,12 @@ func TestCartWorkflow(t *testing.T) {

t.Run("Checkout Workflow", func(t *testing.T) {
database, _ := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
rt := mdk.NewTestRuntime(database)
rt := mdktest.NewTestRuntime(database)

mod := NewModule()
_ = mod.Init(context.Background(), rt)
_ = database.AutoMigrate(mod.Models()...)
runner := rt.Workflows().(*mdk.TestWorkflowEngine)
runner := rt.Workflows().(*mdktest.TestWorkflowEngine)

c := &Cart{ID: "cart1", Items: []CartItem{{ID: "i1", CartID: "cart1", ProductID: "p1", Quantity: 1}}, Status: CartActive}
mod.Repo().Save(context.Background(), c)
Expand All @@ -75,7 +75,7 @@ func TestCartWorkflow(t *testing.T) {

t.Run("Handler Error Cases", func(t *testing.T) {
database, _ := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
rt := mdk.NewTestRuntime(database)
rt := mdktest.NewTestRuntime(database)

mod := NewModule()
_ = mod.Init(context.Background(), rt)
Expand Down
19 changes: 10 additions & 9 deletions cart/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ func (m *Module) Init(ctx context.Context, rt mdk.Runtime) error {
Name: "Cart Add Item",
Steps: []mdk.Step{
{
ID: "add",
Name: "Add Item",
Handler: m.AddItemStep,
ID: "add",
Name: "Add Item",
Uses: "cart.add_item",
},
},
})
Expand All @@ -42,9 +42,9 @@ func (m *Module) Init(ctx context.Context, rt mdk.Runtime) error {
Name: "Cart Remove Item",
Steps: []mdk.Step{
{
ID: "remove",
Name: "Remove Item",
Handler: m.RemoveItemStep,
ID: "remove",
Name: "Remove Item",
Uses: "cart.remove_item",
},
},
})
Expand All @@ -54,15 +54,16 @@ func (m *Module) Init(ctx context.Context, rt mdk.Runtime) error {
Name: "Cart Checkout",
Steps: []mdk.Step{
{
ID: "checkout",
Name: "Checkout",
Handler: m.CheckoutStep,
ID: "checkout",
Name: "Checkout",
Uses: "cart.checkout",
},
},
})

_ = rt.Workflows().RegisterHandler("cart.add_item", m.AddItemStep)
_ = rt.Workflows().RegisterHandler("cart.remove_item", m.RemoveItemStep)
_ = rt.Workflows().RegisterHandler("cart.checkout", m.CheckoutStep)

return nil
}
Expand Down
4 changes: 2 additions & 2 deletions cart/repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

"github.com/GoHyperrr/mdk"
"github.com/GoHyperrr/mdk/mdktest"
"github.com/glebarez/sqlite"
"gorm.io/gorm"
)
Expand All @@ -15,7 +15,7 @@ func TestCartRepository(t *testing.T) {
defer os.Remove(dbFile)

database, _ := gorm.Open(sqlite.Open(dbFile), &gorm.Config{})
rt := mdk.NewTestRuntime(database)
rt := mdktest.NewTestRuntime(database)

mod := NewModule()
_ = mod.Init(context.Background(), rt)
Expand Down
13 changes: 7 additions & 6 deletions customer/customer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ import (
"testing"

"github.com/GoHyperrr/mdk"
"github.com/GoHyperrr/mdk/mdktest"
"github.com/glebarez/sqlite"
"gorm.io/gorm"
)

func TestCustomerWorkflow(t *testing.T) {
database, _ := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
rt := mdk.NewTestRuntime(database)
rt := mdktest.NewTestRuntime(database)

testProj := &mdk.TestProjector{}
ctxMod := &mdk.TestContextModule{Proj: testProj}
testProj := &mdktest.TestProjector{}
ctxMod := &mdktest.ProjectorModule{Proj: testProj}
rt.SetModule("core.context", ctxMod)

mod := NewModule()
Expand All @@ -27,7 +28,7 @@ func TestCustomerWorkflow(t *testing.T) {
}

_ = database.AutoMigrate(mod.Models()...)
runner := rt.Workflows().(*mdk.TestWorkflowEngine)
runner := rt.Workflows().(*mdktest.TestWorkflowEngine)

t.Run("Segmentation Workflow", func(t *testing.T) {
// Create a customer first
Expand All @@ -37,7 +38,7 @@ func TestCustomerWorkflow(t *testing.T) {
// Seed lineages to get WHALE persona (needs > 5 orders)
for i := 0; i < 6; i++ {
wfID := fmt.Sprintf("wf_%d", i)
testProj.Lineages = append(testProj.Lineages, mdk.TestLineageData{
testProj.Lineages = append(testProj.Lineages, mdktest.TestLineageData{
ID: wfID,
Name: "fulfillment.v1",
State: "COMPLETED",
Expand Down Expand Up @@ -78,7 +79,7 @@ func TestCustomerWorkflow(t *testing.T) {

t.Run("Handler Error Cases", func(t *testing.T) {
database, _ := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
rt := mdk.NewTestRuntime(database)
rt := mdktest.NewTestRuntime(database)

mod := NewModule()
_ = mod.Init(context.Background(), rt)
Expand Down
4 changes: 2 additions & 2 deletions finance/finance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"testing"

"github.com/GoHyperrr/mdk"
"github.com/GoHyperrr/mdk/mdktest"
"github.com/glebarez/sqlite"
"gorm.io/gorm"
)
Expand Down Expand Up @@ -41,7 +41,7 @@ func (m *flexibleMockOrder) GetCustomerID() string { return "" }

func TestFinanceWorkflow(t *testing.T) {
database, _ := gorm.Open(sqlite.Open("file:memdb_finance_wf?mode=memory&cache=shared"), &gorm.Config{})
rt := mdk.NewTestRuntime(database)
rt := mdktest.NewTestRuntime(database)

mod := NewModule()
_ = mod.Init(context.Background(), rt)
Expand Down
5 changes: 3 additions & 2 deletions fulfillment/fulfillment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/google/uuid"
"github.com/GoHyperrr/mdk"
"github.com/GoHyperrr/mdk/mdktest"
"github.com/glebarez/sqlite"
"gorm.io/gorm"
)
Expand All @@ -24,12 +25,12 @@ func (m *mockOrder) GetCustomerID() string { return m.CustomerID }

func TestFulfillmentWorkflow(t *testing.T) {
database, _ := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
rt := mdk.NewTestRuntime(database)
rt := mdktest.NewTestRuntime(database)

mod := NewModule()
_ = mod.Init(context.Background(), rt)
_ = database.AutoMigrate(mod.Models()...)
runner := rt.Workflows().(*mdk.TestWorkflowEngine)
runner := rt.Workflows().(*mdktest.TestWorkflowEngine)

t.Run("Reserve Inventory Success", func(t *testing.T) {
productID := "p_res_" + uuid.New().String()[:8]
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ require (
modernc.org/memory v1.5.0 // indirect
modernc.org/sqlite v1.23.1 // indirect
)

replace github.com/GoHyperrr/mdk => ../mdk

Copy link
Copy Markdown

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:

#!/bin/bash
# Description: Check CI/build configs for references to local mdk path

# Search for references to ../mdk in CI and build files
rg -n --type=yaml --type=toml --type=json '../mdk' -g '!go.mod'

# Check if there are any build/CI workflow files
fd -e yml -e yaml . .github .gitlab-ci.yml .circleci

Repository: GoHyperrr/commerce

Length of output: 222


Remove/relocate the local go.mod replace to avoid CI/other developers depending on ../mdk.

go.mod contains:

replace github.com/GoHyperrr/mdk => ../mdk

Go will apply this replace during go build/go test regardless of whether CI/workflow files mention ../mdk directly, so the path must exist relative to the build workspace. Move the local linkage to a go.work/local-only setup or remove the directive before merge.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@go.mod` at line 27, The go.mod currently contains a local replace directive
"replace github.com/GoHyperrr/mdk => ../mdk" which forces builds to depend on a
relative path; remove this line from go.mod and either add the local replacement
to a go.work file or document using a local go.work for dev only so CI and other
devs use the canonical module; update references to the replace directive (the
"replace github.com/GoHyperrr/mdk => ../mdk" entry) and ensure go.mod is
committed without the local replace before merging.

2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
github.com/GoHyperrr/mdk v0.0.0-20260605044506-3d2ab0d97ca9 h1:32yHu/Gnk+ztrDUZ8D+WnjWmkKZd8ebs+yxrjKJFq8Y=
github.com/GoHyperrr/mdk v0.0.0-20260605044506-3d2ab0d97ca9/go.mod h1:eZBBN0St+r0Gu5K5CklIsS6/SlVx6t2WsvOjkR1t4Ak=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/glebarez/go-sqlite v1.21.2 h1:3a6LFC4sKahUunAmynQKLZceZCOzUthkRkEAl9gAXWo=
Expand Down
4 changes: 2 additions & 2 deletions marketing/marketing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"

"github.com/google/uuid"
"github.com/GoHyperrr/mdk"
"github.com/GoHyperrr/mdk/mdktest"
"github.com/glebarez/sqlite"
"gorm.io/gorm"
)
Expand All @@ -23,7 +23,7 @@ func (m *mockOrder) GetCustomerID() string { return m.CustomerID }

func TestMarketingModule(t *testing.T) {
database, _ := gorm.Open(sqlite.Open("file::memory:?cache=shared"), &gorm.Config{})
rt := mdk.NewTestRuntime(database)
rt := mdktest.NewTestRuntime(database)

mod := NewModule()
_ = mod.Init(context.Background(), rt)
Expand Down
5 changes: 3 additions & 2 deletions notification/notification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ import (

"github.com/google/uuid"
"github.com/GoHyperrr/mdk"
"github.com/GoHyperrr/mdk/mdktest"
"github.com/glebarez/sqlite"
"gorm.io/gorm"
)

func TestNotificationModule(t *testing.T) {
database, _ := gorm.Open(sqlite.Open("file::memory:?cache=shared"), &gorm.Config{})
rt := mdk.NewTestRuntime(database)
rt := mdktest.NewTestRuntime(database)

// Create mock provider
mockProv := &MockProvider{}

mod := NewModule(mockProv)
_ = mod.Init(context.Background(), rt)
_ = database.AutoMigrate(mod.Models()...)
runner := rt.Workflows().(*mdk.TestWorkflowEngine)
runner := rt.Workflows().(*mdktest.TestWorkflowEngine)

t.Run("Send Notification Success", func(t *testing.T) {
recipient := fmt.Sprintf("test_%s@example.com", uuid.New().String()[:8])
Expand Down
7 changes: 4 additions & 3 deletions order/order_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"time"

"github.com/GoHyperrr/mdk"
"github.com/GoHyperrr/mdk/mdktest"
"github.com/glebarez/sqlite"
"gorm.io/gorm"
)
Expand All @@ -18,11 +19,11 @@ func TestOrderWorkflow(t *testing.T) {
defer os.Remove(dbFile)

database, _ := gorm.Open(sqlite.Open(dbFile), &gorm.Config{})
rt := mdk.NewTestRuntime(database)
rt := mdktest.NewTestRuntime(database)

mod := NewModule()
_ = mod.Init(context.Background(), rt)
runner := rt.Workflows().(*mdk.TestWorkflowEngine)
runner := rt.Workflows().(*mdktest.TestWorkflowEngine)

// Mock external handlers
_ = runner.RegisterHandler("finance.process_payment", func(sCtx mdk.StepContext) mdk.StepResult {
Expand Down Expand Up @@ -184,7 +185,7 @@ func TestOrderRepository(t *testing.T) {
dbFile := "order_err_test.db"
defer os.Remove(dbFile)
database, _ := gorm.Open(sqlite.Open(dbFile), &gorm.Config{})
rt := mdk.NewTestRuntime(database)
rt := mdktest.NewTestRuntime(database)
mod := NewModule()
_ = mod.Init(context.Background(), rt)
_ = database.AutoMigrate(mod.Models()...)
Expand Down
Loading
Loading