Skip to content

Comments

chore: port additional safe stale-PR updates#171

Merged
AAlp22 merged 7 commits intomasterfrom
fix/port-stale-prs-batch2
Feb 20, 2026
Merged

chore: port additional safe stale-PR updates#171
AAlp22 merged 7 commits intomasterfrom
fix/port-stale-prs-batch2

Conversation

@ysdede
Copy link
Owner

@ysdede ysdede commented Feb 20, 2026

Summary

Ports additional low-risk, still-valid work from stale open PRs onto current master.

Ported from stale PRs

Details

  • src/lib/audio/AudioSegmentProcessor.ts
    • Adds cachedSpeechSummary state cache.
    • Invalidates cache only when speech stats history changes.
  • src/lib/audio/AudioSegmentProcessor.test.ts
    • Adds test for proactive split behavior when segment exceeds maxSegmentDuration.
  • index.html, src/index.css, src/index.tsx, package.json
    • Remove external Google Fonts links/imports.
    • Import local @fontsource/* packages for existing fonts.
    • Tighten CSP by dropping fonts.googleapis.com and fonts.gstatic.com allowances.

Validation

  • npm test -- src/lib/audio/AudioSegmentProcessor.test.ts
  • npm run build

Scope boundaries

  • No changes to fragile transcription window/cursor/finalization logic.

Summary by Sourcery

Port safe changes from stale PRs to improve audio processing performance, increase test coverage, and self-host fonts while tightening CSP.

Enhancements:

  • Cache computed speech statistics summaries in AudioSegmentProcessor to avoid repeated recalculation on every stats update.
  • Self-host application fonts via @fontsource packages and remove reliance on Google Fonts CDN, tightening CSP to only allow self-hosted fonts.

Build:

  • Declare @fontsource font packages as runtime dependencies for self-hosted typography.

Tests:

  • Add coverage for proactive segment splitting when audio exceeds the configured max segment duration in AudioSegmentProcessor.

Summary by CodeRabbit

  • Chores

    • Migrated font delivery from external CDN to self-hosted packages, reducing third-party dependencies.
    • Strengthened Content-Security-Policy configuration for more restrictive resource loading controls.
  • Refactor

    • Enhanced audio segment processing efficiency through intelligent caching to reduce computational overhead.
  • Tests

    • Expanded test coverage for audio segment duration validation and segment splitting behavior.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 20, 2026

Reviewer's Guide

Introduces a cached speech statistics summary in AudioSegmentProcessor to avoid recomputing aggregates, adds a regression test for proactive long-segment splitting, and switches font loading from Google Fonts CDN to self-hosted @fontsource packages with a tightened CSP.

Sequence diagram for getStats speech summary caching in AudioSegmentProcessor

sequenceDiagram
    participant App
    participant AudioSegmentProcessor
    participant ProcessorState

    App->>AudioSegmentProcessor: getStats()
    AudioSegmentProcessor->>ProcessorState: read speechStats
    alt cached speech summary exists
        AudioSegmentProcessor->>ProcessorState: read cachedSpeechSummary
        AudioSegmentProcessor-->>App: StatsSummary with speech from cache
    else no cached summary
        AudioSegmentProcessor->>ProcessorState: compute averages from speechStats
        AudioSegmentProcessor->>ProcessorState: set cachedSpeechSummary
        AudioSegmentProcessor-->>App: StatsSummary with newly computed speech
    end

    App->>AudioSegmentProcessor: processAudioData(chunk, timestamp, energy)
    AudioSegmentProcessor->>ProcessorState: update speechStats
    AudioSegmentProcessor->>ProcessorState: set cachedSpeechSummary to null
Loading

Class diagram for updated AudioSegmentProcessor state and caching

classDiagram
    class AudioSegmentProcessor {
        -ProcessorState state
        -ProcessorOptions options
        +processAudioData(chunk : Float32Array, timestamp : number, energy : number) ProcessedSegment[]
        +getStateInfo() ProcessorState
        +getStats() StatsSummary
        -average(values : number[]) number
    }

    class ProcessorState {
        +inSpeech : boolean
        +speechStartTime : number
        +speechEnergies : number[]
        +silenceEnergies : number[]
        +speechStats : SegmentStats[]
        +silenceStats : SegmentStats[]
        +cachedSpeechSummary : StatsSummary
        +currentStats : CurrentStats
        +noiseFloor : number
        +recentEnergies : number[]
    }

    class SegmentStats {
        +duration : number
        +avgEnergy : number
        +energyIntegral : number
    }

    class StatsSummary {
        +avgDuration : number
        +avgEnergy : number
        +avgEnergyIntegral : number
    }

    class CurrentStats {
        +silence : StatsSummary
        +speech : StatsSummary
    }

    AudioSegmentProcessor --> ProcessorState
    ProcessorState --> SegmentStats
    ProcessorState --> StatsSummary : cachedSpeechSummary
    ProcessorState --> CurrentStats
    CurrentStats --> StatsSummary
Loading

File-Level Changes

Change Details Files
Cache computed speech stats summary in AudioSegmentProcessor to avoid repeated aggregation work in getStats.
  • Extend ProcessorState with a cachedSpeechSummary field initialized to null.
  • Invalidate cachedSpeechSummary whenever speechStats is appended to or trimmed.
  • Update getStats to reuse cachedSpeechSummary when present and populate it when computing speech summary.
src/lib/audio/AudioSegmentProcessor.ts
Add test coverage for proactive splitting of segments that exceed the configured maximum duration.
  • Create a scenario with continuous high-energy audio exceeding maxSegmentDuration.
  • Assert that at least one segment is emitted with duration near maxSegmentDuration while speech remains active.
  • Verify that internal state reflects an ongoing speech segment after the split.
src/lib/audio/AudioSegmentProcessor.test.ts
Replace Google Fonts CDN usage with self-hosted @fontsource fonts and tighten CSP accordingly.
  • Remove Google Fonts preconnect and stylesheet links from HTML.
  • Drop fonts.googleapis.com/fonts.gstatic.com allowances from CSP connect-src, font-src, and style-src directives.
  • Add @fontsource dependencies for existing font families in package.json and stop importing Google Fonts via CSS.
index.html
src/index.css
src/index.tsx
package.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The new proactive split test hardcodes firstSegment.duration to be >= maxDuration, which is a bit brittle given processing quantization; consider asserting the duration is close to maxDuration within a small tolerance instead of requiring it to exceed it.
  • You’ve added caching for speechStats summaries but not for silenceStats; if the same hot path patterns exist there, you might want to either cache both for symmetry or explicitly document why only speech is cached.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new proactive split test hardcodes `firstSegment.duration` to be `>= maxDuration`, which is a bit brittle given processing quantization; consider asserting the duration is close to `maxDuration` within a small tolerance instead of requiring it to exceed it.
- You’ve added caching for `speechStats` summaries but not for `silenceStats`; if the same hot path patterns exist there, you might want to either cache both for symmetry or explicitly document why only speech is cached.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Repository owner deleted a comment from coderabbitai bot Feb 20, 2026
@ysdede
Copy link
Owner Author

ysdede commented Feb 20, 2026

Applied the valid test-brittleness feedback in the latest push.

Applied:

  • Updated the proactive split assertion to use tolerance around maxDuration (accounts for chunk quantization), instead of requiring duration >= maxDuration.

Not applied in this PR:

  • Added silence-summary caching symmetry. I kept scope narrow to the validated speech-path hotspot and avoided expanding runtime behavior in this batch.

Validation run:

  • npm test -- src/lib/audio/AudioSegmentProcessor.test.ts

Repository owner deleted a comment from coderabbitai bot Feb 20, 2026
src/index.tsx Outdated
import '@fontsource/plus-jakarta-sans/latin-600.css';
import '@fontsource/jetbrains-mono/latin-400.css';
import '@fontsource/jetbrains-mono/latin-500.css';
import '@fontsource/material-symbols-outlined/latin-400.css';
Copy link

Choose a reason for hiding this comment

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

WARNING: @fontsource/material-symbols-outlined variable font — only weight-400 loaded

The original Google Fonts URL loaded Material Symbols as a variable font with both the weight axis (wght@100..700) and the fill axis (FILL@0..1):

https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1

The @fontsource/material-symbols-outlined package ships the font as a variable font, but latin-400.css only registers the wght=400 static slice. The FILL axis (used to toggle filled vs. outlined icon style) and the full weight range will be unavailable unless you import the variable font CSS instead:

Suggested change
import '@fontsource/material-symbols-outlined/latin-400.css';
import '@fontsource-variable/material-symbols-outlined';

Note: the variable-font package is @fontsource-variable/material-symbols-outlined (separate npm package). If icons currently render but look wrong (all filled or all outlined regardless of CSS), this is the cause. Verify icon rendering in the browser after this change.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Applied in 90f1eef. Switched from @fontsource/material-symbols-outlined/latin-400.css to @fontsource-variable/material-symbols-outlined/fill.css and updated the CSS family to Material Symbols Outlined Variable. This preserves variable-axis icon rendering while keeping payload smaller than full.css.

package.json Outdated
"vitest": "^4.0.18"
},
"dependencies": {
"@fontsource/crimson-pro": "^5.2.8",
Copy link

Choose a reason for hiding this comment

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

SUGGESTION: @fontsource packages belong in devDependencies, not dependencies

Vite bundles font CSS and WOFF2 files at build time — the @fontsource/* packages are build-time assets, not runtime dependencies. Moving them to devDependencies keeps the production dependency graph clean and avoids unnecessary installs in CI/CD environments that skip dev deps.

This is low-risk for a browser-only app (no server-side node_modules consumption), but it's the conventional placement for bundled assets.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Acknowledged. I did not move these font packages to devDependencies in this PR. Keeping them in dependencies is intentional for this app branch to avoid dependency-class churn while we are doing targeted stale-PR ports; it does not affect bundle/runtime behavior. If you want, I can open a separate cleanup PR to standardize dependency placement across the repo.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Applied in ab4465d. Moved all @fontsource packages from dependencies to devDependencies in this PR and revalidated build/tests.


if (this.state.speechStats.length > this.options.maxHistoryLength) {
this.state.speechStats.shift();
this.state.cachedSpeechSummary = null;
Copy link

Choose a reason for hiding this comment

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

SUGGESTION: Redundant cachedSpeechSummary = null assignment

The cache was already set to null at line 268 (immediately after the push). By the time execution reaches line 272, cachedSpeechSummary is already null, so this second assignment is a no-op.

Consider removing it to reduce noise:

Suggested change
this.state.cachedSpeechSummary = null;
this.state.speechStats.shift();

Alternatively, if you want to keep it as a defensive belt-and-suspenders guard, add a comment explaining the intent.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Applied in 90f1eef. Removed the redundant second cachedSpeechSummary = null inside the shift() block.

@kiloconnect
Copy link

kiloconnect bot commented Feb 20, 2026

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
src/lib/audio/AudioSegmentProcessor.ts 480 cachedSpeechSummary aliases stats.speech / currentStats.speech — store { ...stats.speech } to keep the cache independent
src/lib/audio/AudioSegmentProcessor.test.ts 108 splitTolerance = 0.1 is 20% of maxDuration = 0.5; tighten to 0.05 (one chunk boundary) to catch off-by-one regressions
Other Observations (not in diff)

Issues found in unchanged code or previously discussed that cannot receive new inline comments:

File Observation
src/index.tsx line 19 import '@fontsource-variable/material-symbols-outlined' loads the default index.css, which may only include the wght axis. The CSS in index.css uses font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24 — if the FILL/GRAD/opsz axes are not loaded, those settings are silently ignored. Verify whether full.css (all axes) is needed, or confirm the default export includes all axes for this package version.
src/lib/audio/AudioSegmentProcessor.ts No test covers the cachedSpeechSummary invalidation path (i.e., that stats recompute correctly after a new speech segment ends and the cache is cleared). The existing getStats defensive-copy test does not exercise the cache. Consider adding a test that calls getStats() before and after a speech segment ends to confirm the cached value is refreshed.
What Changed

This PR migrates web fonts from Google Fonts CDN to self-hosted @fontsource / @fontsource-variable npm packages, tightening the CSP by removing https://fonts.googleapis.com and https://fonts.gstatic.com from connect-src, font-src, and style-src. It also adds a cachedSpeechSummary field to AudioSegmentProcessor to avoid recomputing the speech stats summary on every updateStats() call, and adds a new test for proactive segment splitting.

Risk assessment: Low. The font migration is a straightforward build-time substitution with no runtime logic changes. The CSP tightening is a security improvement. The stats cache is a minor optimization in a non-hot path with correct invalidation logic. The new test covers a previously untested code path.

Files Reviewed (5 files)
  • index.html — CSP tightened (Google Fonts removed); no issues
  • package.json — font packages correctly placed in devDependencies; no issues
  • src/index.css — font-family updated to 'Material Symbols Outlined Variable'; no issues
  • src/index.tsx@fontsource imports added; 1 observation (see Other Observations)
  • src/lib/audio/AudioSegmentProcessor.tscachedSpeechSummary cache added; 1 suggestion (line 480)
  • src/lib/audio/AudioSegmentProcessor.test.ts — new split test added; 1 suggestion (line 108)

Fix these issues in Kilo Cloud

src/index.tsx Outdated
import '@fontsource/plus-jakarta-sans/latin-600.css';
import '@fontsource/jetbrains-mono/latin-400.css';
import '@fontsource/jetbrains-mono/latin-500.css';
import '@fontsource-variable/material-symbols-outlined/fill.css';
Copy link

Choose a reason for hiding this comment

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

WARNING: fill.css from @fontsource-variable/material-symbols-outlined only bundles the FILL axis subset of the variable font. The CSS in index.css uses font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24, but the wght/GRAD/opsz axes will be unavailable with this subset — those settings will silently have no effect.

Consider importing the full variable font instead:

Suggested change
import '@fontsource-variable/material-symbols-outlined/fill.css';
import '@fontsource-variable/material-symbols-outlined';

Or, if only FILL variation is needed and weight/grade/optical-size are not required, document that intent here.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Applied in f3a516e. Switched the import to @fontsource-variable/material-symbols-outlined (full variable set) so the existing font-variation-settings axes (FILL, wght, GRAD, opsz) can take effect consistently.

}

if (this.state.speechStats.length > 0) {
if (this.state.cachedSpeechSummary) {
Copy link

Choose a reason for hiding this comment

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

SUGGESTION: silenceStats is still recomputed via three .map() + average() calls on every updateStats() invocation (lines 464–470), while speechStats now benefits from the new cache. For consistency and to fully realise the hot-path savings, consider adding a cachedSilenceSummary field with the same invalidation pattern (clear it when a new entry is pushed to silenceStats).

Copy link
Owner Author

Choose a reason for hiding this comment

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

Not applying in this PR. This branch is a targeted stale-PR port plus low-risk review fixes; adding silence-summary caching changes runtime behavior and should be evaluated separately with profiling evidence. I can open a dedicated perf follow-up PR for that.

Repository owner deleted a comment from coderabbitai bot Feb 20, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

📝 Walkthrough

Walkthrough

The PR migrates font loading from external CDN (Google Fonts) to local npm packages (@fontsource), updating HTML/CSS/config accordingly. It also introduces a caching mechanism in AudioSegmentProcessor to optimize repeated speech summary calculations, with corresponding test coverage.

Changes

Cohort / File(s) Summary
Font Migration
index.html, package.json, src/index.css, src/index.tsx
Removes Google Fonts CDN, preconnect directives, and external font imports; adds @fontsource devDependencies for Crimson Pro, Plus Jakarta Sans, JetBrains Mono, and Material Symbols; imports font stylesheets in index.tsx and updates font-family reference to use variable variant.
Audio Processing Optimization
src/lib/audio/AudioSegmentProcessor.ts, src/lib/audio/AudioSegmentProcessor.test.ts
Introduces cachedSpeechSummary field to ProcessorState for short-circuiting speech statistics recomputation; cache is cleared when speech segments end and during reset. New test validates proactive segment splitting when exceeding maxDuration threshold, verifying segment emission and duration correctness.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Fonts now local, no CDN roam,
Stylesheets bundled, we call them home!
Cache the speeches, save the time,
Optimization—oh so divine! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title describes a general porting of stale PR updates but does not clearly specify the main changes (font self-hosting and audio caching). Consider a more specific title like 'chore: self-host fonts via @fontsource and cache speech statistics' to better communicate the primary changes to reviewers.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/port-stale-prs-batch2

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 and usage tips.

const sampleRate = 16000;
const maxDuration = 0.5;

const processor = new AudioSegmentProcessor({
Copy link

Choose a reason for hiding this comment

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

SUGGESTION: The test constructor does not suppress the default logger: console.log, so every processAudioData call will emit multiple log lines during the test run. Add logger: () => {} to keep test output clean.

Suggested change
const processor = new AudioSegmentProcessor({
const processor = new AudioSegmentProcessor({
sampleRate,
maxSegmentDuration: maxDuration,
energyThreshold: 0.01,
minSpeechDuration: 0.1,
snrThreshold: 0,
minSnrThreshold: 0,
logger: () => {}
});

Copy link
Owner Author

Choose a reason for hiding this comment

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

Applied in 4306afe. Added logger: () => {} for the proactive-split test constructor.

expect(emittedSegments.length).toBeGreaterThan(0);

const firstSegment = emittedSegments[0];
const splitTolerance = 0.15;
Copy link

Choose a reason for hiding this comment

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

SUGGESTION: splitTolerance = 0.15 is 30% of maxDuration = 0.5, which is loose enough to mask an off-by-one chunk error. Since chunks are 100 ms each, a tolerance of one chunk duration (0.1) would be tighter and still accommodate quantization:

Suggested change
const splitTolerance = 0.15;
const splitTolerance = 0.1; // one chunk boundary

Copy link
Owner Author

Choose a reason for hiding this comment

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

Applied in 4306afe. Tightened split tolerance from

Copy link
Owner Author

Choose a reason for hiding this comment

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

Follow-up: in commit 4306afe this test now uses splitTolerance = 0.1 (one 100ms chunk boundary).

avgEnergy: this.average(this.state.speechStats.map(s => s.avgEnergy)),
avgEnergyIntegral: this.average(this.state.speechStats.map(s => s.energyIntegral))
};
this.state.cachedSpeechSummary = stats.speech;
Copy link

Choose a reason for hiding this comment

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

SUGGESTION: cachedSpeechSummary aliases stats.speech, which is also stored in currentStats.speech

After this line, both this.state.cachedSpeechSummary and this.state.currentStats.speech (set at line 483) point to the same object. getStats() returns a defensive copy so external callers are safe, but any internal code that reads this.state.currentStats.speech directly and mutates it would silently corrupt the cache.

Consider storing a copy to make the cache independent:

Suggested change
this.state.cachedSpeechSummary = stats.speech;
this.state.cachedSpeechSummary = { ...stats.speech };

expect(emittedSegments.length).toBeGreaterThan(0);

const firstSegment = emittedSegments[0];
const splitTolerance = 0.1;
Copy link

Choose a reason for hiding this comment

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

SUGGESTION: splitTolerance = 0.1 is 20% of maxDuration = 0.5 — still a wide tolerance

With 100 ms chunks and maxDuration = 0.5 s, the split should fire at the chunk boundary at or just after 0.5 s, so the first segment duration should be exactly 0.5 s (or at most 0.6 s if the split fires one chunk late). A tolerance of ±0.1 s allows durations from 0.4 s to 0.6 s, which would pass even if the split fires a full chunk early. Consider tightening to 0.05 (one chunk boundary) to catch off-by-one regressions in the split logic:

Suggested change
const splitTolerance = 0.1;
const splitTolerance = 0.05;

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/lib/audio/AudioSegmentProcessor.ts (1)

194-211: Note: proactively split segments are not recorded in speechStats.

When a segment is split at maxSegmentDuration, a ProcessedSegment is emitted but no entry is pushed to speechStats. This means the cached speech summary (and overall VAD statistics) won't reflect these segments. This appears to be pre-existing behavior rather than a regression from the caching change, but worth being aware of if statistics accuracy matters downstream.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/audio/AudioSegmentProcessor.ts` around lines 194 - 211, When a long
segment is proactively split in AudioSegmentProcessor (the block checking
this.state.inSpeech && this.state.speechStartTime and comparing
currentSpeechDuration to this.options.maxSegmentDuration), the created segment
is emitted via createSegment but not recorded in the speechStats cache; update
the same path that handles normal segment completion to also update speechStats
when you create and push the split segment (e.g., after const segment =
this.createSegment(...) and before starting a new segment with
this.startSpeech(...)), ensuring you add the same ProcessedSegment
summary/metrics object (or call the existing helper that records stats) so
speechStats remains consistent with emitted segments and VAD statistics stay
accurate.
src/index.css (1)

31-32: Stylelint flags missing generic font family — safe to suppress for icon fonts.

Stylelint reports font-family-no-missing-generic-family-keyword on this line. Since Material Symbols is an icon font (no text rendering fallback makes sense), you can silence it with an inline disable comment.

🔧 Suggested suppression
 .material-symbols-outlined {
-  font-family: 'Material Symbols Outlined Variable' !important;
+  /* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */
+  font-family: 'Material Symbols Outlined Variable' !important;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/index.css` around lines 31 - 32, Stylelint is flagging
.material-symbols-outlined's font-family for missing a generic-family keyword;
silence it by adding an inline stylelint disable for the rule
font-family-no-missing-generic-family-keyword either immediately above the
.material-symbols-outlined selector (use /* stylelint-disable-next-line
font-family-no-missing-generic-family-keyword */) or on the same line as the
font-family declaration (use /* stylelint-disable-line
font-family-no-missing-generic-family-keyword */) so the Material Symbols
Outlined icon font can remain as 'Material Symbols Outlined Variable' without
adding a generic fallback.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/index.css`:
- Around line 31-32: Stylelint is flagging .material-symbols-outlined's
font-family for missing a generic-family keyword; silence it by adding an inline
stylelint disable for the rule font-family-no-missing-generic-family-keyword
either immediately above the .material-symbols-outlined selector (use /*
stylelint-disable-next-line font-family-no-missing-generic-family-keyword */) or
on the same line as the font-family declaration (use /* stylelint-disable-line
font-family-no-missing-generic-family-keyword */) so the Material Symbols
Outlined icon font can remain as 'Material Symbols Outlined Variable' without
adding a generic fallback.

In `@src/lib/audio/AudioSegmentProcessor.ts`:
- Around line 194-211: When a long segment is proactively split in
AudioSegmentProcessor (the block checking this.state.inSpeech &&
this.state.speechStartTime and comparing currentSpeechDuration to
this.options.maxSegmentDuration), the created segment is emitted via
createSegment but not recorded in the speechStats cache; update the same path
that handles normal segment completion to also update speechStats when you
create and push the split segment (e.g., after const segment =
this.createSegment(...) and before starting a new segment with
this.startSpeech(...)), ensuring you add the same ProcessedSegment
summary/metrics object (or call the existing helper that records stats) so
speechStats remains consistent with emitted segments and VAD statistics stay
accurate.

@AAlp22 AAlp22 merged commit 798a214 into master Feb 20, 2026
3 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 20, 2026
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