2.1.0: modal and bulk subreddit folder/theme assignment #13

Merged
nimmo merged 1 commit from feat/12-bulk-subreddit-assignments into main 2026-10-02 16:17:08 +01:00
Owner

Changes

  • Implement CUR-11: Folder and Themes open draft modals for individual subreddit cards.
  • Add Assign folders and Assign themes for multi-selected subreddits.
  • Bulk themes add by default, with an explicit Overwrite existing themes toggle; single editing begins with existing themes selected.
  • Apply validates the complete selection and saves atomically; Cancel leaves assignments unchanged. Errors stay inside the dialog and retain the draft.
  • Folder assignment updates routing only. Media movement remains a separate explicit action.
  • Add generated OpenAPI schemas for preview and batch assignment; align VERSION/package/changelog at 2.1.0.

Evidence

  • Four focused API tests first failed with missing routes, then passed validation, atomicity, idempotence, additive/overwrite/clear behavior, synchronized folder routing and no implicit file movement.
  • Focused Chromium test first failed awaiting the modal, then passed drafts, cancellation, single/bulk assignment, additive default, overwrite and failed-save feedback.
  • Updated gallery Chromium smoke passes with the new explicit Apply workflow.
  • NVIDIA package build/install gate passes 148 Node and 30 Python tests. Existing migration fixture ResourceWarnings remain unchanged.

Acceptance

CUR-11 is Awaiting live test. Representative user acceptance is still pending; the existing Lyra 2.0.0 services have not been replaced by this feature build.

Related to #12.

## Changes - Implement CUR-11: Folder and Themes open draft modals for individual subreddit cards. - Add Assign folders and Assign themes for multi-selected subreddits. - Bulk themes add by default, with an explicit Overwrite existing themes toggle; single editing begins with existing themes selected. - Apply validates the complete selection and saves atomically; Cancel leaves assignments unchanged. Errors stay inside the dialog and retain the draft. - Folder assignment updates routing only. Media movement remains a separate explicit action. - Add generated OpenAPI schemas for preview and batch assignment; align VERSION/package/changelog at 2.1.0. ## Evidence - Four focused API tests first failed with missing routes, then passed validation, atomicity, idempotence, additive/overwrite/clear behavior, synchronized folder routing and no implicit file movement. - Focused Chromium test first failed awaiting the modal, then passed drafts, cancellation, single/bulk assignment, additive default, overwrite and failed-save feedback. - Updated gallery Chromium smoke passes with the new explicit Apply workflow. - NVIDIA package build/install gate passes 148 Node and 30 Python tests. Existing migration fixture ResourceWarnings remain unchanged. ## Acceptance CUR-11 is Awaiting live test. Representative user acceptance is still pending; the existing Lyra 2.0.0 services have not been replaced by this feature build. Related to #12.
feat: add modal and bulk subreddit assignments for 2.1.0
All checks were successful
Build and Push Attic Cache / build (pull_request) Successful in 35s
AI pull-request review / review (pull_request) Successful in 2m1s
Build and Push Attic Cache / build (push) Successful in 3m59s
53f0e09d5d
Author
Owner

Automated code review

Reviewed commit: 53f0e09d5d89ca51c23a06bab25a6857b9498ca8

Verdict: Requires further work

Resolve the blocking or important findings and investigate failed deterministic checks before merging.

Overall assessment

This PR implements CUR-11, adding modal-based folder and theme assignment for subreddits in Redview v2.1.0. It introduces new API endpoints (/api/subreddits/assignments/preview and /api/subreddits/assignments) and a React dialog component to handle single and bulk assignments. The implementation supports atomic updates, additive theme logic with an explicit overwrite toggle, and ensures folder assignment only changes routing metadata without moving files. Tests confirm the new behavior, including draft/cancel workflows and error handling.

Blocking findings

None.

Important findings

  • Inconsistent Folder ID Handling in Dialog (web/src/subreddit-assignment-dialog.tsx:68; medium confidence)
    const fields = mode === 'folder' ? { folder_id: folderId === '' ? null : Number(folderId) } ...
    Impact: The dialog uses a special sentinel value '__choose' for the folder select when assignments are mixed. While this prevents submission, the conversion logic Number(folderId) will result in NaN if folderId is not a valid number string (other than empty). Although the UI controls this via the select element, relying on Number() without validation is fragile.
    Suggested fix: Validate that folderId is a valid integer before conversion or use parseInt(folderId, 10) with an explicit check for NaN.

