Skip to content

fix(server): Clear answers without source evidence - #454

Merged
shenyankm merged 9 commits into
mainfrom
sheny/clear-unsupported-answers
Oct 28, 2026
Merged

shenyankm merged 9 commits into
mainfrom
sheny/clear-unsupported-answers

Conversation

@shenyankm

@shenyankm shenyankm commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

Imports could retain model-inferred answers and explanations despite the extraction prompt prohibiting question solving. Validate non-null answerPayload and analysis against verified source evidence during final merge, including resumed unit results. Clear unsupported fields independently while preserving questions, source associations, missing-field flags and human-review warnings.

Cover text, Tencent OCR, native table rows and explicitly linked answer keys. Reject ambiguous numbering and evidence across failed pages. TXT/Markdown imports also check the original UTF-8 source when Tencent text differs. Add 205 provenance regressions and update synthetic fixtures so supplied answers actually appear in their source evidence; ZIP export retains nulls and review flags.

Preserve supplied answers from labeled or corroborating keys, local multiline fields, native tables, and numeric ordering/matching exercises. Normalize permitted type prefixes, terminal punctuation and table layout whitespace while preserving literal scalar spelling. Restore headers for resumed tabular fragments and resolve printed row identities before worksheet scoping.

Require stem prefixes and verified choice/item blocks for question association, including unnumbered exercises. Reject duplicate-key JSON, overly nested answer JSON, changed item identities and ambiguous extra content. Retain source-conflict warnings before unsupported fields are cleared.

AI assistance: Codex implemented the change, reviewed the complete diff and connected import/recovery/export paths, reproduced the original behavior with the baseline merge function, and ran local validation using provider/model substitutes.

Linked issue

N/A — focused bug fix; CONTRIBUTING.md permits a direct PR without a separate issue.

Affected areas

AI service document-import final merge, service tests and evaluation documentation. App/Web consume the existing null-answer and review fields; shared contracts and native application code are unchanged.

Validation

Choose relevant checks from CONTRIBUTING.md.

Check or manual flow Platform / environment Result and evidence
make verify AI_PYTHON=/Users/sheny/.local/share/uv/python/cpython-3.14-macos-aarch64-none/bin/python3.14 macOS arm64, CPython 3.14.7, disposable PostgreSQL/RabbitMQ, provider/model substitutes Passed on 749f026e: 3,301 tests, 94% total coverage; lock consistency, Ruff, Pyright, 30 evaluation fixtures, recovery probes, sdist/wheel build and package integrity. Reports: server/reports/checks/probes.xml, coverage.xml, probes.json.
Review follow-up regressions, Ruff and Pyright macOS arm64, CPython 3.14.7 Passed on 749f026e: 375 targeted tests, including 205 provenance cases. Added 39 cases for unnumbered structured answers, item-ID mappings, source-stem association, supported field labels, and duplicate/deep JSON. The existing text-03.txt format fixture also passes both actual text and OCR graph paths with model substitutes.
Complete PR diff and connected-flow review Local source, personal self-hosted service workload Reviewed all 13 changed files plus import, source-presence, stored-unit recovery, merge, review flags and ZIP export callers. Fixed the linked review and additionally reproduced/fixed interior-stem association, remapped item identities, missing declared field labels and ambiguous/deep JSON evidence. No confirmed findings remain open from this review.
Baseline reproduction Same local environment Before the fix, both text and OCR graph regressions retained an inferred answer; both pass with the fix.
git diff --check; main integration Local Git Passed. Integrated main at 35206f13; verified that clearing unsupported published fields retains the upstream source-conflict warning and original source.
Live Tencent/model evaluation External providers Not run — no paid calls or real-document accuracy claims.
App/Web browser/native checks, dependency audits and service image build Unchanged components/dependencies N/A — service-only behavior and synthetic tests; no UI, native, dependency or container changes.
Hosted CI and review GitHub CI for 749f026e has been triggered; final results and fresh hosted review are pending. Fifteen reproduced and tested review findings are resolved. Local full-diff review and checks do not establish hosted CI or fresh-review acceptance.

