Repository navigation
semantic-search plan: compare-based stale test, node_key cursor, domain-routed typed search, no-embed mark via jarvis - #139
Merged
Conversation
…ed one; page by node_key; typed search through the domain indexes; the no-embed mark via a jarvis PR Second review of the plan, against the code: - stakgraph's ingest rewrites Data_Bank to the name on every re-sync (ON MATCH SET node += $properties), so a stale test keyed on _search_fields_used never notices. Stale is now: stored Data_Bank differs from the text the writer composes, or the vector is missing — one invariant that also catches edited and filled-in fields. - The pass pages by a node_key cursor (index-backed on every seeded type) instead of LIMIT scans, which are quadratic during catch-up and a full scan per clean check. Sweep hourly, code types first, removals last; a per-minute newcomer tick on date_added_to_graph; a thread cap on the ONNX session; GET /graph/embeddings for the sweep state. - Typed searches route through the domain vector indexes (code = Domain_codeartifact, ~40k nodes) and untyped ones through the global index; over-fetch only for the residual. - The no-embed mark goes on the Schema node as embed: false through a jarvis PR (§4); strut's own two types keep it in code. A stakgraph PR moves Data_Bank to ON CREATE (§5). strut is correct without either. - The index reconcile is stamped per fixture version so a narrowing jarvis makes on purpose is not undone at every boot.
jarvis-backend 04317241, read end to end: - SchemaHelper._synchronize_schemas → _get_missing_schema_updates sends a live Schema only the SCHEMA_KNOWN_PROPERTIES keys it LACKS, through schema_crud.update_schema (the crud function — sync_indexes_for_schema runs only on a PUT, index_changed only when index is in the update). So a new library key lands at the next boot with no index rebuild and no re-embed, and an existing index is never touched: strut's direct index write triggers nothing there. - _validate_schema_properties + _assert_is_valid_schema refuse a key outside the list / a non-type-string value, and an older jarvis reads embed: false on a Schema node as a REQUIRED attribute of type false (assert_is_valid_schema_of_type) — every node create of that type would fail. So the key reaches a node only through jarvis's own sync. - The enqueue sites the PR gates; get_schema is uncached; the startup backfills are tracker-gated one-shots; the worker drains Redis only. - ensure_concept_domain_labels_on_startup is jarvis's own precedent for the label half of the pass. - date_added_to_graph is epoch ms in jarvis too (now_epoch_ms); the open question is closed.
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.
Second review of
plans/semantic-search.md(the plan merged in #138), done against the code it touches, then a third pass reading jarvis-backend end to end. Still PROPOSED, nothing built; the choices to confirm are under "Rulings".What the review found
Data_Bankon every re-sync.ast/src/lang/graphs/neo4j/queries/nodes.rsputsData_Bank = nameinto$propertiesand runsON MATCH SET node += $properties. A stale test keyed on_search_fields_used(the previous plan) calls such a node clean, with a vector that no longer matches the stored text. Now Problem 5.LIMIT-without-cursor scans are quadratic during catch-up (the 448kTurnremovals would visit nodes on the order of a billion times) and make every clean check a scan of the whole type, roughly four full-graph reads an hour, forever.Endpointis 642 of ~330k vectors globally and a few hundred of ~40k inDomain_codeartifact, whose index already exists on swarm38 and in strut's seed.Turnwritten through its API.What changed
Data_Bankdiffers from the text the writer composes from the index fields, or the vector is missing. One invariant that also covers edited and filled-in fields (the "comparing cursor" the plan deferred). The decision is made in strut throughbuildSearchText, so there is one composition.node_keycursor (index-backed on every seeded type; the pass runs the sameIF NOT EXISTSstatement at open). Sweep hourly, code types first, no-embed removals last; a per-minute newcomer tick ondate_added_to_graph;intraOpNumThreads: 2on the ONNX session since the pass runs inside the serving process;GET /graph/embeddingsreporting the sweep, per-type counts and the types skipped and why.text_embeddings_vector_index; over-fetch only for the residual.domain_all_vector_indexis dropped (never exists on 5.19).embed: falsethrough a jarvis PR; strut's own two types keep the mark in code. Until it deploys, the pass removes what jarvis adds.Data_BanktoON CREATEonly, likedate_added_to_graph. strut is correct without either PR; they remove waste.§4 verified against jarvis-backend
04317241gunicorn.conf.py→setup_jarvis):Migration.run(), thenSchemaHelper.run()→create_schemafor missing types, then_synchronize_schemas→_get_missing_schema_updates, which sends a live Schema only theSCHEMA_KNOWN_PROPERTIESkeys it lacks (plus absent attributes) throughschema_crud.update_schema. A new library key lands at the next boot; an existingindexis never touched. That is the crud function, not the route:sync_indexes_for_schema(keyword index drop/recreate) runs only on a PUT, andindex_changedonly whenindexis in the update. So the mark lands with no rebuild and no re-embed, and strut's directindexwrite triggers nothing._validate_schema_propertiesrefuses any key outsideSCHEMA_KNOWN_PROPERTIES;_assert_is_valid_schemarequires a type string for anything else. And an older jarvis readsembed: falseon a Schema node as a required attribute of typefalse(assert_is_valid_schema_of_type), so every node create of that type through its API would fail. The key therefore reaches a node only through jarvis's own sync; strut never writes it.schema_node_helper.py, the v1 update path innode_service.py,migrate_existing_data_bank_index, the v1 bulk edge path.get_schemais uncached, so the check is free and jarvis composes with a widenedindexfrom its next write.ensure_concept_domain_labels_on_startupis jarvis's own per-boot precedent for the label half of the pass;date_added_to_graphis epoch ms in jarvis too (now_epoch_ms), closing that open question.