8000 Text where a type should be: AI job kind, validation errors, the mode a pass came from · Issue #302 · alexbeeken/skrongle-mini · GitHub
[go: up one dir, main page]

Skip to content

Text where a type should be: AI job kind, validation errors, the mode a pass came from #302

Backlog

Description

@alexbeeken

Three places where the program writes text and then reads meaning back out of it. One PR each.

1. AI job kind. ai::Request has revise, add_lesson, edit and translate as four Options (src/ai.rs:214-232). Dispatch is a 4-tuple match where an illegal combination is settled by the order of the arms (src/ai/queue.rs:265-272). Status mirrors it with four bools and heading() has 14 arms (src/ai.rs:282-299). Job functions return Result<(), String> and the kind of failure is read back from shared state (src/ai/queue.rs:276). phase is the English strings "Starting", "Done", "Stopped", sent to the page.
→ enum JobKind { Generate { resume_outline }, Revise { feedback }, AddLesson { brief }, Edit { feedback, lesson }, Translate { plan } } in both structs, and a JobError { text, kind }.

2. Validation errors. validate_lesson builds ContentError::Invalid(format!("{path}: {msg}")) (src/content.rs:1179). problems::field_of (src/problems.rs:456-506) recovers the field with starts("question"), has("vocabulary entr"), starts("this lesson has conjugations"). Rewording a message in content.rs silently drops the field and its hint.
→ ContentError::Rule { file, field: Field, msg }, set at each site; field_of goes.

3. Which mode. progress::VIA_SPRINT/STUDY/PLAY are "d", "k", "g"; the rest are bare literals "tutor", "agent", "legacy" (src/routes/tutor.rs:429, src/routes/progress.rs:272,414). activity::Mode is an enum with different keys, and Mode::of_key must accept both (src/activity.rs:114-121). The comment says the letters were kept so stored progress needs no migration; there is a migration framework now.
→ enum Via with as_str and parse, and a migration that rewrites the stored letters.

Smaller, same family: request fields parsed by hand as mode: String / kind: String (routes/sprint.rs:395, routes/games.rs:913, routes/tutor.rs:155, routes/courses/revise.rs:17, routes/courses/generate.rs:29), where a serde enum would do.

From the code review of 24 November 2026. Line numbers are as of 0.5.0 (2547b36).

Activity

  1. added
    review
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0