Skip to content

Comments

refactor: Renamed updateAsset to mergeData#72

Merged
macterra merged 1 commit intomainfrom
69-rename-updateasset
Feb 13, 2026
Merged

refactor: Renamed updateAsset to mergeData#72
macterra merged 1 commit intomainfrom
69-rename-updateasset

Conversation

@macterra
Copy link
Collaborator

No description provided.

@macterra macterra linked an issue Feb 13, 2026 that may be closed by this pull request
@macterra macterra requested a review from Copilot February 13, 2026 15:59
Copy link
Contributor

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 refactors the updateAsset method to mergeData to better reflect its merge semantics, and introduces a breaking API change where null values (instead of undefined) are used to delete properties. The refactor also improves CLI efficiency by eliminating the need to fetch entire assets before updating individual properties.

Changes:

  • Renamed updateAsset to mergeData across the codebase (interface, implementation, tests, CLI tools)
  • Changed property deletion mechanism from undefined to null (breaking API change)
  • Refactored CLI set-property command to use direct merge instead of fetch-modify-update pattern

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/keymaster/src/types.ts Updated interface to rename method from updateAsset to mergeData
packages/keymaster/src/keymaster.ts Implemented mergeData with null-based deletion logic; updated all internal calls
packages/keymaster/src/keymaster-client.ts Updated client method name to match interface
packages/keymaster/src/cli.ts Refactored set-property to use direct merge with single-key objects
scripts/archon-cli.js Applied same refactoring as cli.ts
services/keymaster/server/src/keymaster-api.ts Updated API endpoint to use mergeData
services/mediators/hyperswarm/src/hyperswarm-mediator.ts Updated method call to mergeData
tests/keymaster/asset.test.ts Updated test suite and added null deletion test
tests/keymaster/client.test.ts Updated test suite with new method name
tests/keymaster/vault.test.ts Updated test to use mergeData
tests/hypr-confirm.js Updated integration test to use mergeData
Comments suppressed due to low confidence (1)

tests/keymaster/asset.test.ts:412

  • Missing test coverage for the behavior when a property is set to undefined. The implementation only deletes properties when set to null (line 1294), but there's no test verifying that undefined values are preserved (not deleted). This could lead to confusion about the API contract. Consider adding a test that verifies setting a property to undefined preserves it with an undefined value.
    it('should remove a property when set to null', async () => {
        await keymaster.createId('Bob');
        const mockAsset1 = { key1: 'val1', key2: 'val2' };
        const mockAsset2 = { key2: null };
        const did = await keymaster.createAsset(mockAsset1);
        const ok = await keymaster.mergeData(did, mockAsset2);
        const asset = await keymaster.resolveAsset(did);

        expect(ok).toBe(true);
        expect(asset).toStrictEqual({ key1: 'val1' });
    });

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@macterra macterra merged commit 880bd04 into main Feb 13, 2026
19 checks passed
@macterra macterra deleted the 69-rename-updateasset branch February 13, 2026 16:11
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.

Rename updateAsset to updateData

1 participant