Skip to content

fix(ci): keep lineage SQL static at call sites - #647

Merged
seonghobae merged 5 commits into
fix/global-ask-graph-fact-provenancefrom
feat/global-ask-knowledge-cutoff-current
Aug 25, 2026
Merged

fix(ci): keep lineage SQL static at call sites#647
seonghobae merged 5 commits into
fix/global-ask-graph-fact-provenancefrom
feat/global-ask-knowledge-cutoff-current

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Resolves the current #632 review findings without changing behavior:

  • passes the claim-verification factory directly
  • composes the trusted eligibility fragments into module-level static SQL before asyncpg calls, removing the scanner's dynamic-query finding at both sibling call sites

Verification: 58 passed across lineage ingestion, Global Ask queue/diagnostics, and public-docstring coverage.


Open in Devin Review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 504dd198-02c9-4458-9a39-1967ae351339

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae merged commit 6b66327 into fix/global-ask-graph-fact-provenance Aug 25, 2026
1 of 4 checks passed

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 2 potential issues.

Open in Devin Review

Comment thread backend/app/main.py
),
embedding_factory=_embedding_client,
claim_verification_factory=lambda: _claim_verification_client(),
claim_verification_factory=_claim_verification_client,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Claim-verification factory loses late binding

Passing _claim_verification_client directly instead of lambda: _claim_verification_client() binds the original function at lifespan startup, when run_global_ask_worker captures the factory. A later reassignment of the module global no longer reaches the worker, which the neighboring chat_factory lambda deliberately preserves. Tests that swap in a fake verifier after startup (test_ask) are ignored, so external-verification assertions fail.

Suggested change
claim_verification_factory=_claim_verification_client,
claim_verification_factory=lambda: _claim_verification_client(),
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +59 to +69
_RECONSTRUCTION_SOURCE_SQL = (
"select post_id, post_title, voc_type_code, created_at, corporate_entity_id, "
"process_unit_id, thread_group_key, secondary_grouping_key "
"from source_post where {eligibility}"
).format(eligibility=SOURCE_POST_ELIGIBILITY_SQL.format(alias="source_post"))

_VISIBLE_LINEAGE_SOURCE_SQL = (
"select post_id, post_title, voc_type_code, visibility_code, "
"corporate_entity_id, process_unit_id, thread_group_key, created_at "
"from source_post where {eligibility}"
).format(eligibility=SOURCE_POST_ELIGIBILITY_SQL.format(alias="source_post"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 Info: SQL extraction preserves the original queries

The new _RECONSTRUCTION_SOURCE_SQL and _VISIBLE_LINEAGE_SOURCE_SQL reproduce the removed inline queries. SOURCE_POST_ELIGIBILITY_SQL.format(alias="source_post") resolves {alias} to a brace-free string, so the outer .format(eligibility=...) cannot re-interpret braces. Column lists match exactly.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

1 participant