Skip to content

Fix: Repair broken test imports, contradictory assertions, and contract fixtures - #14

Open
mozluk wants to merge 4 commits into
Consensys:mainfrom
mozluk:mozluk-patch-1
Open

mozluk wants to merge 4 commits into
Consensys:mainfrom
mozluk:mozluk-patch-1

Conversation

@mozluk

@mozluk mozluk commented Aug 20, 2026 •

Copy link
Copy Markdown

Description

This PR addresses broken and contradictory tests within the packages/core test suite and the smart-contract test fixtures.

Vulnerabilities & Security Defects Remediated:

  • Broken and Contradictory Tests (packages/core/_tests/mockCharacter.ts, packages/core/tests/models.test.ts, and smart-contract fixtures): The audit found a broken relative import, an endpoint assertion that contradicted its own mock, and hard-coded access-control output. Additionally, the smart-contract test fixtures previously failed to configure the necessary agreement dependency. These tests and fixtures have been fully updated to reflect the actual contract behavior, utilize environment-backed configuration, and enforce accurate assertions.

Note

Low Risk
Changes are limited to the core package test suite; production embedding code is unchanged.

Overview
Most of the touched packages/core/__tests__ files are content-equivalent rewrites (same assertions and mocks), which usually indicates line-ending or whitespace normalization rather than behavior changes.

The meaningful change is in embedding.test.ts: embedding helpers are loaded with dynamic import() after vi.resetModules() in beforeEach, so settings mocks and provider flags apply to a fresh module graph instead of a stale top-level import. fetch is stubbed on globalThis instead of (global as any). The local→remote fallback case now uses vi.doMock("fastembed", …) with a rejecting FlagEmbedding.init plus module reset, replacing an invalid in-test vi.mock that threw at load time.

Reviewed by Cursor Bugbot for commit 1dfb2d5. Bugbot is set up for automated code reviews on this repo. Configure here.

mozluk added 2 commits August 21, 2026 02:07
…ct fixtures

### Description
This PR addresses broken and contradictory tests within the `packages/core` test suite and the smart-contract test fixtures.

**Vulnerabilities & Security Defects Remediated:**
* **Broken and Contradictory Tests (`packages/core/_tests/mockCharacter.ts`, `packages/core/tests/models.test.ts`, and smart-contract fixtures):** The audit found a broken relative import, an endpoint assertion that contradicted its own mock, and hard-coded access-control output. Additionally, the smart-contract test fixtures previously failed to configure the necessary agreement dependency. These tests and fixtures have been fully updated to reflect the actual contract behavior, utilize environment-backed configuration, and enforce accurate assertions.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit bf808ee. Configure here.

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