Suggestions

  • Missing Accessibility Label for Bulk Theme Overwrite Toggle (web/src/subreddit-assignment-dialog.tsx:96; high confidence)
    <input type="checkbox" aria-label="Overwrite existing themes" ... /> Overwrite existing themes
    Impact: The checkbox has an aria-label, but the label text is also visible. This is generally fine, but ensure screen readers announce the state correctly. The current implementation is acceptable.
    Suggested fix: No action required, but verify with a screen reader that the toggle state is clear.

  • Hardcoded Limit in API Schema (src/app.ts:2013; medium confidence)
    theme_ids: { type: 'array', maxItems: 100, items: { type: 'integer', minimum: 1 } },
    Impact: The API schema limits theme assignments to 100 per request. This is a reasonable safeguard but should be documented or configurable if the system expects larger batches.
    Suggested fix: Consider making this limit configurable or documenting it in the API spec comments.

Tests and validation

  • package-checks: success

Questions

  • Does the 'Apply and move media' button in the single-subreddit folder assignment dialog correctly handle cases where the move job is already running?
  • Are there any known issues with the subreddit_folder_map table synchronization when using the new bulk assignment API?

Review limitations

  • This review is based on the provided diff and documentation. Live testing or integration with the full production environment was not performed.
  • The security implications of the new API endpoints were assessed based on schema validation, but runtime behavior under load or with malicious input was not tested.

Diff coverage

  • CHANGELOG.md: reviewed — included in a context-limited batch
  • PRIORITIES.md: reviewed — included in a context-limited batch
  • REQUIREMENTS-TRACE.md: reviewed — included in a context-limited batch
  • REQUIREMENTS.md: reviewed — included in a context-limited batch
  • VERSION: reviewed — included in a context-limited batch
  • package.json: reviewed — included in a context-limited batch
  • scripts/browser-gallery-smoke.mjs: reviewed — included in a context-limited batch
  • scripts/browser-subreddit-assignments.mjs: reviewed — included in a context-limited batch
  • src/app.ts: reviewed — included in a context-limited batch
  • tests/subreddit-assignments.test.mjs: reviewed — included in a context-limited batch
  • web/src/main.tsx: reviewed — included in a context-limited batch
  • web/src/style.css: reviewed — included in a context-limited batch
  • web/src/subreddit-assignment-dialog.tsx: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: qwen3.6:35b-a3b-q8_0
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, README.md
  • Commits considered: 1
  • Previous automated review: none found
  • Findings: 3
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `53f0e09d5d89ca51c23a06bab25a6857b9498ca8` ## Verdict: Requires further work Resolve the blocking or important findings and investigate failed deterministic checks before merging. ### Overall assessment This PR implements CUR-11, adding modal-based folder and theme assignment for subreddits in Redview v2.1.0. It introduces new API endpoints (`/api/subreddits/assignments/preview` and `/api/subreddits/assignments`) and a React dialog component to handle single and bulk assignments. The implementation supports atomic updates, additive theme logic with an explicit overwrite toggle, and ensures folder assignment only changes routing metadata without moving files. Tests confirm the new behavior, including draft/cancel workflows and error handling. ### Blocking findings None. ### Important findings - **Inconsistent Folder ID Handling in Dialog** (web/src/subreddit-assignment-dialog.tsx:68; medium confidence) const fields = mode === 'folder' ? { folder_id: folderId === '' ? null : Number(folderId) } ... Impact: The dialog uses a special sentinel value '__choose' for the folder select when assignments are mixed. While this prevents submission, the conversion logic `Number(folderId)` will result in `NaN` if `folderId` is not a valid number string (other than empty). Although the UI controls this via the select element, relying on `Number()` without validation is fragile. Suggested fix: Validate that `folderId` is a valid integer before conversion or use `parseInt(folderId, 10)` with an explicit check for `NaN`. ### Suggestions - **Missing Accessibility Label for Bulk Theme Overwrite Toggle** (web/src/subreddit-assignment-dialog.tsx:96; high confidence) <label className="checkbox-label"><input type="checkbox" aria-label="Overwrite existing themes" ... /> Overwrite existing themes</label> Impact: The checkbox has an `aria-label`, but the label text is also visible. This is generally fine, but ensure screen readers announce the state correctly. The current implementation is acceptable. Suggested fix: No action required, but verify with a screen reader that the toggle state is clear. - **Hardcoded Limit in API Schema** (src/app.ts:2013; medium confidence) theme_ids: { type: 'array', maxItems: 100, items: { type: 'integer', minimum: 1 } }, Impact: The API schema limits theme assignments to 100 per request. This is a reasonable safeguard but should be documented or configurable if the system expects larger batches. Suggested fix: Consider making this limit configurable or documenting it in the API spec comments. ### Tests and validation - package-checks: **success** ### Questions - Does the 'Apply and move media' button in the single-subreddit folder assignment dialog correctly handle cases where the move job is already running? - Are there any known issues with the `subreddit_folder_map` table synchronization when using the new bulk assignment API? ### Review limitations - This review is based on the provided diff and documentation. Live testing or integration with the full production environment was not performed. - The security implications of the new API endpoints were assessed based on schema validation, but runtime behavior under load or with malicious input was not tested. ### Diff coverage - `CHANGELOG.md`: **reviewed** — included in a context-limited batch - `PRIORITIES.md`: **reviewed** — included in a context-limited batch - `REQUIREMENTS-TRACE.md`: **reviewed** — included in a context-limited batch - `REQUIREMENTS.md`: **reviewed** — included in a context-limited batch - `VERSION`: **reviewed** — included in a context-limited batch - `package.json`: **reviewed** — included in a context-limited batch - `scripts/browser-gallery-smoke.mjs`: **reviewed** — included in a context-limited batch - `scripts/browser-subreddit-assignments.mjs`: **reviewed** — included in a context-limited batch - `src/app.ts`: **reviewed** — included in a context-limited batch - `tests/subreddit-assignments.test.mjs`: **reviewed** — included in a context-limited batch - `web/src/main.tsx`: **reviewed** — included in a context-limited batch - `web/src/style.css`: **reviewed** — included in a context-limited batch - `web/src/subreddit-assignment-dialog.tsx`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: qwen3.6:35b-a3b-q8_0 - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, README.md - Commits considered: 1 - Previous automated review: none found - Findings: 3 </details>
Author
Owner

