[Duplicate] Feature/194 insights knowledge gaps#144
Merged
Conversation
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>
- AI response now carries presentTypes and drops owners/relatedQuestions, matching the AI /insights/knowledge-gaps/detect endpoint (owners are the backend's to enrich; the index holds no question history). - Entity: add presentTypes, remove relatedQuestions and the KnowledgeGapOwner relationship/entity; sort by severity then component. - Response DTO: add presentTypes, drop relatedQuestions; owners kept but empty until component ownership is assigned. - Update mapper, service and tests accordingly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Lets PMs assign owners to a component (owner/repo) and surfaces them on the knowledge-gaps panel, independent of the AI classification cache. - ComponentOwner entity + repository (component -> userId). - Resolve owners at read time: match a gap's component to the ownership mapping and resolve users via the user module (UserApi); the owner's role is derived from the user's first project role. Refresh leaves ownership intact. - Endpoints (PM/Admin): GET/PUT /insights/knowledge-gaps/component-owners. - Owner DTO exposes the project role instead of a non-existent working area. - Tests for owner enrichment, set, and the new endpoints. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…s (#194) - Response now carries lastIngested (renamed from lastUpdated), firstIngested and refreshedAt so the UI can distinguish "first/last ingested" from "last analyzed". - Add a read-only ingestion-module API (ArtifactIngestionApi) resolving a component's first-ingested time as MIN(ingestedAt) over its artifacts; the timestamp is stable across re-ingestion. Purely additive, no change to the ingestion write path. - Resolve firstIngested per component in the service; update mapper and tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
After merging dev, UserDto gained a required profileIcon field. The buildUser helper in KnowledgeGapsServiceTest constructed a UserDto without it, breaking compileTestKotlin on the PR merge. Pass profileIcon = null. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
revert of Fabian change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Duplicate of #116
Related issue
#66
Short summary
Adds a knowledge-gaps panel backend in the insights module for project
managers: it surfaces components that are missing critical documentation
(runbooks/ADRs), ranked by severity, backed by a rebuildable cache of AI-classified
gaps.
KnowledgeGap(+KnowledgeGapSeverityenum with lowercase apimapping);
missingTypes/presentTypesas free-form strings; tables via ddl-auto.KnowledgeGapsAiClient: outbound pull to the AI servicePOST /api/v1/insights/knowledge-gaps/detect(mirrorsChatAiClient). The AIowns detection and sources artifacts from its own index, so no data is sent.
KnowledgeGapsService: cached reads (read-only tx, sorted by severity thencomponent/related items); refresh replaces the cache from the AI result.
KnowledgeGapsController(PM/ADMIN only):GET /api/v1/insights/knowledge-gaps— overview, most severe firstGET /api/v1/insights/knowledge-gaps/{gapId}— detail (404 if missing)POST /api/v1/insights/knowledge-gaps/refresh— trigger AI classificationmapping and users resolved via the user module (UserApi); the owner's role is
derived from the user's first project role. Refresh leaves ownership intact.
firstIngested and refreshedAt, so the UI can distinguish "first/last
ingested" from "last analyzed".
component's first-ingested time as MIN(ingestedAt) over its artifacts
(stable across re-ingestion). Purely additive — no change to the ingestion
write path.
Checks
Additional notes
(UserApi, new ArtifactIngestionApi) — no direct repository access across
modules. The insights module stays loosely coupled.
caches the result; the cache is fully rebuildable via the refresh endpoint, and
component ownership survives refreshes.
reference and the owner DTO surfaces the project role.
@PreAuthorize on the coroutine endpoint via async dispatch) plus service unit
tests for detection caching, owner enrichment/set, and timestamp resolution.
detekt clean.
KnowledgeGapsAiException.
FAQ feature (#181).