Skip to content

Development: Add compliance text highlighting client side#2306

Merged
az108 merged 46 commits intomainfrom
feat/2064-add-compliance-client-side
Apr 19, 2026
Merged

Development: Add compliance text highlighting client side#2306
az108 merged 46 commits intomainfrom
feat/2064-add-compliance-client-side

Conversation

@ge94zec
Copy link
Copy Markdown
Contributor

@ge94zec ge94zec commented Apr 15, 2026

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 principle of data economy for all client-server REST calls.
  • I strictly followed the client coding and design guidelines.
  • I added multiple integration tests (Vitest) related to the features (with a high test coverage), while following the client test guidelines.
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.

Motivation and Context

This PR introduces client-side compliance text highlighting for job descriptions. The goal is to make detected compliance issues immediately visible and understandable to users while editing job postings.

Closes: #2064

Description

Server-side: Compliance issues are extended with a language attribute to correctly associate issues with job descriptions across language switches. The database schema (Liquibase), ComplianceIssue DTO, and AiService were updated accordingly. The AI service now explicitly assigns the detected language to each compliance issue after analysis.

Client-side: The job creation form introduces a complianceIssues signal to manage compliance issues for both languages independently. Issues are filtered by the active editor language and dynamically applied as highlights. A highlightEffect ensures highlights are applied whenever the language switches or new issues arrive.
A custom Quill blot (HighlightBlot) renders highlighted text spans using Tailwind utility classes, visually distinguishing critical AGG violations and transparency issues via different colors.

TranslateText.st was updated to return only the translated text, ensuring compliance and gender bias issues introduced during manual editing are preserved and not silently corrected by the translation.

Fixed a bug where a score of 0 was not displayed due to an early return in the animation effect when animatedScore was undefined but targetScore was 0.

Steps for Testing

Prerequisites:

  1. Log in to TUMApply
  2. Navigate to Create new Position
  3. Check if non compliant text phrases get highlighted

Review Progress

Code Review

  • Code Review 1

Manual Tests

  • Test 1

Screenshots

Bildschirmfoto 2026-04-18 um 00 20 16 Bildschirmfoto 2026-04-18 um 00 16 29 Bildschirmfoto 2026-04-18 um 00 16 23

Test Coverage

Client

Class/File Line Coverage Lines Expects Ratio
job-creation-form.component.ts 62.95% 1092 124 11.4
ai-score-ring.component.ts 88.67% 73 3 4.1
editor.component.ts 80.79% 306 56 18.3

Server

Class/File Line Coverage Lines
ComplianceIssue.java 0.00% 26
AiService.java 8.70% 224
ComplianceScoreService.java 85.71% 81
AiResource.java 50.00% 70
Job.java 100.00% 81
JobDTO.java 100.00% 33
JobFormDTO.java 95.45% 61
JobService.java 78.33% 310

Last updated: 2026-04-19 14:53:25 UTC

ge94zec and others added 30 commits March 17, 2026 13:18
added endpoint for compliance
added ComplianceIssueDTO for later on highlighting
added ComplianceIssueDTO[]
…side' into feat/2063-add-compliance-server-side
- refactored prompt
- moved enum to constants
- changed endpoint to POST temporary
- removed unused imports
…nce-server-side

# Conflicts:
#	openapi/openapi.yaml
#	src/main/java/de/tum/cit/aet/ai/service/AiService.java
#	src/main/java/de/tum/cit/aet/ai/web/AiResource.java
#	src/main/webapp/app/generated/.openapi-generator/FILES
#	src/main/webapp/app/generated/api/aiResourceApi.service.ts
#	src/main/webapp/app/generated/model/models.ts
…ith dual-language support

- Move score calculation from frontend to backend (AiService) to persist across navigation
- Add genderBiasScore and complianceAnalysis fields to Job entity with Liquibase migration
- Calculate combined inclusivity score as average of DE and EN gender bias analyses
- Strip HTML tags via Jsoup before analysis to fix zero-score bug
- Adjust autosave timer to prevent premature translation triggering to 5s debounce
- Read persisted score from JobDTO/JobFormDTO instead of recomputing on frontend
- Fix AiScoreRingComponent animation to only animate on first render or actual score change
- Add TranslateComplianceDTO wrapper to avoid multiple @RequestBody parameters
- Update analyzeCurrentJobDescription and translateAndPersistJobDescription to use plain text
- added sanitization -> write + read in Job-Description
- adjusted tests
…side' into feat/2063-add-compliance-server-side

