Skip to content

feat: expose new endpoints - #435

Open
olblak wants to merge 5 commits into
updatecli:mainfrom
olblak:main
Open

feat: expose new endpoints#435
olblak wants to merge 5 commits into
updatecli:mainfrom
olblak:main

Conversation

@olblak

@olblak olblak commented Aug 4, 2026

Copy link
Copy Markdown
Member
  • feat: expose endpoint with result history
  • feat: allow to filter by report result

Description

Test

To test this pull request, you can run the following commands:

make test

Additional Information

Tradeoff

Potential improvement

Signed-off-by: Olivier Vernin <olivier@vernin.me>
@olblak olblak added the enhancement New feature or request label Aug 4, 2026
Signed-off-by: Olivier Vernin <olivier@vernin.me>
@olblak olblak changed the title feat: expose endpoint with result history feat: expose new endpoints Aug 5, 2026
@olblak
olblak requested a lite review from Copilot August 5, 2026 18:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the server’s API surface to support reporting result history and filtering by pipeline result, including a new summary endpoint and related database/query enhancements.

Changes:

  • Added results filtering to report search and SCM summary queries.
  • Introduced POST /api/pipeline/reports/summary to bucket report counts by result over a configurable time window.
  • Added a migration to backfill denormalized report columns and create an index to support efficient summary aggregation; updated tests and Swagger artifacts.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/server/var.go Adds constants and new error messages for summary parameter validation.
pkg/server/scmdb_handlers.go Extends SCM search request to accept results and threads it into SCM summary retrieval.
pkg/server/report_handlers.go Adds results filter to report search and introduces the new reports summary endpoint + request/response types.
pkg/server/labeldb_handlers.go Extracts SearchLabels request struct to a named type for Swagger/schema stability.
pkg/server/endpoints.go Registers the new /api/pipeline/reports/summary route.
pkg/server/endpoints_test.go Adds comprehensive endpoint tests for reports summary and adjusts expected error response for unknown report ID.
pkg/database/time_utils.go Introduces shared time-range parsing helper and refactors range filtering logic.
pkg/database/scm.go Adds results filtering to SCM summary output (post-query).
pkg/database/report.go Adds report results filtering, SCM filter helper, and implements time-bucketed report summary query logic.
pkg/database/migrations/000010_fix_pipelineReports_denormalized_columns.up.sql Backfills pipeline_result/pipeline_name from correct JSON keys and adds composite index for summary scans.
pkg/database/migrations/000010_fix_pipelineReports_denormalized_columns.down.sql Drops the added composite index (non-destructive rollback).
pkg/database/database_test.go Adds regression tests for bucket truncation correctness and migration backfill behavior.
docs/swagger.yaml Updates Swagger spec to include new endpoints/types (but currently incomplete for new results request fields).
docs/swagger.json Updates generated Swagger JSON (but currently incomplete for new results request fields).
docs/docs.go Updates embedded Swagger template (but currently incomplete for new results request fields).
CONTRIBUTING.md Documents the new reports summary endpoint in the endpoint list.
Files not reviewed (1)
  • docs/docs.go: Generated file
Suppressed comments (1)

docs/swagger.yaml:748

  • The API schema for server.SearchSCMsRequest is missing the results field, even though the server-side request struct includes it to filter SCM summaries by pipeline result. This makes the Swagger docs incomplete for the new filter.
      labels:
        additionalProperties:
          type: string
        description: Labels filters SCM summaries by report labels.
        type: object

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +62 to +64
// applyRangeFilter applies a time range filter to the given query based on the provided
// startTime and endTime strings in RFC3339 format. If both are empty and dateRangeDays is greater than zero,
// it filters records updated within the last dateRangeDays days.
Comment thread docs/swagger.yaml
Comment on lines +695 to +699
labels:
additionalProperties:
type: string
description: Labels is a map of labels to filter reports by.
type: object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants