Stage generation without a real document must not panic or enter the ledger. Unknown orphan IDs are denied, write paths check author/lease/lifecycle, PATCH no longer returns a fake 200, and overlay matching survives client/server block id drift. Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
862 B
Go
30 lines
862 B
Go
package docrevision_test
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"testing"
|
|
|
|
"chat-agent-system/internal/docrevision"
|
|
)
|
|
|
|
func TestGetRevisionState_EmptyDocID(t *testing.T) {
|
|
svc := docrevision.NewService(nil)
|
|
_, err := svc.GetRevisionState(context.Background(), "")
|
|
if !errors.Is(err, docrevision.ErrInvalidDocID) {
|
|
t.Fatalf("empty docID want ErrInvalidDocID, got %v", err)
|
|
}
|
|
_, err = svc.GetRevisionState(context.Background(), " ")
|
|
if !errors.Is(err, docrevision.ErrInvalidDocID) {
|
|
t.Fatalf("blank docID want ErrInvalidDocID, got %v", err)
|
|
}
|
|
}
|
|
|
|
func TestCommitAgentVersion_EmptyDocID(t *testing.T) {
|
|
svc := docrevision.NewService(nil)
|
|
_, err := svc.CommitAgentVersion(context.Background(), "", 1, docrevision.CommitAgentDecision{Decision: "commit"})
|
|
if !errors.Is(err, docrevision.ErrInvalidDocID) {
|
|
t.Fatalf("want ErrInvalidDocID, got %v", err)
|
|
}
|
|
}
|