Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,10 @@ test-unit: # Run unit tests
@printf "${GREEN}DONE${RESET}\n\n"

${call coverage-report}

test-integration: # Run integration tests
@printf "Running integration tests for ${CYAN}backends/ent${RESET}...\n"
@go test -failfast -v -tags=integration -coverprofile=coverage.out -covermode=atomic ./backends/ent/...
@printf "${GREEN}DONE${RESET}\n\n"

${call coverage-report}
Comment on lines +59 to +64
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.

  • Use .PHONY since test-integration isn't a real file
  • nit: ensure file contains a single trailing newline
Suggested change
test-integration: # Run integration tests
@printf "Running integration tests for ${CYAN}backends/ent${RESET}...\n"
@go test -failfast -v -tags=integration -coverprofile=coverage.out -covermode=atomic ./backends/ent/...
@printf "${GREEN}DONE${RESET}\n\n"
${call coverage-report}
.PHONY: test-integration
test-integration: # Run integration tests
@printf "Running integration tests for ${CYAN}backends/ent${RESET}...\n"
@go test -failfast -v -tags=integration -coverprofile=coverage.out -covermode=atomic ./backends/ent/...
@printf "${GREEN}DONE${RESET}\n\n"
${call coverage-report}

19 changes: 5 additions & 14 deletions backends/ent/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (backend *Backend) AddNodeAnnotations(nodeID, name string, values ...string
Where(node.NativeIDEQ(nodeID)).
All(backend.ctx)
if err != nil {
return fmt.Errorf("querying documents: %w", err)
return fmt.Errorf("querying nodes: %w", err)
}

for idx := range nodes {
Expand Down Expand Up @@ -452,20 +452,11 @@ func (backend *Backend) SetNodeUniqueAnnotation(nodeID, name, value string) erro
annotations := ent.Annotations{}

for idx := range nodes {
documentID, err := nodes[idx].
QueryNodeLists().
QueryDocuments().
OnlyID(backend.ctx)
if err != nil {
return fmt.Errorf("querying node edges for document ID: %w", err)
}

annotations = append(annotations, &ent.Annotation{
DocumentID: &documentID,
NodeID: &nodes[idx].ID,
Name: name,
Value: value,
IsUnique: true,
NodeID: &nodes[idx].ID,
Name: name,
Value: value,
IsUnique: true,
Comment on lines 455 to +459
Copy link
Copy Markdown
Author

@mrsufgi mrsufgi Aug 13, 2025

Choose a reason for hiding this comment

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

In Hooks, we never allowed setting both NodeID and DocumentID; they are mutually exclusive. This fixes it.

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.

Great catch!

})
}

Expand Down
Loading