Repository navigation
✨ Customers: a read-only GraphQL endpoint over the customer graph - #18771
Conversation
…e profile timeline reads it PR 5 of RFC #18742. - pkg/customers/gql: the schema (no mutations, no subscriptions) and thin resolvers. Every access decision is made by customers.Service on the viewer of the request. - pkg/customers: Service.Edges, ArtefactPeople and ArtefactVisible. Without the full view only the viewer's own profile is reachable, by any path; an edge is shown only to a viewer who could open its artefact. - POST /api/graph behind the injected service; the read role may call it because it only reads. Limits: depth 8, 8 KB, page 100, 5,000 nodes, 5 s. Audited without the query text. - The profile's Activity is a timeline read from the endpoint. - New dependency github.com/graph-gophers/graphql-go v1.11.1 (BSD-2-Clause), imported only by pkg/customers/gql; NOTICE regenerated. Refs #18742 Signed-off-by: Andy Anderson <andy@clubanderson.com>
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. ℹ️ Sentinel: informational, author is trusted (owner), merge is not blocked. Head
No @clubanderson this PR is held at Failing checks:
Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path. |
…budget at every resolver The coverage gate holds pkg/customers/gql to 90%. Refs #18742 Signed-off-by: Andy Anderson <andy@clubanderson.com>
Mutation testinggremlins found 8 surviving mutant(s) in changed files: the code ran under tests, but changing it did not fail any test.
2 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the
ℹ️ 3 mutant(s) on added lines were SKIPPED because gremlins v0.6.0 only honours the first
Verdict: |
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
PR 5 of the Customers series (RFC #18742, design in
src/docs/design/customers.md). With this the first usable slice (PRs 0 to 5) is complete.What is here
POST /api/graph: GraphQL over people, the artefacts they touched and the edges between them.me,person(id),people(tag, first, after),artefact(ref);Person.edgespaged newest first;Artefact.peoplefor the walk back. No mutations, no subscriptions.pkg/customers/gql: the schema and thin resolvers. It is the only package that imports the GraphQL library.pkg/customers:Service.Edges,ArtefactPeople,ArtefactVisible.Access
The GraphQL layer decides nothing. Every resolver calls
customers.Servicewith the viewer of the request, the same service the REST routes use.TestReadOnlyCannotReachAnotherPersonByAnyPathgoes at another person by id, through the list (plain, filtered, with a cursor), through an artefact the two share, two hops out from the viewer's own edges, and through aliases and a fragment, and checks that nothing about the other person appears anywhere in any response.satisfactionandnotesare null without the full view.The route is a POST that only reads, so the read role's write gate lets exactly
POST /api/graphthrough (near-miss paths and methods are tested).Limits
Depth 8, 8 KB of query text, pages of at most 100, 5,000 nodes and 5 seconds per query. Depth, length and selection count are the library's; the node budget is charged by the resolvers. Introspection is off: the standard introspection query is deeper than the depth limit anyway, and the schema is in the API reference.
Audit:
customer_graph_querywith the operation name (letters, digits and underscores only, bounded), node count and error count. Never the query text.The library
github.com/graph-gophers/graphql-gov1.11.1, BSD-2-Clause, as planned. No fallback was needed.go mod graphfor it:Hive already requires every OpenTelemetry module at exactly these versions.
opentracing-gois imported only by the library's optionaltrace/opentracingpackage, which Hive does not import, so it does not enter the build. The whole change to the module files is one line ingo.modand the library's own two lines ingo.sum.NOTICE: I generated it with
src/scripts/generate-notice.shon macOS and committed only the newgraphql-goentry, because a macOS run also renames thegolang.org/x/sysentry to its darwin package path. Ifnotice-driftdisagrees with the placement I will take its artifact.Refs #18742
🤖 Generated with Claude Code