Skip to content

fix(frontend): honor confidence percentage contract - #1559

Draft
seonghobae wants to merge 6 commits into
developfrom
codex/confidence-ratio-contract
Draft

seonghobae wants to merge 6 commits into
developfrom
codex/confidence-ratio-contract

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

문제

toConfidencePercent0..1 값을 비율로 추측해 backend /api/llm/summarizeconfidence: int | None, 0..100 계약과 다른 표시·quality-guardrail telemetry를 만들 수 있었습니다.

Current exact identity

  • protected base: develop@042b0c70531b229af3acbd0421a2f23098d848b3
  • exact head: 1a7e10ea12f27d5d123d7528eae069d4f43a5194
  • compare: ahead_by=6, behind_by=0, merge base = protected develop
  • effective delta: 5 filesAGENTS.md는 더 이상 이 product/source PR의 delta가 아닙니다.
  • lifecycle: Draft / source + fixture contract repaired / fresh hosted evidence + independent approval pending

RED → causal repair

  1. 9d2a6ea892a8367713976e15babcbd337d06895d에서 value-based 0–1 inference를 제거하고 frontend helper/test fixture를 backend 0–100 단위에 맞췄습니다.
  2. review에서 pilot/full-product buyer smoke가 여전히 confidence: 0.86을 반환해 1% 표시와 false low_confidence event를 만들 수 있음을 찾았습니다. a081359a2911dcde31965b797ef9c96366770463에서 두 fixture를 86으로 고쳤고 해당 finding은 current source에서 해소됐습니다.
  3. 4d6b697e97f7f0d98700292680970b41e7b12c48에서 shared boundary가 0.856, 85.5 같은 non-integer malformed 값까지 silently round하지 않고 reject하도록 고쳤습니다. -00으로 정규화합니다.
  4. 같은 lineage에서 confidence recurrence rule을 AGENTS.md에 직접 추가했지만, live Naruon docs stack docs(governance): align AGENTS/CLAUDE LLM guidance with canonical orchestrator owner #1549/#1566이 이미 AGENTS.md canonical writer입니다. 병렬 docs ownership을 유지하지 않고 direct descendant 1a7e10ea12f27d5d123d7528eae069d4f43a5194에서 protected-base AGENTS blob을 non-force로 복원했습니다. 실행 가능한 recurrence contract는 confidence.test.ts, EmailDetail.test.tsx, pilot/full-product smoke에 그대로 남습니다. valid AGENTS finding은 docs(agents): 증거 기반 작업 절차 정리 #1566 PR authority로 승계했으며 그 docs stack exact head에 실제 반영되기 전에는 landed로 간주하지 않습니다.

이 PR은 #1436 전체를 supersede하지 않습니다. confidence-unit boundary만 독립적으로 소유하며 #1436의 Storybook/design-system/product-event delta는 별도입니다.

Fresh evidence boundary

새 exact head에 repository-owned PR workflows가 다시 생성됐습니다: Application CI 33942459386, Security Scan 33942459380, Semgrep 33942459468, CodeQL PR 33942459375, Bandit 33942459369, Docker 33942459471. 현재 모두 queued입니다. earlier-head checks/reviews는 통과 증거로 승계하지 않습니다. qualifying post-last-push independent APPROVED review도 없습니다. resolved historical threads는 current source finding이 다시 나타나지 않는다는 사실만 나타내며 merge authorization이 아닙니다.

Keep Draft until one unchanged exact head has every then-live repository/organization required check terminal-success, zero valid unresolved findings/threads, and the live last-push approval requirement satisfied. No self-approval, bypass/admin merge, force-push, destructive rebase, dummy/no-op requeue commit, synthetic status, gate weakening, or predecessor-evidence transfer.

UI Delivery Gate

  • 의도성: PASS — 표시 단위를 backend integer 0–100 contract 하나로 고정합니다.
  • 기능 완전성: source/fixture PASS — helper/component/buyer-smoke가 같은 단위를 사용하고 malformed non-integer를 fail closed 합니다.
  • 콘텐츠 적합성: PASS — 사용자 카피·화면 구조를 추가하지 않습니다.
  • 복원력: PENDING — current-head hosted/browser execution이 terminal-success가 아닙니다.
  • 증거성: PENDING — exact-head required checks와 post-last-push independent approval이 필요합니다.
  • 고유성: N/A — 시각 정체성 변경이 아닙니다.

Remove the ambiguous ratio heuristic that made adjacent percentage values jump from 100% to 2%. Align EmailDetail fixtures with the backend's documented 0-100 response contract.

Assisted-by: OpenAI Codex
Signed-off-by: Seongho Bae <me@seonghobae.me>
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 1ffce182-bb4c-422c-aa0d-c6a221c092a8

