feat(server): INGEST_WING_RESOLVE=1 wires the wing resolver into the watcher (#205 S3)
Off by default (retired layout unchanged). On: eligibility from classification.yaml, local ingest LLM as classifier, BM25 as cross-check, INGEST_WING_THRESHOLD (default 0.9, rejected outside [0,1]). Build failure is fatal when explicitly enabled. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,7 @@ import (
|
||||
"github.com/mathiasbq/hyperguild/ingestion/internal/vectorstore"
|
||||
"github.com/mathiasbq/hyperguild/ingestion/internal/watcher"
|
||||
"github.com/mathiasbq/hyperguild/ingestion/internal/webhook"
|
||||
"github.com/mathiasbq/hyperguild/ingestion/internal/wing"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
@@ -144,6 +145,17 @@ func envInt(key string, fallback int) int {
|
||||
return fallback
|
||||
}
|
||||
|
||||
// envFloat reads a confidence-style value in [0,1]. Anything unparseable or
|
||||
// outside the range falls back: a threshold of 0 would auto-place everything.
|
||||
func envFloat(key string, fallback float64) float64 {
|
||||
if v := os.Getenv(key); v != "" {
|
||||
if f, err := strconv.ParseFloat(v, 64); err == nil && f >= 0 && f <= 1 {
|
||||
return f
|
||||
}
|
||||
}
|
||||
return fallback
|
||||
}
|
||||
|
||||
// buildNotifier returns the ntfy notifier, or a nil interface when
|
||||
// BRAIN_NTFY_URL is unset. A nil *interface* (not a typed-nil) is required so
|
||||
// DegradingSink/Reconcile and the governance observer skip it cleanly.
|
||||
@@ -389,10 +401,26 @@ func main() {
|
||||
}
|
||||
|
||||
if watchInterval > 0 {
|
||||
// INGEST_WING_RESOLVE=1 routes raw/ notes into wiki/<wing>/ by
|
||||
// subfolder, frontmatter or classifier+scorer, and parks the rest in
|
||||
// raw/needs-review/ (hyperguild#205). Off = the retired layout. Set
|
||||
// explicitly, a failure to build the resolver is fatal: silently
|
||||
// falling back would write into the layout this flag exists to leave.
|
||||
var wingResolver *wing.Resolver
|
||||
if os.Getenv("INGEST_WING_RESOLVE") == "1" {
|
||||
var rerr error
|
||||
wingResolver, rerr = wing.NewConfiguredResolver(brainDir, llmClient.Complete, envFloat("INGEST_WING_THRESHOLD", 0.9))
|
||||
if rerr != nil {
|
||||
logger.Error("build wing resolver", "err", rerr)
|
||||
os.Exit(1)
|
||||
}
|
||||
logger.Info("wing resolver enabled", "wings", len(wingResolver.Known), "threshold", wingResolver.Threshold)
|
||||
}
|
||||
watcher.Start(ctx, watcher.Config{
|
||||
BrainDir: brainDir,
|
||||
Interval: time.Duration(watchInterval) * time.Second,
|
||||
Pipeline: pipelineCfg,
|
||||
Resolver: wingResolver,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user