Skip to content

Development: Port new gender contracts - #2638

Open
ge94zec wants to merge 144 commits into
mainfrom
feat/2637-port-new-gender-contracts
Open

Development: Port new gender contracts#2638
ge94zec wants to merge 144 commits into
mainfrom
feat/2637-port-new-gender-contracts

Conversation

@ge94zec

@ge94zec ge94zec commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Checklist

General

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the client coding and design guidelines.

Motivation and Context

This PR ports the Gender Decoder integration to the new BiasedIssue / JobAnalysisDTO contracts ahead of the dependent PRs being merged, so the required compatibility changes are already prepared and don’t block on merge order.
Fixes: #2637 resulting from #2630 and #2465 will collide head-on.

Description

The editor no longer subscribes to GenderBiasAnalysisService.getAnalysisForField(). It receives findings through a new biasedAnalysis input instead, so the removed endpoint is no longer referenced from the atom. toObservable, fieldIdChanges$ and the service injection are gone; genderBiasHighlights now derives from the input.

Contract migration

  • GenderBiasAnalysisResponse / BiasedWordDTOBiasedIssueDTO
  • coding string values ('non-inclusive-coded', 'inclusive-coded') →
    computeCodingStatus() returning 'NON_INCLUSIVE' / 'INCLUSIVE' / 'NEUTRAL'
  • type: 'non-inclusive'BiasedIssueDTOTypeEnum.NON_INCLUSIVE
  • ComplianceIssueComplianceIssueDTO in the assistant card and filter types

Prerequisites:

  1. Log in to DocApply
  2. Nav to Create position
  3. Type a description containing non-inclusive wording, the pill count and the balance pointer update, and the wording is underlined in the editor
  4. Select the Gender Decoder filter; only gender-bias highlights remain visible
  5. Save and reload, the persisted description contains no highlight spans

Review Progress

Code Review

  • Code Review 1

Manual Tests

  • Test 1

Screenshots

Test Coverage

Client

Class/File Line Coverage Lines Expects Ratio
job-creation-form.component.ts 0.00% 1317 103 7.8
editor.component.ts 77.19% 382 29 7.6
ai-assistant-card.component.ts 90.76% 139 11 7.9
gender-bias-analysis.utils.ts 100.00% 19 2 10.5

Last updated: 2026-08-24 16:13:20 UTC

ge94zec and others added 30 commits April 19, 2026 20:11
…or-not-shown' into bugfix/2321-title-compliance-error-not-shown
…or-not-shown' into bugfix/2321-title-compliance-error-not-shown
prettier
fix naming
update openapi
…egories-in-sidebar' into feat/2345-add-new-compliance-categories-in-sidebar
fix namings
…egories-in-sidebar' into feat/2345-add-new-compliance-categories-in-sidebar
ge94zec and others added 3 commits August 22, 2026 10:56
…sive-api-requests-triggering-genderdecoder

# Conflicts:
#	src/main/java/de/tum/cit/aet/ai/service/AiService.java
#	src/main/java/de/tum/cit/aet/ai/web/AiResource.java
#	src/main/java/de/tum/cit/aet/job/service/JobService.java
#	src/main/webapp/app/generated/api/ai-resource-api.ts
#	src/main/webapp/app/job/job-creation-form/job-creation-form.component.ts
#	src/test/java/de/tum/cit/aet/ai/web/rest/AiResourceTest.java
… feat/2637-port-new-gender-contracts

# Conflicts:
#	src/main/webapp/app/job/job-creation-form/job-creation-form.component.html
#	src/main/webapp/app/job/job-creation-form/job-creation-form.component.ts
#	src/main/webapp/app/shared/components/atoms/editor/editor.component.ts
#	src/main/webapp/app/shared/components/molecules/ai-assistant-card/ai-assistant-card.component.ts
#	src/main/webapp/app/shared/gender-bias-analysis/gender-bias-analysis.ts
#	src/main/webapp/app/shared/gender-bias-analysis/gender-bias-analysis.utils.ts
#	src/test/webapp/app/shared/components/atoms/editor/editor.component.spec.ts
#	src/test/webapp/util/gender-bias-analysis.service.mock.ts
@ge94zec ge94zec linked an issue Aug 22, 2026 that may be closed by this pull request
8 tasks
@github-actions github-actions Bot added server Pull requests that update Java code. (Added Automatically!) client Pull requests that update TypeScript code. (Added Automatically!) tests database job Code changes in job module. labels Aug 22, 2026
@codacy-production

codacy-production Bot commented Aug 22, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 medium · 3 minor

Alerts:
⚠ 4 issues (≤ 0 issues of at least minor severity)

Results:
4 new issues

Category Results
ErrorProne 1 medium
CodeStyle 3 minor

View in Codacy

🟢 Metrics 22 complexity

Metric Results
Complexity 22

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