📥 Commits

Reviewing files that changed from the base of the PR and between 042b0c7 and 9d2a6ea.

📒 Files selected for processing (3)
  • frontend/src/components/EmailDetail.test.tsx
  • frontend/src/lib/confidence.test.ts
  • frontend/src/lib/confidence.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The confidence formatter now treats finite inputs as literal percentages, clamps them to 0–100, and rounds them. Unit tests and EmailDetail mocks now use percentage-based confidence values.

Changes

Confidence Percentage Contract

Layer / File(s) Summary
Update confidence percentage formatting
frontend/src/lib/confidence.ts, frontend/src/lib/confidence.test.ts
toConfidencePercent now clamps and rounds raw percentage values without multiplying fractions by 100. Tests cover the updated contract and rounding behavior.
Align EmailDetail test fixtures
frontend/src/components/EmailDetail.test.tsx
Summarize mocks now use integer confidence percentages that match the expected UI labels.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 9d2a6

Confidence values are now displayed as backend-provided percentages rather than inferred ratios, preventing fractional values from being shown as incorrect percentages. The updated tests cover the formatter behavior and EmailDetail mock responses, with no remaining merge-readiness risk identified.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: updating frontend confidence handling to follow the backend percentage contract.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/confidence-ratio-contract

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 marked this pull request as ready for review September 4, 2026 12:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 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-09-04T12:58:52.951002Z d75cfe7 Draft marked ready
ℹ️ 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.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Sep 4, 2026
@seonghobae
seonghobae enabled auto-merge (squash) September 4, 2026 12:39

@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: 9d2a6ea892

ℹ️ 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 frontend/src/lib/confidence.ts Outdated
Keep pilot and full-product buyer flows on the backend's 0-100 confidence contract so screenshots and product events do not report 1% for an 86% result.

Assisted-by: OpenAI Codex
Signed-off-by: Seongho Bae <me@seonghobae.me>
@seonghobae
seonghobae marked this pull request as draft September 4, 2026 12:44
auto-merge was automatically disabled September 4, 2026 12:44

Pull request was converted to draft

@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: a081359a29

ℹ️ 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 frontend/src/lib/confidence.ts Outdated
Record the backend 0-100 integer contract so copied frontend and smoke fixtures cannot silently reintroduce ratio values.

Assisted-by: OpenAI Codex
Signed-off-by: Seongho Bae <me@seonghobae.me>
@seonghobae
seonghobae marked this pull request as ready for review September 4, 2026 12:52
@seonghobae
seonghobae marked this pull request as draft September 4, 2026 12:52
@seonghobae
seonghobae marked this pull request as ready for review September 4, 2026 12:56
@seonghobae
seonghobae marked this pull request as draft September 4, 2026 15:43
Co-Authored-By: Codex <codex@openai.com>
Signed-off-by: Seongho Bae <me@seonghobae.me>
@seonghobae

seonghobae commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Exact-head repair evidence for 9c90dea4832275aa5e127de5def1471f31c44ce9:

  • Root cause: unit inference was removed, but the display helper still clamped malformed values outside the backend 0–100 contract; 150 could become a false 100% confidence claim.
  • Repair: reject non-finite and out-of-range values at the shared display boundary while preserving percentage rounding and positive-zero normalization.
  • Focused evidence: 30 Vitest tests, TypeScript --noEmit, ESLint, and git diff --check pass. Hosted exact-head Checks and independent re-review remain separate gates.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Current-head boundary audit found that the documented integer 0–100 contract was still not enforced: non-integer payloads were silently rounded (0.8561%, 85.586%). Fixed once in the shared toConfidencePercent boundary at 4d6b697e97f7f0d98700292680970b41e7b12c48; it now rejects non-finite, non-integer, negative, and >100 values while preserving -0 normalization. Focused Vitest: 28 passed; TypeScript, ESLint, and diff checks pass. Exact-head hosted state is 21 queued / 5 skipped / 0 failures, so the PR remains Draft pending independent review and terminal required checks.

seonghobae added a commit that referenced this pull request Sep 5, 2026
Integrate the two recorded AGENTS recurrence rules from product PRs #1559 and #1300 into the existing documentation owner. Preserve the full predecessor delta and built-in execution path; no product runtime, release, or protected merge is claimed.

Co-Authored-By: Codex <noreply@openai.com>
Signed-off-by: Seongho Bae <me@seonghobae.me>
@seonghobae seonghobae added bug Something isn't working priority: medium Normal-priority or P2 work type: bug Defect or incorrect behavior labels Sep 7, 2026 — with ChatGPT Codex Connector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority: medium Normal-priority or P2 work type: bug Defect or incorrect behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant