Skip to content

feat(file-based): declare Unstructured Document Parser content as semantic-search indexable - #1172

Open
Aaron ("AJ") Steers (aaronsteers) wants to merge 3 commits into
mainfrom
devin/1790131496-unstructured-semantic-search-annotation
Open

Aaron ("AJ") Steers (aaronsteers) wants to merge 3 commits into
mainfrom
devin/1790131496-unstructured-semantic-search-annotation

Conversation

@aaronsteers

@aaronsteers Aaron ("AJ") Steers (aaronsteers) commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Overview

👉 TL;DR: Files parsed with the Unstructured Document Format (Google Drive, S3, GCS, SFTP, …) now tell downstream semantic indexers that their Markdown content column is indexable text. Until now the discovered schema carried no such hint, so every unstructured stream was silently un-indexable by Sonar/Fusion.

Specifically, UnstructuredParser.infer_schema attaches x-airbyte-semantic-search (module-level SEMANTIC_SEARCH_ANNOTATION) to the content property, and DefaultFileBasedStream._fill_nulls learns to leave x-* schema extensions untouched.

Pairs with:

Changes

  • unstructured_parser.py: new SEMANTIC_SEARCH_ANNOTATION (content_type: markdown, one whole-document chunk sample, context_max_chars: 2048, text-embedding-3-small, metadata document_key / _ab_source_file_url / _ab_source_file_last_modified) — shape mirrors Sonar's integrations/google-drive/connector.yaml and validates against Sonar's SemanticSearchConfig.
  • unstructured_parser.py: infer_schema emits the annotation on content.
  • default_file_based_stream.py: _fill_nulls tracks whether it is iterating a properties map (every key is a field name → recurse) or a schema object (skip x-* extension keys). Without this it rewrote the annotation's metadata type: "string" to ["null", "string"], which the consumer rejects.
  • Tests: exact-schema assertions in test_unstructured_parser.py / unstructured_scenarios.py import the constant; new test_fill_nulls_properties_map_only_exempts_x_keys_on_schema_objects covers a top-level x-status field, a nested properties.x-inner field, and the untouched annotation internals.

Review Spotlight

Reviewers with limited time, please review first:

Risks

  • Discovered schemas for unstructured streams gain one additive key under content; no record-level change. Verified end-to-end via /ai-prove-fix on the connector PR: DISCOVER diff vs source-google-drive 0.5.36 is exactly properties.content.x-airbyte-semantic-search; SPEC/CHECK/READ at parity.
  • merge_schemas already preserves non-type keys, so no other schema-pipeline change was needed.

Known CI exceptions

  • Check: destination-motherduck — MotherDuck token auth failure in CI; fails identically on unrelated PRs (e.g. runs 35787513116, 35694559096, 35639104268).
  • Check: source-google-drive — standard-tests harness instantiates SourceGoogleDrive() with no args, but the published 0.5.36 connector's FileBasedSource subclass requires catalog/config/state. Fails before any schema code runs; orthogonal to this diff.

Test plan

  • poetry run pytest unit_tests/sources/file_based/file_types/test_unstructured_parser.py unit_tests/sources/file_based/stream/test_default_file_based_stream.py unit_tests/sources/file_based/test_scenarios.py -k unstructured
  • poetry run ruff check / ruff format --check / mypy — all green in CI

Link to Devin session: https://app.devin.ai/sessions/ebc5d6457e0b41b4837a46e06e14d66c
Open in Devin Desktop: https://app.devin.ai/desktop/session/ebc5d6457e0b41b4837a46e06e14d66c?variant=devin
Requested by: Aaron ("AJ") Steers (@aaronsteers)

…tured content schema

Co-Authored-By: AJ Steers <aj@airbyte.io>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions

Copy link
Copy Markdown

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

💡 Show Tips and Tricks

Testing This CDK Version

You can test this version of the CDK using the following:

# Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1790131496-unstructured-semantic-search-annotation#egg=airbyte-python-cdk[dev]' --help

# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1790131496-unstructured-semantic-search-annotation

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /autofix - Fixes most formatting and linting issues
  • /poetry-lock - Updates poetry.lock file
  • /test - Runs connector tests with the updated CDK
  • /prerelease - Triggers a prerelease publish with default arguments
  • /poe build - Regenerate git-committed build artifacts, such as the pydantic models which are generated from the manifest JSON schema in YAML.
  • /poe <command> - Runs any poe command in the CDK environment
