Skip to content

Importing an ontology queues alignment behind the index refresh, as the editor does - #1286

Merged
WaylandYang merged 2 commits into
deeplethe:devfrom
Maya-Kid:fix/ontology-import-queues-alignment
Oct 16, 2026
Merged

WaylandYang merged 2 commits into
deeplethe:devfrom
Maya-Kid:fix/ontology-import-queues-alignment

Conversation

@Maya-Kid

Copy link
Copy Markdown
Contributor

Importing an ontology now queues alignment behind the index refresh, so kind words and phrases decided earlier can bind to what it adds.

Problem

apply_import runs owl_import::apply, which queues only embed_ontology. The editor's create and update handlers (#956) and adoption (#1257) queue the refresh, then the alignment, as docs/design/ontology.md asks of every path adding elements. The new-base form says more can be imported later.

On dev, a document gives Acme the kind word company, decided none with no classes yet. After importing ex:Company a owl:Class and running embed_ontology, company stays none and Acme has no class until another document or a class edit queues alignment. Phrase signatures with no fitting property stay none too.

Change

  • After the import's reconcile commit, apply_import calls reindex_then_align(&state, kb_id, "align_types"), which finds the refresh already queued and adds align_types; that job waits for the refresh and queues align_phrases when it settles. Not in owl_import::apply, which also installs packs into new bases that have nothing to align.
  • The design doc lists imports too.

Verification

  • api::token_setup_tests::importing_an_ontology_queues_alignment_behind_the_index_refresh imports a one-class Turtle file through the router and expects ["embed_ontology", "align_types"] queued. On dev 040a533 with only the test file added, it fails with ["embed_ontology"]. Cleanup now deletes the base's jobs.
  • On dev 2293ec9, a development test ran the queued jobs: company bound to the imported class, and stayed none without the change. It is left out: past the queue it tests the unchanged aligner.

Linux x86_64 container, Rust 1.98.1, PostgreSQL 16 + pgvector, Poppler, DB required, commit 96d37a5 on dev 040a533: fmt and clippy clean; cargo test --locked --workspace 1,576 passed, 0 failed, 6 ignored.

Limits

  • A failed import queues no alignment, though apply may have committed some classes; a successful re-import queues it.
  • Re-importing an unchanged file re-asks the agent's kind-word decisions whose candidates include its classes, since update_type_from_import always bumps updated_at, as an editor save does; before, the next document did.
  • A properties-only file imported into a classless base queues no phrase alignment, like a document there: align_types queues it only once a class exists.

…he editor does

Signed-off-by: dada-yan <BinjunYann@gmail.com>

@WaylandYang WaylandYang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Calling reindex_then_align after the reconcile commit gives import the same order the editor and adoption already have: the index refresh that apply queued is reused, and align_types waits for it and queues align_phrases when it settles. Leaving it out of owl_import::apply keeps pack installs into new bases from queuing alignment with nothing to align. The test goes through the real import route and fails on dev. Merging.

@WaylandYang
WaylandYang merged commit 5b76a41 into deeplethe:dev Oct 16, 2026
6 checks passed
@Maya-Kid
Maya-Kid deleted the fix/ontology-import-queues-alignment branch October 16, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants