Skip to content

Implement equals and hashCode for domain models#391

Open
Brad-Edwards wants to merge 4 commits intodevfrom
claude/fix-issue-323-tech-debt-dHxO5
Open

Implement equals and hashCode for domain models#391
Brad-Edwards wants to merge 4 commits intodevfrom
claude/fix-issue-323-tech-debt-dHxO5

Conversation

@Brad-Edwards
Copy link
Copy Markdown
Contributor

@Brad-Edwards Brad-Edwards commented Mar 22, 2026

Summary

Implements equals() and hashCode() methods for Requirement, RequirementRelation, and TraceabilityLink domain models to enable proper equality comparison and collection deduplication based on the current natural keys after merging dev.

Related Issues

Changes

  • Requirement: Equality is now based on the merged natural key: project-scoped, case-insensitive uid
  • RequirementRelation: Equality is based on source requirement, target requirement, and relation type, following requirement natural-key equality instead of raw entity IDs
  • TraceabilityLink: Equality is based on requirement, artifact type, artifact identifier, and link type, following requirement natural-key equality instead of raw entity IDs
  • Updated unit tests in RequirementTest and TraceabilityLinkTest to cover same-project/case-insensitive equality, cross-project inequality, transient object behavior, hashCode consistency, null/type safety, and set deduplication
  • Added a succinct CHANGELOG.md entry dated 2025-03-29
  • Bumped backend version to the next patch release

Test Plan

  • Unit tests added and pass (RequirementTest.Equality, RequirementTest.RelationEquality, TraceabilityLinkTest.Equality)
  • Tests verify reflexivity, symmetry, consistency with hashCode, null/type safety, set deduplication, case-insensitive UID matching, and cross-project inequality
  • make check passes

Checklist

  • Code follows project coding standards
  • Domain layer has no framework imports (only java.util.Objects / java.util.Locale)
  • Entities already have @Audited annotations
  • CHANGELOG.md updated

https://claude.ai/code/session_014UW7zGZPL22dEg9LRjjyHi


⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

Implement business-key based equals/hashCode on Requirement,
RequirementRelation, and TraceabilityLink to fix unreliable Set
deduplication and membership checks across JPA session boundaries.

- Requirement: equality by uid (globally unique per DB constraint)
- RequirementRelation: equality by (source.id, target.id, relationType)
- TraceabilityLink: equality by (requirement.id, artifactType,
  artifactIdentifier, linkType)

Composite keys mirror the existing DB unique constraints. Tests added
to each unit test class covering same-key equality, different-key
inequality, hash code consistency, and Set deduplication.

https://claude.ai/code/session_014UW7zGZPL22dEg9LRjjyHi
@Brad-Edwards
Copy link
Copy Markdown
Contributor Author

@copilot Merge dev then assess whether this work is still useful. If so, handle any merge conflicts or changes required, and add a succinct update to the Changelog, bump appropriate version level (no unreleased). Date is 2025-03-29

Copilot AI and others added 3 commits March 29, 2026 16:48
…ech-debt-dHxO5

Co-authored-by: Brad-Edwards <56809295+Brad-Edwards@users.noreply.github.com>
Agent-Logs-Url: https://github.com/KeplerOps/Ground-Control/sessions/45c73c68-05a2-4a4b-b12e-0a7f96e87cb7

Co-authored-by: Brad-Edwards <56809295+Brad-Edwards@users.noreply.github.com>
Agent-Logs-Url: https://github.com/KeplerOps/Ground-Control/sessions/45c73c68-05a2-4a4b-b12e-0a7f96e87cb7

Co-authored-by: Brad-Edwards <56809295+Brad-Edwards@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 29, 2026

@copilot Merge dev then assess whether this work is still useful. If so, handle any merge conflicts or changes required, and add a succinct update to the Changelog, bump appropriate version le...

Merged dev, reassessed the work, and kept it with updates for the current model: Requirement equality is now project-scoped and case-insensitive to match the merged UID rules, relation/link equality now follows requirement natural keys for transient objects, and I added a succinct 0.92.1 changelog entry dated 2025-03-29 plus a patch version bump in 142979d (follow-up test coverage in d739d2c).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkstyle.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.24.3/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.24.3/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.24.3/x64/codeql/xml/tools/xml-extractor.jar --fileList=/tmp/codeql-scratch-8ecf1384f2e090f5/dbs/java/working/files-to-index15794720402926501801.list --sourceArchiveDir=/tmp/codeql-scratch-8ecf1384f2e090f5/dbs/java/src --outputDir=/tmp/codeql-scratch-8ecf1384f2e090f5/dbs/java/trap/java git /home/REDACTED/.config/composer/vendor/bin/git ffResponse.java --global bash git show�� om/keplerops/groundcontrol/domain/qualitygates/service/QualityGateResult.java git /snap/bin/git est.java --global 4/bin/java git (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

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