Skip to content

[Duplicate] 132 feature/128 knowledge checks#142

Open
Tanzkalmar35 wants to merge 92 commits into
devfrom
revert-132-feature/128-knowledge-checks
Open

[Duplicate] 132 feature/128 knowledge checks#142
Tanzkalmar35 wants to merge 92 commits into
devfrom
revert-132-feature/128-knowledge-checks

Conversation

@Tanzkalmar35

Copy link
Copy Markdown
Collaborator

Important

Duplicate of #131

Related issue

#93 (backend)

Short Summary

Fügt phasen-basierte Knowledge Checks zum Onboarding hinzu — pro Phase ein Quiz, das zum Weiterkommen bestanden werden muss.

  • Neue Entities: PhaseCheckQuestion/Option/Attempt/Answer/ReviewItem (+ OnboardingPhase erweitert)
  • User: GET/POST /me/phases/{phaseId}/checks(/attempts), GET /users/{userId}/phases/{phaseId}/checks/attempts
  • Authoring: GET/PUT /phases/{phaseId}/checks
  • Bestehen bei 80 %; AI-Grading offener Antworten via PhaseCheckAiClient
  • Carry-over-Review nicht bestandener Items; Phasen-Freischaltung über PhaseUnlockReason

Checks

  • I verified the code makes sense intuitively
  • The PR changes affect only this issue, no unrelated/unwanted code changes to other modules/code segments
  • CI runs (./gradlew clean build, keycloack)
  • New business logic is unit tested, including WebMvcTest for api controllers
  • The new functionality is tested manually

Additional notes

  • Tests: PhaseCheckControllerTest (WebMvc), PhaseCheckServiceTest, AiPathMapperTest
  • Abhängigkeit: AI-Service muss den Grading-Endpoint bereitstellen

VladyslavHandzha and others added 30 commits July 4, 2026 22:28
New loosely-coupled `insights` module surfacing recurring-question groups
for project managers, backed by a rebuildable cache of AI-computed clusters.

- Entities FaqGroup/FaqQuestion/FaqDocument (UUID ids, cascade + orphanRemoval)
  with FaqGroupRepository; tables via ddl-auto.
- InsightsAiClient: outbound pull to AI service POST /api/v1/insights/faq/group
  (mirrors ChatAiClient); AI owns clustering + PII redaction.
- InsightsFaqService: cached reads (readOnly tx); refresh replaces the cache
  from the AI result. Mappers AI->entity and entity->response DTOs.
- InsightsFaqController (PM/ADMIN only):
    GET  /api/v1/insights/faq            overview, sorted by frequency
    GET  /api/v1/insights/faq/{groupId}  detail (404 if missing)
    POST /api/v1/insights/faq/refresh    trigger AI grouping, rebuild cache
- Response DTOs match the frontend contract; document id exposes the upstream
  knowledge-base reference.
- Tests: controller slice (401/403/404/200, incl. @PreAuthorize on the
  coroutine endpoint via async dispatch) + service unit tests. detekt clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds a knowledge-gaps panel backend in the `insights` module, surfacing