Risk and rollout

  • Data, contracts, and backup compatibility: Existing nulls, review flags and source associations are reused. No API/database/backup schema change or rewrite of saved banks, practice records or immutable score snapshots.
  • Configuration, dependencies, and security: No new settings or dependencies. Proofs use checksum-verified local inputs rather than model-authored sourceText. No additional model calls, automatic retries, credential handling changes or provider charges.
  • Main risk and rollout or recovery steps: Conservative proofs may clear genuine answers in unfamiliar, ambiguous or unreadable layouts; retain source evidence for manual recovery and review. Deploy the updated service without migration; rollback uses the previous service build. The check establishes source attribution, not the correctness of printed answers or OCR accuracy.

Checklist

  • I reviewed the full diff and kept it focused, including any required generated files and documentation.
  • I recorded relevant validation results and explained remaining gaps.
  • I checked code, fixtures, logs, and attachments for secrets and personal data.

Validate extracted answers and explanations against verified source evidence at final merge. Preserve questions, source links and review flags without adding model calls, including checkpoint recovery and ZIP export.

Co-authored-by: Codex <codex@openai.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T15:15:51.086034Z 749f026 New commits
🔒 Security Review ✅ Completed 2026-10-28T15:19:24.302617Z 749f026 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a87f936027

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/src/practiq_ai/graphs/answer_evidence.py Outdated
Comment thread server/src/practiq_ai/graphs/answer_evidence.py
Comment thread server/src/practiq_ai/graphs/answer_evidence.py Outdated
Preserve labeled answer-key entries and permitted table stem prefixes. Compare scalar answer text without numeric coercion so source spellings remain intact, and cover all three review findings with regressions.

Co-authored-by: Codex <codex@openai.com>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e21f30cc5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/src/practiq_ai/graphs/answer_evidence.py
Comment thread server/src/practiq_ai/graphs/answer_evidence.py
Comment thread server/src/practiq_ai/graphs/document.py
shenyankm and others added 3 commits October 28, 2026 20:53
Accept terminal punctuation only for choice and boolean answers, require all corroborating source fields to agree, and restore stored headers for resumed tabular fragments. Cover all three additional review findings with regressions.

Co-authored-by: Codex <codex@openai.com>
Integrate current source-consistency and OCR evidence handling before validating the combined import pipeline.

Co-authored-by: Codex <codex@openai.com>
Retain source-conflict warnings before clearing unsupported published fields. Keep source-backed choice labels equivalent by identity regardless of order or case, and verify the combined import and grading-consistency path.

Co-authored-by: Codex <codex@openai.com>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cea35e7943

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/src/practiq_ai/graphs/answer_evidence.py
Comment thread server/src/practiq_ai/graphs/answer_evidence.py Outdated
Require numbered entries before splitting an answer key, keep decimal answers inside their source record, and match unnumbered choice stems after verifying their printed option lines. Cover local labels, CRLF sources and ambiguous extra content.

Co-authored-by: Codex <codex@openai.com>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aa318ceb96

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/src/practiq_ai/graphs/answer_evidence.py
Comment thread server/src/practiq_ai/graphs/answer_evidence.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 905f7d088d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/src/practiq_ai/graphs/answer_evidence.py
Comment thread server/src/practiq_ai/graphs/answer_evidence.py
Comment thread server/src/practiq_ai/graphs/document.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b444e897c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/src/practiq_ai/graphs/answer_evidence.py Outdated
Comment thread server/src/practiq_ai/graphs/answer_evidence.py

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 749f026ecb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/src/practiq_ai/graphs/answer_evidence.py
Comment thread server/src/practiq_ai/graphs/answer_evidence.py
@shenyankm
shenyankm merged commit a82644f into main Oct 28, 2026
13 checks passed
@shenyankm
shenyankm deleted the sheny/clear-unsupported-answers branch October 28, 2026 15:37
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