📚 Show Repo Guidance

Helpful Resources

📝 Edit this welcome message.

@aaronsteers

Copy link
Copy Markdown
Member Author

/ai-prove-fix

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

A moderate null-filling edge case and a semantic-search contract test gap remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Declares unstructured document content fields as semantic-search indexable and preserves annotations during schema processing.

Changes:

  • Adds semantic-search metadata to unstructured schemas.
  • Prevents null-filling from mutating x-* annotations.
  • Updates parser and scenario schema expectations.
File Description
unit_tests/​sources/​file_based/​scenarios/​unstructured_scenarios.py Updates scenario schema expectations.
unit_tests/​sources/​file_based/​file_types/​test_unstructured_parser.py Updates parser schema assertions.
airbyte_cdk/​sources/​file_based/​stream/​default_file_based_stream.py Preserves schema extension metadata during null filling.
airbyte_cdk/​sources/​file_based/​file_types/​unstructured_parser.py Adds the semantic-search annotation to content.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread airbyte_cdk/sources/file_based/stream/default_file_based_stream.py Outdated

@devin-ai-integration devin-ai-integration Bot 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.

Devin Review found 1 potential issue.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment thread airbyte_cdk/sources/file_based/stream/default_file_based_stream.py Outdated
@aaronsteers

Aaron ("AJ") Steers (aaronsteers) commented Sep 23, 2026 •

Copy link
Copy Markdown
Member Author

/prerelease

Prerelease Job Info

This job triggers the publish workflow with default arguments to create a prerelease.

Prerelease job started... Check job output.

✅ Prerelease workflow triggered successfully.

View the publish workflow run: https://github.com/airbytehq/airbyte-python-cdk/actions/runs/35812294432

@aaronsteers

Copy link
Copy Markdown
Member Author

Devin, create a PR for source-google-drive to take this CDK update using the prerelease I triggered above. Then kick off /ai-prove-fix using your CI trigger tool in the ops mcp.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

👍 On it. Will pin source-google-drive to the prerelease CDK version from the run above in a new airbyte PR, then trigger /ai-prove-fix on it via the ops MCP CI trigger. Note the prerelease predates the _fill_nulls review fix I'm pushing now; I'll call that out on the connector PR.

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.

APPROVED
Left non-blocking question

Co-Authored-By: AJ Steers <aj@airbyte.io>
@aaronsteers

Copy link
Copy Markdown
Member Author

Just retrigger prerelease here. And don't be blocked on creating that PR - since you can easily bump to new prereleases once the PR is ready.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

☑️ Done. Connector PR: airbytehq/airbyte#86924 (pinned to 7.30.0.post1.dev35812294432). /ai-prove-fix dispatched via the ops MCP: https://github.com/airbytehq/airbyte/actions/runs/35812651997. Also re-triggered a prerelease for the f139e06 head (https://github.com/airbytehq/airbyte-python-cdk/actions/runs/35812597000) — will re-pin the connector PR once it publishes.


Devin session

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

PyTest Results (Fast)

5 755 tests  +1   5 724 ✅ +1   9m 30s ⏱️ - 2m 9s
    1 suites ±0      31 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 86ef27a. ± Comparison against base commit 73ccaa9.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

PyTest Results (Full)

5 758 tests  +1   5 727 ✅ +1   16m 50s ⏱️ + 6m 42s
    1 suites ±0      31 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 86ef27a. ± Comparison against base commit 73ccaa9.

♻️ This comment has been updated with latest results.

}
],
"windowing": {"context_max_chars": 2048, "context_boundary": "whole_unit"},
"embedding": {"model": "text-embedding-3-small"},

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.

I don't think the embedding model should be on the connector side - that should be in the platform. Otherwise we'll need to republish all connectors when swapping models

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.

yeah the fusion pipeline ignores the model from the connector. we shouldn't include this here

@devin-ai-integration

Copy link
Copy Markdown
Contributor

❌ Cannot revive Devin session - the session is too old. Please start a new session instead.

View session

@aaronsteers
Aaron ("AJ") Steers (aaronsteers) marked this pull request as ready for review October 15, 2026 02:01

This branch was successfully deployed

2 active (outdated) deployments
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.

4 participants