Skip to content

Redesign refute flow and function-call table; fix refute handler bugs - #154

Open
CoffeePoweredComputers wants to merge 1 commit into
masterfrom
refute-submit-flow-and-fct-ledger
Open

CoffeePoweredComputers wants to merge 1 commit into
masterfrom
refute-submit-flow-and-fct-ledger

Conversation

@CoffeePoweredComputers

Copy link
Copy Markdown
Owner

Summary

Three related UX/correctness changes to the problem-solving view, all verified live end-to-end.

Refute (counterexample) problems — submit-only flow

  • Removed the client-side "Test" step. RefuteInput now has a single Submit; every attempt is a real synchronous submission.
  • RefuteFeedback renders an enumerated attempt list (last 10, newest first) from submission history: the call tried (abs_val(x=0)), what it returned, and a ✓ DISPROVES / Claim holds / Error badge, plus a "Counterexample Found!" banner once solved.
  • ProblemSet.handleSyncSubmissionResult gains a refute branch (was MCQ-only).

Two pre-existing backend bugs fixed (handlers/refute/handler.py)

  1. serialize_result/extract_test_results read submission.type_specific_data — which is not a DB column (it only exists on the transient ProcessingResult), so per-attempt refute results were always empty. They now reconstruct the outcome by re-executing the reference solution against the stored raw_input, following the MCQ handler's precedent (refute grading is deterministic and in-process).
  2. _extract_function_name didn't handle def -prefixed signatures — "def abs_val(x: int) -> int" fell back to "f" and execution failed with "Function 'f' not defined". Regex now matches the frontend parser.

Function Call Table (prompt problems) — "Ledger" redesign

Replaces the cramped centered white-on-black grid: left-aligned larger type, syntax-colored calls (via the theme's --color-syntax-* tokens), green pill chips for return values, a primary-gradient header rule, and a hover row tint with accent tick. Theme tokens only — no hardcoded colors.

Accessibility (WCAG AA, ratios measured in-browser)

  • Table returns accent → --color-info (5.3:1); --color-primary-gradient-start measured 3.9:1
  • Refute DISPROVES badge → solid pill (6.0:1); attempt numbers / "claim holds" → --color-text-secondary (9.5:1); solved banner text → primary (12.2:1)
  • Also fixes problem-description markdown inheriting text-align: center from .main-content

Test plan

  • pytest tests/unit/test_handlers_refute.py — 70 pass (tests updated to the reconstruction contract)
  • pytest -m architecture — 51 pass
  • Frontend vitest run — 464 pass; eslint/stylelint/i18n-parity clean (en/es 1358/1358)
  • Live E2E via Playwright: submitted non-counterexample (x=5 → claim holds) and counterexample (x=0 → ✓ DISPROVES, problem completed); verified prompt table rendering
  • Light-mode visual spot-check (tokens flip automatically; dark mode verified — light mode is WIP per WCAG AA-compliant light mode color scheme #61)

🤖 Generated with Claude Code

Refute (counterexample) problems:
- Single Submit flow: remove the client-side Test step; every attempt is a
  real synchronous submission. RefuteFeedback now renders an enumerated
  list (last 10) of attempts from submission history — input tried, what
  it returned, and whether it disproved the claim.
- Fix RefuteHandler reading submission.type_specific_data, which is not a
  DB column: serialize_result/extract_test_results now reconstruct the
  outcome by re-executing the reference solution against raw_input
  (same pattern as the MCQ handler).
- Fix _extract_function_name to accept "def "-prefixed signatures,
  matching the frontend parser (previously fell back to "f" and failed
  execution for e.g. "def abs_val(x: int) -> int").
- ProblemSet: handle refute sync submission results (status, cache,
  notifications) instead of falling through to the MCQ branch.

Function Call Table (prompt problems) — "Ledger" redesign:
- Left-aligned, larger type, syntax-colored calls via --color-syntax-*
  tokens, green pill chips for return values, primary-gradient header
  rule, hover row tint with accent tick. Theme tokens only.

Accessibility (WCAG AA, measured):
- Returns accent → --color-info (gradient-start was 3.9:1 on striped rows)
- Refute badges/banner: solid pill for DISPROVES (6.0:1), secondary text
  for attempt numbers and "claim holds" (was #999 at ~4.3:1)

Also: left-align problem description markdown (was inheriting
text-align:center from .main-content), en/es locale updates, refute
handler unit tests updated to the reconstruction contract.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented Jul 15, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 7.61421% with 182 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../components/activities/feedback/RefuteFeedback.vue 0.00% 90 Missing ⚠️
...urplex/client/src/features/problems/ProblemSet.vue 0.00% 46 Missing ⚠️
...lex/client/src/components/ui/FunctionCallTable.vue 0.00% 33 Missing ⚠️
...t/src/components/activities/inputs/RefuteInput.vue 0.00% 11 Missing ⚠️
purplex/problems_app/handlers/refute/handler.py 88.23% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No 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.

2 participants