Skip to content

fix: address PR review feedback on test isolation and undefined property encoding#130

Merged
Looted merged 2 commits intodevelopfrom
copilot/sub-pr-129
Mar 30, 2026
Merged

fix: address PR review feedback on test isolation and undefined property encoding#130
Looted merged 2 commits intodevelopfrom
copilot/sub-pr-129

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 30, 2026

Four issues flagged in code review: unused imports that could fail Biome CI checks, incorrect env var restoration in afterEach, accidental serialization of undefined as "undefined" in the Prolog encoder, and an unused type alias.

Changes

  • hoverProvider.test.ts: Remove unused realCategorizeEntities and realFormatLensTitle from the helpers?real destructuring import.

  • treeProvider.test.ts: Remove declared-but-unreferenced TreeProviderInstance type alias.

  • upsert.test.ts — env var restoration: Capture KIBI_MCP_DEBUG as string | undefined; delete the key on restore when it was originally unset instead of writing "".

    // before
    const initialKibiMcpDebug = process.env.KIBI_MCP_DEBUG ?? "";
    // after
    const initialKibiMcpDebug: string | undefined = process.env.KIBI_MCP_DEBUG;
    // afterEach
    if (initialKibiMcpDebug === undefined) delete process.env.KIBI_MCP_DEBUG;
    else process.env.KIBI_MCP_DEBUG = initialKibiMcpDebug;
  • upsert.tsbuildPropertyList: Skip undefined/null values rather than falling through to String(value) which emits owner="undefined" into the Prolog transaction goal.

    if (value === undefined || value === null) continue;

    Test assertion updated from toContain('owner="undefined"')not.toContain("owner=").

…ps, unused type)

Agent-Logs-Url: https://github.com/Looted/kibi/sessions/3d0a4d79-9903-4572-9709-bdd79879f7d8

Co-authored-by: Looted <6255880+Looted@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve test isolation and coverage for CLI and VS Code fix: address PR review feedback on test isolation and undefined property encoding Mar 30, 2026
Copilot AI requested a review from Looted March 30, 2026 20:37
@Looted Looted marked this pull request as ready for review March 30, 2026 21:00
Copilot AI review requested due to automatic review settings March 30, 2026 21:00
@Looted Looted merged commit de436ff into develop Mar 30, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses prior review feedback around test cleanliness/isolation and Prolog goal encoding, primarily by removing unused test-only symbols, restoring env vars correctly, and preventing accidental "undefined" serialization in entity upserts.

Changes:

  • Remove unused imports/type aliases in VS Code extension tests to satisfy lint/CI.
  • Fix KIBI_MCP_DEBUG env var restoration to delete the key when initially unset.
  • Update MCP upsert property encoding to skip undefined/null entity properties and adjust the related test assertion.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/vscode/tests/treeProvider.test.ts Removes an unused TreeProviderInstance type alias.
packages/vscode/tests/hoverProvider.test.ts Removes unused real helper destructuring imports, keeping only the used symbol.
packages/mcp/tests/tools/upsert.test.ts Restores KIBI_MCP_DEBUG correctly and updates assertion to ensure owner isn’t encoded when undefined.
packages/mcp/src/tools/upsert.ts Skips undefined/null values when building the entity property list for Prolog transactions.

Comment on lines 278 to 281
for (const [key, value] of Object.entries(entity)) {
if (key === "type") continue;
if (value === undefined || value === null) continue;

Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

buildPropertyList now skips undefined/null, which fixes accidental "undefined" strings for entity properties, but the relationship encoder (buildRelationshipMetadata) still stringifies undefined (e.g. source="undefined") because Ajv treats undefined as “missing” and allows it through. Consider applying the same value === undefined (and/or null) skip logic to buildRelationshipMetadata as well so relationship metadata doesn’t persist the literal string "undefined".

Copilot uses AI. Check for mistakes.

for (const [key, value] of Object.entries(entity)) {
if (key === "type") continue;
if (value === undefined || value === null) continue;
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

The value === null branch here is likely unreachable because entitySchema declares properties as non-nullable and Ajv will fail validation for null (unlike undefined, which Ajv treats as missing). Consider either dropping the null check to avoid implying null is supported, or explicitly documenting/adjusting validation if null is intended to be accepted.

Suggested change
if (value === undefined || value === null) continue;
if (value === undefined) continue;

Copilot uses AI. Check for mistakes.
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.

3 participants