Skip to content

Comments

Fix PUT/POST responses returning zero for count fields#23

Merged
awagner-mainz merged 3 commits intomainfrom
copilot/fix-embedding-count-issue
Feb 13, 2026
Merged

Fix PUT/POST responses returning zero for count fields#23
awagner-mainz merged 3 commits intomainfrom
copilot/fix-embedding-count-issue

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

PUT/POST requests for projects returned number_of_embeddings: 0 even when embeddings existed, while subsequent GET requests returned the correct count. Same issue occurred with number_of_instances in LLM service definition responses.

Changes

Projects (internal/handlers/projects.go)

  • Added CountEmbeddingsByProject query before building PUT/POST response
  • Applies to both putProjectFunc and postProjectFunc (delegates to PUT)

LLM Service Definitions (internal/handlers/llm_services.go)

  • Added CountInstancesByDefinition query before building PUT response
  • Same pattern as projects fix

Test Coverage (internal/handlers/projects_put_with_embeddings_test.go)

  • Added integration test validating PUT returns correct embedding count
  • Verifies GET/PUT response consistency

Example

PUT /v1/projects/alice/my-project
{
  "project_handle": "my-project",
  "description": "Updated description"
}

Before: {"number_of_embeddings": 0, ...}
After:  {"number_of_embeddings": 176942, ...}

The response now queries the database for actual counts rather than defaulting to zero, matching GET behavior.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 13, 2026 19:51
Co-authored-by: awagner-mainz <2088443+awagner-mainz@users.noreply.github.com>
Co-authored-by: awagner-mainz <2088443+awagner-mainz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix incorrect embedding count in upsert operation Fix PUT/POST responses returning zero for count fields Feb 13, 2026
Copilot AI requested a review from awagner-mainz February 13, 2026 19:56
Copy link
Contributor

@awagner-mainz awagner-mainz left a comment

Choose a reason for hiding this comment

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

Looks good.

@awagner-mainz awagner-mainz marked this pull request as ready for review February 13, 2026 20:53
@awagner-mainz awagner-mainz merged commit ea292b7 into main Feb 13, 2026
1 check passed
@awagner-mainz awagner-mainz deleted the copilot/fix-embedding-count-issue branch February 13, 2026 20:53
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.

2 participants