Skip to content

refactor: schema region consolidation + playback cap + deep-agent fold - #196

Merged
EtienneLescot merged 4 commits into
release/v1.8.0from
ponytail/schema-and-module-cleanup
Jul 29, 2026
Merged

refactor: schema region consolidation + playback cap + deep-agent fold#196
EtienneLescot merged 4 commits into
release/v1.8.0from
ponytail/schema-and-module-cleanup

Conversation

@EtienneLescot

@EtienneLescot EtienneLescot commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

refactor: schema region consolidation + playback cap + deep-agent fold

Pure refactor that bundles three related shrinkages from the v1.8.0 ponytail
audit. No behavior change visible to the user; the public types and the
schema-version contract are byte-identical.

Changes

  1. src/lib/ai-edition/schema/index.ts — region-schema refine helper

    Five near-identical region schemas (rangeSchema, trimRangeSchema,
    gapSchema, annotationRegionSchema, zoomRegionSchema) all carried
    the same .refine((data) => data.end >= data.start) clause with
    field-name-keyed message + path. Extracted a small generic endGteStart
    helper that takes the schema and the two field keys, and threaded the
    five call sites through it. The parse output (including the error
    message + path) is byte-identical to the pre-refactor wire format.

  2. src/components/video-editor/types.tsMAX_PLAYBACK_SPEED = 16

    The 100× editor cap is unreachable in the HTMLMediaElement path:
    Chromium hard-caps playbackRate at 16 (the comment at the constant
    already documents this). The 16–100 range is the export-time stretch
    path, and the same clampPlaybackSpeed was used for both preview and
    export, so the input parser allowed values the preview can't render.
    Dropped the cap to MAX_NATIVE_PLAYBACK_RATE = 16, and the existing
    clampPlaybackSpeed now rounds + clamps to that tighter ceiling. A
    50× entry now clamps to 16 instead of 100.

    SpeedControl.test.tsx and customPlaybackSpeed.test.ts had
    boundary cases that pinned the 100 ceiling — updated mechanically
    to pin 16 (the new max, with a "16.1 is too-fast" case to assert the
    new behavior, replacing the "16.1 is valid" case the old 100 cap
    allowed).

  3. electron/ai-edition/deep-agent/ — fold capability table into chat-model.ts

    agent-provider-capabilities.ts (capability tables, reasoning-effort
    normalization, thinking-block wiring for OpenAI/Anthropic/MiniMax/
    OpenRouter/Google) was only consumed by chat-model.ts. Folded the
    file's contents into the top of chat-model.ts as a "per-provider
    reasoning-effort capability table" section, and deleted the standalone
    file. The service.ts (deep-agent runtime) and its chat-service.ts
    consumer are unchanged — they own a different concern (the LangGraph
    thread + tool graph), not the chat-model factory. The capability
    tests at agent-provider-capabilities.test.ts keep their path and
    were re-pointed at ./chat-model; the suite still passes 17/17.

Diff stat

 8 files changed, 332 insertions(+), 317 deletions(-)
 delete mode 100644 electron/ai-edition/deep-agent/agent-provider-capabilities.ts

Type

  • Refactor / maintenance
  • Bug fix
  • New feature
  • Documentation

Severity

  • Major
  • Minor
  • Patch

Platform

  • Not platform-specific
  • macOS only
  • Windows only
  • Linux only

Testing

  • npx tsc --noEmit — clean exit 0.
  • npm run test1144 / 1144 pass, identical to the v1.8.0
    baseline.
  • npm run lint — 0 errors, 0 new warnings (7 pre-existing warnings in
    NewProjectModal.test.tsx, rafCoalesce.test.ts,
    useNativeCompositorView.ts; all in files untouched by this PR).
  • src/lib/ai-edition/schema/index.test.ts — 31/31 pass without
    modifying test expectations; the parse output is byte-identical for
    representative inputs (rangeSchema, trimRangeSchema, gapSchema,
    annotationRegionSchema, zoomRegionSchema).
  • electron/ai-edition/deep-agent/ — 17/17 pass after the fold
    (capability tests + chat-model tests).

No manual smoke test required: changes 1 and 3 are pure refactors with
byte-identical parse output; change 2 is a constant tighten that
only affects the input-parser ceiling (the 16–100× export path is
unchanged, the input parser now rejects what the preview can't render).

Notes for reviewer

  • MAX_PLAYBACK_SPEED and MAX_NATIVE_PLAYBACK_RATE are kept as
    separate exported names with the same value. The renderer
    (VirtualPreview.tsx) reads MAX_NATIVE_PLAYBACK_RATE and the
    parser/persistence read MAX_PLAYBACK_SPEED; merging them is a
    rename, not a refactor, and was left for a follow-up.
  • The endGteStart helper is a single-call-site style: each region
    schema calls it once with its own endKey/startKey. The 3-line
    factory shape suggested in the audit was rejected because gapSchema
    uses timelineStartSec/timelineEndSec (not startSec/endSec),
    so a 'Ms' | 'Sec' key factory wouldn't fit cleanly.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 71b31df2-8a49-4834-93fb-e498b5c92f1b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ponytail/schema-and-module-cleanup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

sepion02 and others added 3 commits July 28, 2026 20:30
- llm-providers.md pointed at agent-provider-capabilities.ts, which this PR
  folded into chat-model.ts; the Docs check was failing on the dead link.
- Rename the orphaned test file to match its subject.
- The cap comment claimed a 50x entry 'clamps to 16'. It does not: the parser
  REJECTS it and the field reverts. Note that the bound is editor-input only,
  so agent-authored regions can still exceed it.
- normalizeProjectEditor discarded an out-of-range saved speed and fell back to
  the 1.5x default; clamp it to the cap instead. Lowering MAX_PLAYBACK_SPEED
  widened that silent-reset window from (100,inf) to (16,inf).
The cap change was a user-facing feature revert riding in a cleanup PR: it
undid the editor half of 27363e7 (feat: raise playback-speed cap to 100x,
Closes #79), whose frame-stepped preview and WSOLA offline stretch are all
still in the tree. Above 16x the preview frame-steps by seeking rather than
using HTMLMediaElement.playbackRate, so 16 was never the real ceiling.

Restores MAX_PLAYBACK_SPEED, the FloatingInspector doc, and the three test
expectations to base. Also drops the normalizeProjectEditor clamp tweak, whose
only rationale was the widened silent-reset window the lower cap created.

PR196 is now pure cleanup: refine-helper extraction, deep-agent fold, doc link.
@EtienneLescot
EtienneLescot merged commit d7439c2 into release/v1.8.0 Jul 29, 2026
8 of 9 checks passed
@EtienneLescot
EtienneLescot deleted the ponytail/schema-and-module-cleanup branch July 29, 2026 08:39
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.

2 participants