Skip to content

Conversation

@seefeldb
Copy link
Contributor

@seefeldb seefeldb commented Jul 2, 2025

feat(link-utils): introduce type field for parsed links, making them memory addresses

  • Added a new type property to normalized link structures in link-utils.ts, defaulting to application/json.
  • Updated link parsing, normalization, and equality logic to handle the new type field.
  • Refactored related functions and tests to ensure correct handling and propagation of the type property.
  • Enhanced test cases in link-utils.test.ts to cover scenarios involving the type field and its default value.

Summary by cubic

Added a type field to parsed links in link-utils, making them complete memory addresses and defaulting to application/json.

  • Refactors
    • Updated link parsing, normalization, and equality checks to handle the new type field.
    • Refactored related functions and tests to support and verify the type property.

…m memory addresses

- Added a new `type` property to normalized link structures in `link-utils.ts`, defaulting to `application/json`.
- Updated link parsing, normalization, and equality logic to handle the new `type` field.
- Refactored related functions and tests to ensure correct handling and propagation of the `type` property.
- Enhanced test cases in `link-utils.test.ts` to cover scenarios involving the `type` field and its default value.
@seefeldb seefeldb requested a review from Gozala July 2, 2025 20:50
@linear
Copy link

linear bot commented Jul 2, 2025

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

cubic reviewed 3 files and found no issues. Review PR in cubic.dev.

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

Adds a type field to all parsed links—defaulting to "application/json"—and updates parsing, normalization, equality checks, and tests accordingly.

  • Introduces an optional type property on NormalizedLink and enforces type in NormalizedFullLink.
  • Updates parseLink and areNormalizedLinksSame to handle the new type field.
  • Refactors and extends test suites to include the default type.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/runner/src/link-utils.ts Added type to link types, default value and equality logic, refactored NormalizedFullLink.
packages/runner/test/link-utils.test.ts Extended tests to assert the default type in parsed links.
packages/runner/test/schema.test.ts Updated schema tests to include the new type property.
Comments suppressed due to low confidence (2)

packages/runner/src/link-utils.ts:39

  • [nitpick] The doc comment is grammatically unclear. Consider rephrasing to: "Full normalized link from a complete link (with required id, space, and type), created by parseLink when a base is provided."
 * Full normalized link that from a complete link, i.e. with required id, space

packages/runner/test/link-utils.test.ts:410

  • [nitpick] Consider adding a test case that uses a non-default type value and verifies that areNormalizedLinksSame handles differing type fields correctly, to ensure full coverage of the new logic.
      expect(result).toEqual({

@seefeldb seefeldb merged commit 2a3bf94 into main Jul 2, 2025
8 checks passed
@seefeldb seefeldb deleted the berni/ct-486-link-types-are-memory-locations branch July 2, 2025 20:59
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.

2 participants