components missing runbooks/ADRs for project managers, backed by a
rebuildable cache of AI-classified gaps (pull-based, uses #115).

- Entities KnowledgeGap/KnowledgeGapOwner (+ KnowledgeGapSeverity enum with
  lowercase api mapping); missingTypes as free-form strings; tables via ddl-auto.
- KnowledgeGapsAiClient: outbound pull to AI service
  POST /api/v1/insights/knowledge-gaps/detect (mirrors ChatAiClient). AI owns
  detection and sources artifacts from its own index, so no data is sent.
- KnowledgeGapsService: cached reads (readOnly tx, sorted by severity then
  related questions); refresh replaces the cache from the AI result. Mappers
  AI->entity (severity + ISO timestamp parsing) and entity->response DTOs.
- KnowledgeGapsController (PM/ADMIN only):
    GET  /api/v1/insights/knowledge-gaps            overview, most severe first
    GET  /api/v1/insights/knowledge-gaps/{gapId}    detail (404 if missing)
    POST /api/v1/insights/knowledge-gaps/refresh    trigger AI classification
- Response DTOs match the frontend contract; owner id exposes the upstream
  user reference, severity is rendered lowercase.
- Distinct class/file names from the FAQ feature to keep branch merges clean.
- Tests: controller slice (401/403/404/200, incl. @PreAuthorize on the
  coroutine endpoint via async dispatch) + service unit tests. detekt clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Aligns the FAQ backend with the AI service's /insights/faq/group endpoint
and supplies it with the questions to group.

- Add chat-module API (chat/external/ChatQuestionApi + internal impl) exposing
  all user questions; new ChatMessageRepository.findAllByRole query. Keeps the
  cross-module access explicit instead of reaching into the chat repo.
- InsightsFaqService.refreshFaqGroups now collects user questions and sends
  them in the request (the AI service is stateless).
- AiFaqGroupingRequest carries questions [{id, text}] instead of a limit.
- Drop document url everywhere and make source nullable: the AI returns only
  {id, title, source?}. Touches AiFaqDocument, FaqDocument entity,
  FaqDocumentResponse and the mappers.
- Update/extend tests (question forwarding, document mapping, chat API).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
LinseCed and others added 30 commits July 14, 2026 13:01
Resolves the ArtifactRepository query conflict (kept both branches'
additions), and fixes several git-silent merge defects surfaced by
compiling/testing the result: dev's PM->USER role relaxation on
GithubConnectorController being dropped for connectRepository/
updateRepository, a repoSnapshotRepository test mock left over from
dead code, and the binary-upload content-corruption bug (uploaded
images/PDFs were read via Files.readString(UTF_8) and corrupted on
round-trip) via a new ArtifactContentCodec shared by upload read and
artifact-content serving.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The dev merge silently kept dev's USER role for connect/update-all/update
instead of #110's deliberate PM tightening. A three-way diff against the
merge-base confirms dev never touched these lines at all (only #110 did),
so the correct merge resolution is to keep #110's PM requirement, matching
what was already fixed on #110's branch directly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
A three-way diff against the merge-base confirms dev never touched the
role on connect/update-all/update - only this branch deliberately tightened
all three from USER to PM. update-all was missed when resolving the merge
conflict on GithubUpdatesService's extraction; connect and single-repo
update were already correctly PM. Now consistent across all three.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…oints-63

#112 already contained its own resolution of the same conflicts #110 hit
against dev, so this merge mostly reconciles two independently-correct
resolutions of the same issues (cosmetic wording/formatting differences,
parameter ordering). Also fixes two duplicate-argument compile errors
(repositoryId passed twice) that git's auto-merge introduced silently
without flagging a conflict, in GithubIssuesService and
GithubPullRequestsService.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ement-endpoints-63

Feature/project management endpoints 63
…ment-fixes

Hotfix/project management fixes
…counters

- Replaced JPA `@Modifying` queries in `IngestionRunRepository` with native entity increments protected by `PESSIMISTIC_WRITE` locks (`findByIdForUpdate`), preventing the database from overwriting accurate ingestion counts with stale zero-values on transaction commit.
- Added `@EntityGraph` to eagerly fetch `artifactIdsToDeindex` before launching the asynchronous AI sync, fixing the silent `LazyInitializationException` crash in the detached background coroutine.
- Mapped 404 Not Found from the AI service to 503 Service Unavailable in `ArtifactSummaryAiClient` to correctly trigger frontend retry logic while vectors finish indexing.
The "Add project management endpoints" commit (e0e8e10) reused the
projectRoles field name for the new per-project role model and, in
doing so, dropped the field that used to carry a user's assigned
onboarding/project-catalog roles (e.g. "Backend Developer") from
GET /api/v1/admin/users and /api/v1/users/me. The underlying data and
the assign/unassign endpoints were untouched, just no longer exposed,
which crashed the frontend admin panel (undefined.map) since it still
expects that field.

Adds projectRoles back as its own field alongside the newer roles/
projectIds fields -- purely additive, nothing removed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…re-project-roles

Hotfix: restore projectRoles on GetUserResponse
Connecting a GitHub repository now requires a projectId (project
management endpoints), but the only project listing endpoint,
/api/v1/admin/projects, is ADMIN-only, while /data-ingestion (where
repos get connected) is open to PM/HR/ADMIN. Non-admin users had no
way to learn which project id to send, so every connect attempt for
them would 400.

Adds a self-service endpoint, scoped to the caller's own project
memberships (User.projects), available to any authenticated user.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
IngestionRunStatus (RUNNING/COMPLETED/PARTIAL/FAILED) only ever
reflected the local fetch-and-store stage -- it turned COMPLETED the
moment GitHub fetching finished and artifacts were saved to Postgres,
before the AI service sync even started. That sync happens afterward
in a fire-and-forget coroutine with no CoroutineExceptionHandler, so a
failure there vanished silently: no logging, no link back to the run,
and the run stayed "COMPLETED" forever regardless of whether the AI
service ever actually indexed anything.

Adds AiSyncStatus (NOT_APPLICABLE/PENDING/SUCCEEDED/FAILED) as its own
field on IngestionRun, set to PENDING when a run finishes locally and
resolved to SUCCEEDED/FAILED once the AI sync listener actually
completes or throws. IngestionEventListener now catches and records
the outcome instead of letting it disappear, and RunArtifactsIngestionService
logs when a sync is dispatched and confirmed. Exposed on
IngestionRunResponse for API consumers.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ndpoint

Fix non-admin project access and silent AI-sync failures on ingestion runs
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.

7 participants