Skip to content

Add genre selector for publish, fix genre detection#170

Merged
realproject7 merged 3 commits intomainfrom
task/169-fix-genre-detection
Apr 24, 2026
Merged

Add genre selector for publish, fix genre detection#170
realproject7 merged 3 commits intomainfrom
task/169-fix-genre-detection

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • Adds a genre dropdown selector in PreviewPanel (shown for genesis files) using the GENRES list from lib/genres.ts
  • Auto-detects genre from structure.md as default (improved regex handles **Genre:** format too)
  • User can override genre before publishing — eliminates "Uncategorized" fallback
  • Removes fragile auto-detection from handlePublish in StoriesPage; genre now flows from UI

Fixes #169

Test plan

  • Open a genesis file — genre dropdown appears next to Publish button
  • Verify auto-detection populates dropdown from structure.md genre field
  • Override genre via dropdown, publish — verify correct genre on plotlink.xyz
  • Open a plot file — no genre dropdown shown (genre inherited from genesis)
  • Verify no "Uncategorized" genre after publishing

🤖 Generated with Claude Code

…cture.md

Replace unreliable regex-only genre detection with a dropdown
that lets the user pick from the allowed genres list. Auto-detects
genre from structure.md as a default but user can override before
publishing. Genre selector shown only for genesis files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

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

Verdict: REQUEST CHANGES

Summary

The genre selector is a reasonable direction for issue #169, but the current implementation regresses the existing plot retry-publish flow.

Findings

  • [high] StoriesPage now requires handlePublish(storyName, fileName, genre), but the existing Retry Publish path in PreviewPanel still calls onPublish?.(storyName, fileName) for plot files without supplying a genre. That means retry-publishing a plot after published-not-indexed now sends an undefined genre instead of the previous structure-derived value, which can reintroduce incorrect genre metadata or break the request depending on the backend expectations.
    • File: app/web/components/PreviewPanel.tsx:434, app/web/components/StoriesPage.tsx:180
    • Suggestion: preserve the previous publish behavior for non-genesis files by continuing to derive/pass a valid genre for retry-publish flows, or keep the old fallback logic in handlePublish for cases where the UI does not provide one.

Decision

Requesting changes because the new UI fixes genesis publishing, but it regresses an existing publish path instead of preserving current behavior.

@realproject7
Copy link
Copy Markdown
Owner Author

@re2 Review — REQUEST CHANGES

Good approach — the genre dropdown with auto-detect is a solid UX improvement over the fragile inline detection. One bug:

🔴 Default selectedGenre value "Fiction" is not in the GENRES list

useState("Fiction") sets a default that doesn't exist in lib/genres.ts. The valid genres are: Romance, Fantasy, Science Fiction, Mystery, Thriller, Horror, Adventure, Historical Fiction, Contemporary Lit, Humor, Poetry, Non-Fiction, Fanfiction, Short Story, Paranormal, Werewolf, LGBTQ+, New Adult, Teen Fiction, Diverse Lit, Others.

This means:

  • The <select> renders with a value that doesn't match any <option>, so the browser may show the first option visually while the state holds "Fiction"
  • If the user publishes without changing the dropdown, "Fiction" gets sent as the genre — which isn't in the allowed list

Fix: Default to GENRES[0] (i.e. "Romance") or "Others" — whichever makes the most sense as a fallback. The auto-detect effect will override it when structure.md has a valid genre anyway.

✅ Everything else looks good

  • Improved regex handles **Genre:** markdown formatting — correct
  • Case-insensitive match against GENRES list prevents garbage values — good
  • Cleanup with cancelled flag — proper React pattern
  • Genre dropdown only shown for genesis — correct
  • Old fragile detection removed from handlePublish — clean
  • Version bump 1.0.24 → 1.0.25 — correct

One fix, then APPROVE.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

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

Verdict: REQUEST CHANGES

Summary

The retry-publish regression I raised is fixed on the current head, but one UI/data-validity blocker still remains.

Findings

  • [high] PreviewPanel still initializes selectedGenre with "Fiction", but lib/genres.ts does not include "Fiction" in the allowed GENRES list. That leaves the <select> with a value that does not match any option, and publishing without changing the dropdown can still send an invalid genre.
    • File: app/web/components/PreviewPanel.tsx:38, lib/genres.ts:1
    • Suggestion: initialize from a valid list entry such as GENRES[0] or "Others", then let auto-detection override it when structure.md provides a recognized genre.

Decision

Keeping this in request-changes state until the dropdown defaults to a valid allowed genre.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

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

Verdict: COMMENT

Summary

The latest head fixes the invalid default genre by initializing from GENRES[0]. I found no remaining code blockers in the current publish-genre flow.

Findings

  • No remaining code blockers on the current diff.

Decision

Holding final approval until the current lint-and-typecheck run is green.

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

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

Verdict: APPROVE

Summary

The current head fixes the genre-selection issue for genesis publishing, preserves the retry-publish path, and now defaults the dropdown to a valid allowed genre. The implementation satisfies issue #169 without leaving the previous Uncategorized behavior in place.

Findings

  • No remaining blocking issues.

Decision

Approving because the implementation meets the acceptance criteria and lint-and-typecheck passed on the current head.

@realproject7
Copy link
Copy Markdown
Owner Author

@re2 Re-review — APPROVE ✅

All issues addressed:

  1. Invalid default genre (my original request) — now GENRES[0] instead of "Fiction". Fixed.
  2. Retry-publish missing genre arg (@re1's catch) — plot retry path now passes selectedGenre. Fixed.

CI green. No blockers.

APPROVE

@realproject7 realproject7 merged commit 20ea1de into main Apr 24, 2026
1 check passed
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.

[Bug] Genre not detected from structure.md — published as Uncategorized

2 participants