feat(web): add assignmentReport query (first token-decrypt path)#102
Merged
Conversation
Second Milestone-B operation: a live report over an assignment's repositories, fetched from GitLab with the caller's stored PAT. This introduces the first place in glabs-web where the sealed token is decrypted and used. - app.gitlabClientFor: the single decrypt site — GetUserSecret → Sealer.Open → gitlab.NewClient(WithHost, WithToken, WithReporter(discard)). The plaintext is handed straight to the client, never logged or returned; fails closed with a clear message when no token is stored or secrets.key is unset. - app.AssignmentReport resolves the assignment (nil for missing/abstract, like AssignmentURLs — the resolve logic is now the shared resolveAssignmentConfig) and returns report.Reports via the new gitlab.Client.ReportData. - graph: own AssignmentReport/ProjectReport/... types + assignmentReport query, resolver and mapper. The mapper projects the internal report (which carries a raw *gitlab.ProjectMember) onto display-only fields — no GitLab-internal ids, so no gqlgen models binding for the API type is needed. - tests: app error/nil paths (no token, no sealer, missing/abstract) and the report mapper. The live GitLab path stays covered by the gitlab contract tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Zweite Milestone-B-Operation: ein Live-Report über die Repositories eines Assignments, live von GitLab geholt mit dem gespeicherten PAT der Nutzenden. Hier entsteht erstmals der Token-Decrypt-Pfad in glabs-web.
Was drin ist
app.gitlabClientFor— die einzige Entschlüsselungsstelle:GetUserSecret→Sealer.Open→gitlab.NewClient(WithHost, WithToken, WithReporter(discard)). Der Klartext geht direkt an den Client, wird nie geloggt oder zurückgegeben; fail-closed mit klarer Meldung, wenn kein Token hinterlegt odersecrets.keyfehlt. Der Discard-Reporter verhindert Progress-Ausgabe auf stdout des Servers.app.AssignmentReport— löst das Assignment auf (nil bei fehlend/abstrakt, wieAssignmentURLs; die Resolve-Logik ist jetzt das geteilteresolveAssignmentConfig) und liefertreport.Reportsüber das neuegitlab.Client.ReportData(data-returning, ohne Rendering).AssignmentReport/ProjectReport/CommitReport/ProjectMemberReport/ReleaseReport/… +assignmentReport(course, name)-Query, Resolver, Mapper. Der Mapper projiziert den internen Report (der ein rohes*gitlab.ProjectMemberträgt) auf reine Anzeigefelder — keine GitLab-internen IDs, daher keinmodels:-Binding des API-Typs nötig.gitlab-Contract-Tests abgedeckt.GraphQL
Null bei fehlendem/nicht auflösbarem Assignment; Fehler, wenn kein Token hinterlegt oder GitLab nicht erreichbar.
Verifikation (lokal grün)
go build ./...,go vet ./...,go vet -tags=integration ./...,go test ./...,golangci-lint run— alle sauber;gofmtclean.Nächster Schritt: das GUI konsumiert
assignmentReport(Report-Ansicht auf der Assignment-Seite), danachcheck.🤖 Generated with Claude Code