Repository navigation
feat(extractor): move the OASF extractor to utils and unify resolution for dirctl and the gateway - #2002
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Moves OASF extraction into shared utilities and wires unified local/remote resolution into CLI import, search, routing, initialization, and gateway startup.
Changes:
- Adds shared local/remote extractor implementations and configuration.
- Adds gateway injection and server configuration.
- Enables remote extractor use by CLI workflows with lifecycle and timeout handling.
Reviewed changes
Copilot reviewed 25 out of 37 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
utils/nlsearch/decompose.go |
Uses shared extractor package. |
utils/nlsearch/decompose_test.go |
Updates extractor test dependency. |
utils/go.mod |
Adds extractor dependencies. |
utils/go.sum |
Updates dependency checksums. |
utils/extractor/resolve.go |
Implements unified backend resolution. |
utils/extractor/resolve_test.go |
Tests backend selection. |
utils/extractor/remote.go |
Adds remote gRPC backend. |
utils/extractor/remote_test.go |
Tests remote response mapping. |
utils/extractor/provision_integration_test.go |
Adds provisioning integration test. |
utils/extractor/local.go |
Adapts local SDK backend. |
utils/extractor/load_test.go |
Tests local loading failures. |
utils/extractor/extractor.go |
Defines shared extractor interface. |
utils/extractor/config.go |
Defines shared configuration. |
utils/extractor/config_test.go |
Tests configuration behavior. |
utils/extractor/assets.go |
Adds asset detection and teardown. |
utils/extractor/assets_test.go |
Tests asset lifecycle behavior. |
server/server.go |
Resolves and manages gateway extractor. |
server/go.mod |
Adds indirect extractor dependencies. |
server/go.sum |
Updates dependency checksums. |
server/controller/ai_finder.go |
Adds extractor dependency injection. |
server/config/config.go |
Adds server extractor configuration. |
server/config/config_test.go |
Tests extractor environment binding. |
reconciler/go.mod |
Updates transitive dependencies. |
reconciler/go.sum |
Updates dependency checksums. |
client/go.mod |
Moves extractor dependencies to utilities. |
client/extractor/load_test.go |
Removes relocated tests. |
client/config/extractor.go |
Resolves persisted extractor configuration. |
client/config/extractor_test.go |
Tests persisted resolution. |
cli/cmd/search/nlsearch.go |
Uses shared configured resolver. |
cli/cmd/routing/nlsearch.go |
Uses shared configured resolver. |
cli/cmd/init/run.go |
Adds remote provisioning and smoke checks. |
cli/cmd/init/run_test.go |
Tests remote initialization behavior. |
cli/cmd/init/options.go |
Adds remote-address flag. |
cli/cmd/import/options.go |
Tracks extractor lifecycle. |
cli/cmd/import/import.go |
Closes resolved extractors. |
cli/cmd/import/extractor_adapter.go |
Supports remote extraction with timeout. |
cli/cmd/import/config.go |
Adds remote importer configuration. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…utils Signed-off-by: András Jáky <[email protected]>
…ntroller Adds the WithExtractor option so the server can hand the gateway's resolved extractor to the AI Finder controller. No RPC consumes it yet; the extractor-backed endpoints are added on top of this wiring. Signed-off-by: András Jáky <[email protected]>
Signed-off-by: András Jáky <[email protected]>
Signed-off-by: András Jáky <[email protected]>
…eout Close the gateway extractor after GracefulStop rather than before, release the resolved extractor when gateway construction fails, and bound the dirctl init remote smoke check with an explicit timeout. Signed-off-by: András Jáky <[email protected]>
…hment Signed-off-by: András Jáky <[email protected]>
The embedded daemon uses its own Viper loader, where AutomaticEnv cannot resolve keys that are absent from daemon.config.yaml and have no default. The extractor keys were unregistered there, so DIRECTORY_DAEMON_SERVER_EXTRACTOR_* was silently ignored; register all three and cover the env-only and user-config cases with tests. Also document remote_addr in the import config example and the CLI reference, and drop references to endpoints this change does not add. Signed-off-by: András Jáky <[email protected]>
Add ExtractOptions.Tiers and default it to two score groups instead of the SDK's one, applied by both the local and remote backends and by nlsearch.Decompose so the backends and the signal filter stay in lockstep. One tier is too narrow in practice: descriptive queries miss classes that are plainly relevant, because the gap between the closest score group and the next is often not meaningful in a densely populated hierarchical taxonomy. Callers can still narrow (Tiers: 1) or widen per call. Closes #2003 Signed-off-by: András Jáky <[email protected]>
akijakya
force-pushed
the
feat/shared-extractor
branch
from
August 11, 2026 09:55
08d57d5 to
ef6ada5
Compare
csirmazbendeguz
approved these changes
Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1906
Closes #2003
Summary
Makes the OASF taxonomy extractor a shared, remotely-configurable component instead of a CLI-local one: it moves to the
utilsmodule, gains a single resolution path used by every caller, and is wired into the gateway at startup.No new endpoints and no new CLI commands. This is the foundation the extractor-backed features build on (#2001, #1905), split out so it can land and be reviewed on its own. It carries one behavioral change — the tier default below — in its own commit.
Why the extractor had to move
The shared pluggable extractor from #1904 landed in the
clientmodule — the dir gRPC SDK. The gateway needs the extractor, and importingclientintoserveris the wrong direction:client/extractor→client/config→ the rootclientpackage, it dragged the entire SDK dependency closure (sigstore/cosign, k8s client-go, go-tuf, zitadel/oidc, ~100 modules) into the server binary.So the SDK-agnostic core —
Extractor,ResolveExtractor, the local and remote backends,Config,Provision— moves to the genuinely sharedutilsmodule asutils/extractorandutils/nlsearch. The one convenience function that reads the persisteddirctlconfig (ResolveConfigured) stays inclient/config, where its dependency on the CLI config layer belongs.Result:
go list -deps ./server/...no longer referencesagntcy/dir/clientat all.utils/extractornever importsclient, which is what keeps the layering from regressing.One way to resolve an extractor
Previously there were two entry points — a local-only loader and a resolver — and callers picked one, so
dirctl importcould not use a remote extractor even when one was configured. There is now a single path, used everywhere:dirctl initdefault), elseConsequences: the importer can now enrich against a remote OASF-SDK server (
remote_addrin the import file config), eachExtractcall is bounded by a timeout so an unreachable server cannot stall an import, and the resolved extractor is closed when the import finishes.Two score tiers by default (#2003)
The extractor groups matches into score tiers; the SDK returns one. That is too narrow in practice — descriptive queries miss plainly relevant classes, because in a densely populated hierarchical taxonomy the gap between the closest score group and the next often is not meaningful.
ExtractOptions.Tiersnow defaults to 2, applied by the local and remote backends and bynlsearch.Decomposeso the backends and the signal filter cannot disagree. Callers can still narrow (Tiers: 1) or widen per call.This is the one part of the PR that changes existing behavior:
dirctl searchand routing search match more broadly, anddirctl importassigns more skills and domains to the records it writes. The enrichment half is the one worth a second opinion, since those classes are persisted into records — see #2003 for the reasoning and the questions left open (whether the number should be configurable, and whether 2 is empirically right — it was chosen from an observed failure, not from measurement).Configuration
New server config block, consulted only when the HTTP gateway is enabled:
Bound to
DIRECTORY_SERVER_EXTRACTOR_REMOTE_ADDR,_ASSET_DIR,_OASF_URL.dirctl initcan configure a remote address interactively and smoke-checks it (with a bounded timeout) before saving.Resolution failure at startup is non-fatal — the server still starts, and extractor-backed functionality is simply unavailable until one is configured.
Note on the unused field
WithExtractorinjects the resolved extractor into the AI Finder controller, but no RPC reads it yet — that is deliberate, since this PR intentionally carries no endpoints. The field is marked//nolint:unusedwith a pointer to the follow-up; the annotation comes off when #2001 or #1905 consumes it.Scope
Deliberately not here: the
/v1/searchand/v1/extractprotos and handlers, and the Helm subchart (#1907, which additionally depends on agntcy/oasf-sdk#179 to deploy the server asClusterIP).This branch is the salvaged foundation of #1969, which was closed after the epic (#1903) changed direction. The commits kept here are unaffected by that redesign; the search-specific ones were dropped.
Testing
task lintreports 0 issues (Go and Helm);task testpasses with no failuresnlsearchdecomposition, server config binding,dirctl init, and import configgo list -deps ./server/...contains noagntcy/dir/clientpackagesdirctl daemon startwith local assets, and a remote OASF-SDK container viaDIRECTORY_DAEMON_SERVER_EXTRACTOR_REMOTE_ADDR