Skip to content

General: Align compliance rules and stabilize generation workflow - #2631

Open
ge94zec wants to merge 13 commits into
mainfrom
chore/2535-modularize-compliance-rules-across-prompts
Open

General: Align compliance rules and stabilize generation workflow#2631
ge94zec wants to merge 13 commits into
mainfrom
chore/2535-modularize-compliance-rules-across-prompts

Conversation

@ge94zec

@ge94zec ge94zec commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Checklist

General

Server

Motivation and Context

Translation, compliance analysis, and generation requests could overlap and finish out of order. A stale analysis or translation could then update the UI or the persisted job state after a newer generation had already completed, most visibly in the compliance score, which could briefly show the value belonging to an olderjob description.

The root cause on the server was that compliance analysis used a blocking.call(), which could not be cancelled once started; on the client, nothing invalidated callbacks belonging to superseded runs.

Description

Overall, these changes make the Generate → Translate → Analyze → Score workflow more deterministic. New generations take priority over outdated background work, stale results are discarded, and the displayed compliance score now corresponds to the latest analyzed version of the job description.

  • New AiPriorityService with foreground(jobId, flux) / background(jobId, flux),
    scoped per job. Generation is foreground; translation and compliance analysis are
    background. Starting a generation cancels ongoing background work for the same job.
  • Compliance analysis moved from .call() to .stream() so it can actually be
    cancelled mid-flight; the response is reassembled and parsed via BeanOutputConverter.
  • AbortController for generation, takeUntil for the analysis request.
  • POST /ai/jobs/analyze now returns JobAnalysisDTO (score + issues) instead of
    ComplianceIssue[]. Regenerate the API client.
  • translateTextStream takes an additional jobId.
  • updated prompt rules for compliance policy

Steps for Testing

Prerequisites:

  1. Log in to TUMApply as Prof
  2. Nav to Create position
  3. Verify generateDraft generates compliance free model text

Review Progress

Code Review

  • Code Review 1

Manual Tests

  • Test 1

Screenshots

Test Coverage

Client

Class/File Line Coverage Lines Expects Ratio
ai-run.ts 100.00% 14 ? ?
job-creation-form.component.ts 75.03% 1286 106 8.2
ai-streaming.service.ts 88.63% 88 17 19.3
editor.component.ts 51.73% 386 28 7.3

Server

Class/File Line Coverage Lines
ComplianceIssueDTO.java 100.00% 27
JobAnalysisDTO.java 100.00% 10
TranslateComplianceDTO.java 100.00% 8
AiPriorityService.java 8.33% 48
AiService.java 8.00% 356
AiResource.java 48.00% 93
JobService.java 75.77% 372

Last updated: 2026-08-17 09:25:44 UTC

@github-actions github-actions Bot added server Pull requests that update Java code. (Added Automatically!) client Pull requests that update TypeScript code. (Added Automatically!) labels Aug 4, 2026
@codacy-production

codacy-production Bot commented Aug 4, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 high · 3 medium

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

Results:
4 new issues

Category Results
UnusedCode 1 medium
ErrorProne 1 medium
Security 1 high
Complexity 1 medium

View in Codacy

🟢 Metrics 32 complexity

Metric Results
Complexity 32

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.

@github-actions

github-actions Bot commented Aug 4, 2026

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.

@ge94zec ge94zec changed the title Chore/2535 modularize compliance rules across prompts General: Modularize compliance rules Aug 10, 2026
@ge94zec ge94zec changed the title General: Modularize compliance rules General: Modularize compliance rules Aug 10, 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.

@ge94zec ge94zec changed the title General: Modularize compliance rules General: Update compliance rules in generation Aug 10, 2026
…-rules-across-prompts' into chore/2535-modularize-compliance-rules-across-prompts
@github-actions

Copy link
Copy Markdown
Contributor

🤖 No OpenAPI or client changes needed.

- add AiRun to centralize AbortController ownership and stale workflow detection
- cancel active analysis and translation requests before starting generation -> prioritize generation
- scope backend AI cancellation by job ID to avoid affecting other jobs or users
- pass the job ID through generation and translation requests
- return analysis score and compliance issues directly through JobAnalysisDTO
- prevent persistence entities from leaking through the analysis API
- add a dedicated streaming editor update method
- remove redundant frontend score polling and additional job reloads
- remove redundant analyze rules in AnalyzeComplianceText.st
- add tests for cancellation, streaming, and editor behavior
@github-actions github-actions Bot added tests job Code changes in job module. labels Aug 11, 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

🤖 OpenAPI spec and client code auto-updated and committed.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 No OpenAPI or client changes needed.

@ge94zec
ge94zec marked this pull request as ready for review August 11, 2026 22:18
@ge94zec
ge94zec requested a review from az108 as a code owner August 11, 2026 22:18
@ge94zec ge94zec changed the title General: Update compliance rules in generation General: Align compliance rules and stabilize generation workflo Aug 11, 2026
@ge94zec ge94zec changed the title General: Align compliance rules and stabilize generation workflo General: Align compliance rules and stabilize generation workflow Aug 11, 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.

@helios-aet
helios-aet Bot deployed to test-server August 17, 2026 11:33 Active
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.

1 participant