Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Chen17-sq/clearscript
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.0.11
Choose a base ref
...
head repository: Chen17-sq/clearscript
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.0.12
Choose a head ref
  • 3 commits
  • 21 files changed
  • 1 contributor

Commits on May 23, 2026

  1. test: comprehensive coverage sweep + 2 real bug fixes uncovered by tests

    97 → 177 tests this session (added 57 in this commit).
    
    ## Two real bugs caught by writing tests:
    
    1. **CLI rerun command crashed on import.**
       `clearscript projects rerun <slug>` imported TxtAdapter from
       `clearscript.ingest`, but that module only re-exports IngestAdapter
       and registry helpers — TxtAdapter lives in `clearscript.ingest.txt`.
       The web-API path works because it uses _FORMAT_ADAPTERS directly.
       Fixed by importing from the right submodule.
    
    2. **reject_term() never actually deprecated terms.**
       The schema defines a 'deprecated' status and `all_terms_in_domain`
       filters by `status != 'deprecated'`, but `reject_term` only updated
       reject_count + confidence — it never set status. So rejected terms
       kept resurfacing in subsequent library-context blocks. Fixed by
       flipping status to 'deprecated' on explicit reject.
    
    3. **rerun endpoint crashed when original provider was removed from config.**
       If a user ran v0.0.10 with provider X, then renamed/removed it,
       /api/projects/<slug>/rerun would 400 with "Provider 'X' not
       configured". Fixed by falling back to current default when the
       original's provider isn't in config anymore.
    
    ## New test files
    
    - **test_server.py** (33 tests) — TestClient-driven coverage of every
      HTTP endpoint: health/providers/example, /api/run sync + SSE stream,
      /api/run-file multipart, projects CRUD + transcript download,
      /api/projects/{slug}/rerun including provider-fallback case, library
      terms/speakers/patterns CRUD, accept-suggestions (Mode B), docx
      export, cost preview.
    - **test_provider_streaming.py** (5 tests) — verifies _BaseProvider's
      default chat_with_progress correctly wraps stream() into the
      (delta, payload)+ / (done, ChatResponse) protocol the pipeline expects.
    - **Extended test_cost.py** with 5 actual_cost() tests (the v0.0.9
      function had zero coverage).
    - **Extended test_cli.py** with 6 tests including end-to-end CLI rerun.
    - **Extended test_library.py** with 7 edge cases: lookup_alias for
      canonical, FTS partial matching, reject deprecation, delete cleans
      aliases, speaker re-add appends, pagination.
    - **Extended test_pleasantry_filter.py** with 7 _slug_hint_from_input
      tests covering title/filename/briefing/transcript priority order.
    
    All 177 tests pass. Ruff clean.
    Chen17-sq committed May 23, 2026
    Configuration menu
    Copy the full SHA
    1de8623 View commit details
    Browse the repository at this point in the history
  2. test: parser edge cases + library updates + end-to-end compounding loop

    Coverage push #2: 177 → 191 tests.
    
    ## New tests
    
    **tests/unit/test_pipeline.py** — 5 new:
    - _split_output handles model output with no delimiters (return raw)
    - _split_output survives malformed JSON in changelog section
    - _split_output filters non-dict entries inside the JSON arrays
    - _dedupe_suggestions collapses by kind+canonical (case-insensitive)
    - _dedupe_suggestions skips items with no identity
    
    **tests/unit/test_library.py** — 6 new:
    - update_term replaces (not appends to) the alias set
    - update_term changes domain end-to-end
    - update_speaker changes display label
    - Aliases are case-sensitive by design (lowercase variants don't match)
    - add_negative is idempotent on (text, do_not_change_to)
    - finish_session persists token counts
    
    **tests/integration/test_library_loop.py** — 3 new, the headline:
    - test_full_compounding_loop — proves the "library that compounds"
      claim end-to-end: run produces suggestion → accept-suggestions
      persists it → next run's system prompt actually contains the new
      mapping. If this test breaks, the product's central promise breaks.
    - test_rerun_uses_updated_library — re-running an old project against
      the freshly-updated library pulls the new mapping into the prompt.
    - test_seed_pack_terms_already_available_on_fresh_install — the 17
      seed terms (Dify/DeFi etc.) are usable on the very first run.
    
    All 191 tests pass. Ruff clean.
    Chen17-sq committed May 23, 2026
    Configuration menu
    Copy the full SHA
    9d9484f View commit details
    Browse the repository at this point in the history
  3. v0.0.12 — library as portable artifact + bulk ops + SDK-level tests

    The library was trapped in a SQLite file at
    ~/Documents/clearscript/data/library/library.db. v0.0.12 makes it a
    first-class portable artifact, plus a sweep of UX polish and the
    provider-SDK test coverage gap that was lurking.
    
    ## What ships in this release
    
    1. **Library export / import** — both /api endpoints and CLI:
       - clearscript lib export <path>   → writes versioned JSON
       - clearscript lib import <path>   → merges (union of aliases)
       - Format marker so future versions detect incompatible files
       - Deprecated (rejected) terms excluded from export — sharing your
         library won't dump your rejections onto a teammate
    
    2. **CLI lib search** — FTS5 partial-match search to complement the
       existing exact-alias `lib lookup`
    
    3. **Bulk operations**
       - POST /api/library/terms/bulk-delete (cascades to aliases)
    
    4. **Rerun-of UI badge** — every project summary now exposes rerun_of;
       the web UI renders a ↻ rerun badge on cards with a tooltip pointing
       to the original slug. Provenance visible at a glance.
    
    5. **Real-SDK provider tests** (test_provider_sdks.py, 7 tests).
       AnthropicProvider and OpenAICompatProvider previously only got
       exercised via _BaseProvider fallbacks; the actual SDK call shapes
       were untested. Now covers:
       - Anthropic: messages.create kwargs, system extraction, multi-
         system concatenation, non-text content blocks, streaming with
         final-message usage capture
       - OpenAI-compat: chat.completions.create with include_usage in
         stream_options, fallback when usage missing
    
    ## Tests
    
    191 → 217. All passing. Ruff clean.
    
    Files: 9 new tests in test_library.py, 6 in test_server.py, 6 in
    test_cli.py, 7 in new test_provider_sdks.py.
    Chen17-sq committed May 23, 2026
    Configuration menu
    Copy the full SHA
    35a43f0 View commit details
    Browse the repository at this point in the history
Loading