Neutral AI badge fallback and docs for configurable prompts #103
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/issue-100-badge-and-docs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Sub-PR 3 of 3 for the domain-agnostic AI classification effort (#100).
What
AI: reject — promotional→AI: reject — text— a reject with no vision category is a text-stage reject, and "promotional" presumes the cat-topic default.text_flagged/vision_accepted):docs/architecture/models.md,docs/architecture/design.md,docs/user-guide/automated-scheduling.md.docs/user-guide/ai-classification.md: documents the editable prompts (settings-page textareas, JSON contract appended by code, future-fetches-only semantics) and the neutral verdict fields; badge table updated.automated-scheduling.md(the Moonshot Batch API pipeline no longer exists — classification runs inline on each fetch batch) and the last mention inreview.md;automated-scheduling.mdoverview and fetch-pipeline sections now include the AI classification steps.ai_classification.py/ai_pipeline.py.Notes
docs/api/posts.mdneeded no change — it documents only the unchanged field names.Refs #100
WuMing
Found 2 issue(s). See inline comments below.
@ -916,0 +922,4 @@"""A reject with no vision category renders the text-stage label."""view = ReviewLiveView()view.socket = MagicMock()badge = view._render_ai_badge({"ai_would_reject": True, "vision_category": None})code [HIGH]
The post dict passed to _render_ai_badge omits ai_classified_at. Based on the pending return immediately above the changed reject branch in liveviews.py, _render_ai_badge likely returns the 'AI: pending' badge when ai_classified_at is absent, so this assertion never reaches the reject fallback label and the test will fail. Add a truthy ai_classified_at value (e.g., datetime.utcnow()) to the dict.
@ -916,0 +931,4 @@"""A vision-stage reject renders the model's category."""view = ReviewLiveView()view.socket = MagicMock()badge = view._render_ai_badge({"ai_would_reject": True, "vision_category": "comic"})code [HIGH]
Same issue as the first test: the post dict omits ai_classified_at, so _render_ai_badge is likely to take the pending path and never render the vision category reject badge. Add a truthy ai_classified_at field to exercise the reject branch.
🔴 Not actioned —
_render_ai_badgedoes not readai_classified_attests/test_liveviews.py·tests/test_liveviews.pyTwo pieces of evidence against:
ai_classified_atcheck._render_ai_badgebranches only onai_would_reject: the pending badge is returned whenpost.get("ai_would_reject") is None. Both tests passai_would_reject: True, so the reject branch runs.ai_classified_atappears nowhere in the function (verified by reading the source and grepping the function body).AI: reject — promotional; after changing the fallback totextit passes. If the pending path were taken,"AI: reject — text" in badgewould fail — the full suite is green (556 tests).