Merged in feature/remove-mocks (pull request #202)

Feature/remove mocks

* remove mocks

* cleanup db migrations
This commit is contained in:
Jay Brown
2026-01-15 20:39:32 +00:00
parent 0ddae4f91e
commit 35d72fccbe
244 changed files with 2573 additions and 50860 deletions
+34 -46
View File
@@ -1,67 +1,55 @@
// **Listens For**: Body Containing Document ID
//
// **Action**.
//
// If the document text is not already extracted according to the collector standards, trigger the textract job for text detection.
//
// This is the terminal step in the document processing pipeline.
// Query processing has been removed - pipeline ends after text extraction.
// DEPRECATED: This runner is deprecated and no longer has any functionality.
// It is left in place until deployment code is updated accordingly.
// See remove_texttract_and_mocks_plan.md for details.
package main
import (
"context"
"log/slog"
"net/http"
"os"
"os/signal"
"syscall"
"time"
doctextrunner "queryorchestration/api/docTextRunner"
documenttext "queryorchestration/internal/document/text"
"queryorchestration/internal/server/runner"
"queryorchestration/internal/serviceconfig/build"
"queryorchestration/internal/serviceconfig/objectstore"
"queryorchestration/internal/serviceconfig/textract"
_ "github.com/lib/pq"
)
type DocTextConfig struct {
runner.BaseConfig[doctextrunner.Body]
textract.TextractConfig
objectstore.ObjectStoreConfig
}
const serviceName = "docTextRunner"
func main() {
// Print version information before any environment checks
build.PrintVersionInfo("docTextRunner")
build.PrintVersionInfo(serviceName)
ctx := context.Background()
slog.Warn("DEPRECATED: " + serviceName + " is deprecated and no longer has any functionality. " +
"This service is left in place until deployment code is updated accordingly.")
cfg := &DocTextConfig{}
mux := http.NewServeMux()
mux.HandleFunc("/health", func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
})
cfg.ControllerFunc = func() runner.Controller[doctextrunner.Body] {
text := documenttext.New(cfg)
return doctextrunner.New(&doctextrunner.Services{
Text: text,
})
server := &http.Server{
Addr: ":8085",
Handler: mux,
ReadHeaderTimeout: time.Minute,
}
server, err := runner.New(ctx, cfg)
if err != nil {
slog.Error(err.Error())
os.Exit(1)
}
go func() {
slog.Info("Starting health check server on port 8085")
if err := server.ListenAndServe(); err != http.ErrServerClosed {
slog.Error("Health check server error", "error", err)
}
}()
err = cfg.SetStoreClient(ctx)
if err != nil {
slog.Error(err.Error())
os.Exit(1)
}
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
err = cfg.SetTextractClient(ctx)
if err != nil {
slog.Error(err.Error())
os.Exit(1)
}
sig := <-sigChan
slog.Info(serviceName+" received shutdown signal, exiting gracefully", "signal", sig.String())
server.Listen(ctx)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
if err := server.Shutdown(ctx); err != nil {
slog.Error("Error shutting down health check server", "error", err)
}
}