# Conflicts:
#	openapi/openapi.yaml
#	src/main/webapp/app/generated/api/ai-resource-api.ts
# Conflicts:
#	openapi/openapi.yaml
#	src/main/java/de/tum/cit/aet/ai/service/AiService.java
#	src/main/java/de/tum/cit/aet/job/dto/JobFormDTO.java
#	src/main/java/de/tum/cit/aet/job/service/JobService.java
#	src/main/resources/config/liquibase/master.xml
#	src/main/webapp/app/generated/model/job.ts
…side' into feat/2063-add-compliance-server-side
…side' into feat/2063-add-compliance-server-side
…side' into feat/2063-add-compliance-server-side
-added server tests
-prettier
@ge94zec ge94zec requested a review from az108 as a code owner April 17, 2026 22:39
Copy link
Copy Markdown
Contributor

@Cathy0123456789 Cathy0123456789 left a comment

Choose a reason for hiding this comment

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

Thank you, small comments

Comment thread src/main/java/de/tum/cit/aet/ai/service/AiService.java Outdated
Comment thread src/main/java/de/tum/cit/aet/ai/service/AiService.java Outdated
Comment thread src/main/resources/prompts/TranslateText.st Outdated
@ge94zec ge94zec requested a review from Cathy0123456789 April 18, 2026 09:26
@github-actions
Copy link
Copy Markdown
Contributor

🤖 No OpenAPI or client changes needed.

Copy link
Copy Markdown
Contributor

@CelineLahnor CelineLahnor left a comment

Choose a reason for hiding this comment

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

Thank you code looks already good to me I just left some small questions in the code :)

Comment thread src/main/webapp/app/shared/components/atoms/editor/editor.component.ts Outdated
Comment thread src/main/webapp/app/job/job-creation-form/job-creation-form.component.ts Outdated
Comment thread src/main/webapp/app/shared/components/atoms/editor/editor.component.ts Outdated
@CelineLahnor
Copy link
Copy Markdown
Contributor

CelineLahnor commented Apr 18, 2026

Can you please create a follow-up issue to add the missing test coverage introduced by this PR, so it does not get forgotten?

Copy link
Copy Markdown
Contributor

@Cathy0123456789 Cathy0123456789 left a comment

Choose a reason for hiding this comment

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

Thank you, small questions

Comment thread src/main/resources/prompts/AnalyzeComplianceText.st Outdated
Comment thread src/main/resources/prompts/TranslateText.st Outdated
Comment thread src/main/java/de/tum/cit/aet/ai/domain/ComplianceIssue.java
Comment thread src/main/resources/prompts/AnalyzeComplianceText.st Outdated
Comment thread src/main/webapp/app/shared/components/atoms/editor/editor.component.ts Outdated
Comment thread src/main/webapp/app/job/job-creation-form/job-creation-form.component.ts Outdated
Comment thread src/main/webapp/app/job/job-creation-form/job-creation-form.component.ts Outdated
Comment thread src/main/webapp/app/job/job-creation-form/job-creation-form.component.ts Outdated
Comment thread src/main/webapp/app/job/job-creation-form/job-creation-form.component.ts Outdated
Comment thread src/main/webapp/app/job/job-creation-form/job-creation-form.component.ts Outdated
ge94zec added 2 commits April 19, 2026 15:12
- split HighlightBlot into criticalClasses and warningClasses
- moved color-mix into _tokens.scss
- updated highlightTexts()
- updated applyHighlights()
- added Promise.all for analyzeAndUpdateScore()
- added onComplete callback to forceUpdate()
@github-actions github-actions bot added the job Code changes in job module. label Apr 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🤖 No OpenAPI or client changes needed.

@github-actions
Copy link
Copy Markdown
Contributor

🤖 No OpenAPI or client changes needed.

@github-actions
Copy link
Copy Markdown
Contributor

🤖 No OpenAPI or client changes needed.

@github-actions
Copy link
Copy Markdown
Contributor

🤖 No OpenAPI or client changes needed.

Copy link
Copy Markdown
Contributor

@Cathy0123456789 Cathy0123456789 left a comment

Choose a reason for hiding this comment

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

Code LGTM, not tested though

Copy link
Copy Markdown
Collaborator

@az108 az108 left a comment

Choose a reason for hiding this comment

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

Code + Tested Locally 👍

@az108 az108 merged commit 5f3536b into main Apr 19, 2026
16 of 17 checks passed
@az108 az108 deleted the feat/2064-add-compliance-client-side branch April 19, 2026 15:16
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!) job Code changes in job module. ready for review server Pull requests that update Java code. (Added Automatically!) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add compliance client-side

4 participants