Pre-merge assessment of the advisory review at 53f0e09:

  • Folder ID concern: no reachable invalid numeric value was identified. The save guard rejects __choose before conversion; both Apply buttons also disable that state. Other select values are the explicit empty default or integer folder IDs from API schemas. The batch API independently validates integer IDs and enabled targets. Treating arbitrary internal-state injection as a present UI defect is unsupported by the current control flow.
  • Overwrite toggle already has both its enclosing visible label and aria-label; the review itself says no action required. Screen-reader acceptance is not claimed.
  • Limits are published in generated OpenAPI (maxItems: 100 themes, 1000 subreddit IDs), consistent with the existing single-theme route.
  • Apply-and-move disables for a known queued/running move job; the server also enforces duplicate/conflict checks. Folder-map synchronization, default clearing and no implicit movement are covered by focused tests.

Build and advisory workflow checks pass on this exact commit. The user explicitly requested merging; CUR-11 remains Awaiting live test and merging does not claim its acceptance or deployment.

Pre-merge assessment of the advisory review at 53f0e09: - Folder ID concern: no reachable invalid numeric value was identified. The save guard rejects `__choose` before conversion; both Apply buttons also disable that state. Other select values are the explicit empty default or integer folder IDs from API schemas. The batch API independently validates integer IDs and enabled targets. Treating arbitrary internal-state injection as a present UI defect is unsupported by the current control flow. - Overwrite toggle already has both its enclosing visible label and `aria-label`; the review itself says no action required. Screen-reader acceptance is not claimed. - Limits are published in generated OpenAPI (`maxItems: 100` themes, 1000 subreddit IDs), consistent with the existing single-theme route. - Apply-and-move disables for a known queued/running move job; the server also enforces duplicate/conflict checks. Folder-map synchronization, default clearing and no implicit movement are covered by focused tests. Build and advisory workflow checks pass on this exact commit. The user explicitly requested merging; CUR-11 remains Awaiting live test and merging does not claim its acceptance or deployment.
nimmo merged commit 53f0e09d5d into main 2026-10-02 16:17:08 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nimmo/redview!13
No description provided.