- replace the removed gender-bias analysis response with BiasedIssueDTO arrays
- derive inclusive, non-inclusive, and neutral states from biased issue types
- update the editor highlights, analysis dialog, assistant card, and review count
- source gender findings and loading state from the existing job analysis workflow
- remove client-side gender-bias analysis service and test mock
- update affected component and utility tests for the new contracts
@ge94zec
ge94zec changed the base branch from main to bugfix/2379-fix-excessive-api-requests-triggering-genderdecoder August 22, 2026 10:46
@ge94zec ge94zec changed the title Feat/2637 port new gender contracts Development: Port new gender contracts Aug 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📊 Client Test Coverage Too Low

🔍 View coverage locally:

pnpm run test:ci
open build/test-results/vitest/coverage/index.html

🌐 View coverage from GitHub:
Download the "coverage-report-client" artifact from this workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 No OpenAPI or client changes needed.

@github-actions github-actions Bot removed server Pull requests that update Java code. (Added Automatically!) database job Code changes in job module. labels Aug 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🤖 No OpenAPI or client changes needed.

@ge94zec
ge94zec marked this pull request as ready for review August 22, 2026 11:00
@ge94zec
ge94zec requested a review from az108 as a code owner August 22, 2026 11:00
Base automatically changed from bugfix/2379-fix-excessive-api-requests-triggering-genderdecoder to main August 24, 2026 15:07
…nder-contracts

# Conflicts:
#	src/main/resources/config/liquibase/master.xml
#	src/main/webapp/app/job/job-creation-form/job-creation-form.component.html
#	src/main/webapp/app/job/job-creation-form/job-creation-form.component.ts
#	src/main/webapp/app/shared/components/atoms/editor/editor.component.ts
#	src/main/webapp/app/shared/components/molecules/ai-assistant-card/ai-assistant-card.component.ts
#	src/main/webapp/app/shared/gender-bias-analysis/gender-bias-analysis.utils.ts
#	src/test/webapp/app/shared/components/atoms/editor/editor.component.spec.ts
- add Unicode-aware word-boundary detection to the gender-bias analysis utility
- update EditorComponent to skip gender findings inside longer words
- test that Führung is not highlighted inside Personalführung
- test that lead is not highlighted inside misleading

@az108 az108 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is in good shape — merges cleanly (git merge-tree origin/main HEAD exits 0, zero conflicts), which is worth calling out given the branch it replaces does not. One deletable file, inline.

Checks that passed

Check Result
Merge into main clean, 0 conflicts
Word-boundary fix carried over from #2630 isWordChar in the shared utils, applied at editor.component.ts:453
Empty-token guard present on both loops (compliance and gender)
Boundary guard scoped correctly gender loop only — right call, compliance snippets are multi-word phrases where it would be wrong
i18n parity 364/364 keys, genderDecoder complete in EN and DE
Test naming all new it(...) start with should
New spec gender-bias-analysis.utils.spec.ts covers trim/dedup/type-filter plus undefined and empty input

The isWordChar JSDoc is the good kind — it records why \p{L} rather than \w (umlauts, ß) and why the hyphen is excluded (mirrors deHyphenNonCodedWords server-side). That reasoning is not recoverable from the code alone, so thanks for writing it down.

One thing that improved in the port: isGenderAnalyzing is now bound as [isGenderAnalyzing]="isAnalyzing()", a plain signal, rather than the genderBiasService.isAnalyzing(...) service-method call the previous branch had in the template.

I deliberately did not flag the raw 'NON_INCLUSIVE' literal in getUniqueNonInclusiveWords — it matches computeCodingStatus in the same file, and type is a narrow 'NON_INCLUSIVE' | 'INCLUSIVE' union, so a typo would fail to compile.

Context

I have closed #2630 in favour of this PR. 11 of the 12 files here overlap with it, that branch could no longer merge after #2465 removed the API it was built on, and everything raised in review there was resolved before closing — the fixes carry forward in this branch.

xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

<changeSet id="053a_add_biased_issues_to_jobs" author="melissa">

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This whole file can go — it's a leftover from before 00000000000052_add_biased_issues_to_jobs.xml merged to main.

It is byte-identical to the merged 052, apart from the changeset id prefixes:

052a_add_biased_issues_to_jobs            ->  053a_add_biased_issues_to_jobs
052b_add_unique_constraint_biased_issues  ->  053b_add_unique_constraint_biased_issues
052c_rename_gender_bias_score_to_ai_score ->  053c_rename_gender_bias_score_to_ai_score

It is also not registered in master.xml — the diff doesn't touch that file at all — so it never runs.

Those two facts happen to cancel out into "harmless": as-is it is dead weight. But if someone later notices the missing include and "fixes" it, this would re-attempt createTable job_biased_issues and the gender_bias_score -> ai_score rename on a schema where 052 already did both. The preConditions onFail="MARK_RAN" guards would absorb it, so still no breakage — just a second changeset that does nothing. Cleanest is to delete the file rather than leave that trap.

job_biased_issues and ai_score are already on main via 052, so nothing here is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client Pull requests that update TypeScript code. (Added Automatically!) ready for review tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port new gender contracts

2 participants