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
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
id: TASK-046
title: Add git release creation to publish workflow
status: Done
assignee: []
created_date: '2026-06-05 22:46'
updated_date: '2026-06-05 22:50'
labels: []
dependencies: []
modified_files:
- .github/workflows/publish.yml
- .changeset/config.json
priority: medium
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->

Make explicit that changesets/action creates GitHub Releases for both @woss/dali-orm and @woss/dali-memory after npm publish. Two changes:

1. Add `createGithubReleases: true` to changesets/action config in publish.yml
2. Fix `baseBranch` from `origin/main` to `main` in .changeset/config.json
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria

<!-- AC:BEGIN -->

- [x] #1 publish.yml has `createGithubReleases: true` on changesets/action step
- [x] #2 .changeset/config.json `baseBranch` is `"main"` not `"origin/main"`
- [x] #3 Changes committed to a branch
<!-- AC:END -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
id: TASK-047
title: Validate generator HNSW SQL against embedded SurrealDB
status: Done
assignee: []
created_date: '2026-06-06 09:19'
updated_date: '2026-06-06 09:41'
labels:
- testing
- hnsw
- integration
dependencies: []
modified_files:
- packages/dali-orm/src/migration/core/__tests__/generator.integration.test.ts
priority: high
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->

Generator tests (generator.test.ts) are pure string matching — they construct mock objects and assert SQL output. This misses syntax errors like `DISTANCE` vs `DIST` because no SQL is ever executed against a real SurrealDB engine. The only HNSW integration test (introspect.integration.test.ts) soft-skips HNSW because embedded `mode: 'memory'` doesn't support it.

Add generator.integration.test.ts that:

1. Connects to embedded SurrealDB (try file-backed mode, fall back to memory)
2. Generates all HNSW index variations (COSINE, EUCLIDEAN, MANHATTAN, with/without vectorType)
3. Executes the generated SQL against the live engine
4. Asserts no error — syntax validation that catches generator bugs
5. Cleans up test tables after each case

If file-backed embedded mode also doesn't support HNSW, the test should fail explicitly (not silently skip like the current introspect test).

See the HNSW test helpers at generator.test.ts:27-33 (index() helper) and the existing integration test pattern at introspect.integration.test.ts:1-49 (EmbeddedDriver setup).

<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria

<!-- AC:BEGIN -->

- [x] #1 generator.integration.test.ts exists alongside generator.test.ts
- [x] #2 Uses EmbeddedDriver (file-backed mode preferred) for real SQL execution
- [x] #3 Covers all HNSW distance types: COSINE, EUCLIDEAN, MANHATTAN
- [x] #4 Covers HNSW with and without vectorType (float32, float64)
- [x] #5 Test fails if generated SQL is rejected by SurrealDB engine
- [x] #6 All existing 2419 tests still pass
<!-- AC:END -->

## Final Summary

<!-- SECTION:FINAL_SUMMARY:BEGIN -->

## Summary

**Task**: Validate generator HNSW SQL against embedded SurrealDB

**File**: `packages/dali-orm/src/migration/core/__tests__/generator.integration.test.ts` (182 lines)

**Setup**: Uses `EmbeddedDriver` with `surrealkv` (file-backed) mode, falling back to `memory`. Each test creates a unique table, defines a vector field, generates HNSW index SQL via `SurrealQLGenerator.generateIndexDefinition()`, executes it against the live engine, asserts no error, then cleans up.

**5 test cases covering all variations**:

1. HNSW COSINE with float32 → `TYPE F32 DIST COSINE`
2. HNSW with minimal params (dimension only) → no type/distance
3. HNSW MANHATTAN + float64 → `TYPE F64 DIST MANHATTAN`
4. HNSW EUCLIDEAN (no vectorType) → `DIST EUCLIDEAN`
5. HNSW float deprecated alias + COSINE → `TYPE F64 DIST COSINE`

**Bug caught**: All 5 tests originally failed because generator emitted `TYPE float32`/`TYPE float64`/`TYPE float` — SurrealDB expects `TYPE F32`/`TYPE F64`. Fixed by adding `VECTOR_TYPE_TO_SQL` mapping in `generator.ts`.

**Result**: All 2424 tests pass (62 test files, 0 failures).

<!-- SECTION:FINAL_SUMMARY:END -->
8 changes: 0 additions & 8 deletions .changeset/README.md

This file was deleted.

16 changes: 0 additions & 16 deletions .changeset/config.json

This file was deleted.

7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

- run: mkdir -p ~/.vite-plus/cache
- name: Cache vite-plus task cache
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ~/.vite-plus/cache
key: ${{ runner.os }}-vp-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}
Expand All @@ -49,12 +49,7 @@ jobs:
- run: pnpm vp run ci
- run: pnpm test:coverage
- run: pnpm lint
- name: Fetch main branch
run: git fetch origin main:main

- name: Check for changeset
if: github.event_name == 'pull_request'
run: pnpm changeset status --since=main
- name: Report Coverage
if: always()
uses: davelosert/vitest-coverage-report-action@v2
Expand Down
48 changes: 37 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ jobs:
permissions:
contents: write
id-token: write
pull-requests: write

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Need full history for tag lookup
- uses: jdx/mise-action@v4

- name: Get pnpm store directory
Expand All @@ -36,14 +37,39 @@ jobs:
- run: pnpm install --frozen-lockfile
- run: pnpm build

- name: Create Release Pull Request or Publish
uses: changesets/action@v1
with:
publish: pnpm release
version: pnpm version-packages:ci
commit: 'chore: version packages'
title: 'chore: version packages'
- name: Check version
id: version
run: |
VERSION=$(node -e "console.log(require('./packages/dali-orm/package.json').version)")
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
echo "Tag v$VERSION already exists — nothing to publish"
echo "publish=false" >> $GITHUB_OUTPUT
else
echo "Detected new version v$VERSION"
echo "publish=true" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
fi

- name: Publish @woss/dali-orm
if: steps.version.outputs.publish == 'true'
run: |
cd packages/dali-orm
pnpm publish --no-git-checks --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish @woss/dali-memory
if: steps.version.outputs.publish == 'true'
run: |
cd packages/dali-memory
pnpm publish --no-git-checks --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create GitHub Release
if: steps.version.outputs.publish == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: 'true'
GH_TOKEN: ${{ github.token }}
run: |
gh release create "v${{ steps.version.outputs.version }}" \
--generate-notes
Loading
Loading