Skip to content

test(frontend): add unit tests for serializePortIdentity - #6938

Open
rbelavadi wants to merge 2 commits into
apache:mainfrom
rbelavadi:test/6631-port-identity-serde-unit-tests
Open

test(frontend): add unit tests for serializePortIdentity#6938
rbelavadi wants to merge 2 commits into
apache:mainfrom
rbelavadi:test/6631-port-identity-serde-unit-tests

Conversation

@rbelavadi

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Adds port-identity-serde.spec.ts to cover serializePortIdentity, a previously untested pure utility function in common/util/ that serializes a PortIdentity into the stable string key id_internal.

This format is one half of a cross-language contract: the backend produces the identical string in PortIdentityKeySerializer.portIdToString and reads it back by splitting on "_" in PortIdentityKeyDeserializer. A format mismatch on either side would cause the frontend's schema lookup to silently return undefined rather than fail, so the exact output is worth pinning.

Covers four groups of behavior:

  • Format: exact key for external and internal ports, including the id: 0 falsy-number boundary and large and negative ids passing through unvalidated. These mirror PortIdentityKeySerializerSpec.scala's case table exactly, so both ends of the contract are now pinned by matching assertions.
  • Distinctness: ports differing only by id, or only by internal, cannot collide on the same key.
  • Stability: equal inputs always serialize identically.
  • Real usage: the key works for object lookup when generated independently at write and read time, and remains splittable into exactly two fields for the backend deserializer.

No production code was changed.

Any related issues, documentation, discussions?

Closes #6631

How was this PR tested?

Added 12 new unit tests in port-identity-serde.spec.ts covering all behavior described in the issue. Ran locally via ng test --include src/app/common/util/port-identity-serde.spec.ts --watch=false; all 12 pass. Full suite also green via yarn test (3817 passed, 2 skipped, 198 files).

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 4.8)

@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • No candidates found from git blame history.

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Jul 27, 2026
@codecov-commenter

codecov-commenter commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.50%. Comparing base (49f9e2c) to head (99a9306).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6938      +/-   ##
============================================
- Coverage     78.96%   78.50%   -0.46%     
+ Complexity     3798     3715      -83     
============================================
  Files          1161     1161              
  Lines         46084    46036      -48     
  Branches       5110     5102       -8     
============================================
- Hits          36388    36139     -249     
- Misses         8076     8291     +215     
+ Partials       1620     1606      -14     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 4af3a85
agent-service 76.76% <ø> (ø) Carriedforward from 4af3a85
amber 71.48% <ø> (-0.75%) ⬇️ Carriedforward from 4af3a85
computing-unit-managing-service 20.49% <ø> (ø) Carriedforward from 4af3a85
config-service 66.66% <ø> (ø) Carriedforward from 4af3a85
file-service 67.21% <ø> (ø) Carriedforward from 4af3a85
frontend 82.91% <ø> (-0.01%) ⬇️
notebook-migration-service 78.94% <ø> (ø) Carriedforward from 4af3a85
pyamber 93.54% <ø> (-1.85%) ⬇️ Carriedforward from 4af3a85
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from 4af3a85

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rbelavadi

Copy link
Copy Markdown
Contributor Author

/request-review @Ma77Ball

@xuang7 xuang7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@xuang7
xuang7 enabled auto-merge July 27, 2026 20:44
@xuang7
xuang7 added this pull request to the merge queue Jul 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 27, 2026
@xuang7
xuang7 added this pull request to the merge queue Jul 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 27, 2026
@xuang7
xuang7 added this pull request to the merge queue Jul 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit test coverage for serializePortIdentity

4 participants