Skip to content

Conversation

@jamiepine
Copy link
Member

This PR updates the CONTRIBUTING.md file to provide clearer instructions on building the project with media processing features. It introduces convenient cargo aliases for building with ffmpeg and heif features enabled, and emphasizes the importance of these features for development. Additionally, it includes notes on the implications of building without these features and how to resolve related issues. The changes aim to improve the onboarding experience for new contributors.

This commit updates the CONTRIBUTING.md file to provide clearer instructions on building the project with media processing features. It introduces convenient cargo aliases for building with `ffmpeg` and `heif` features enabled, and emphasizes the importance of these features for development. Additionally, it includes notes on the implications of building without these features and how to resolve related issues. The changes aim to improve the onboarding experience for new contributors.
@cursor
Copy link

cursor bot commented Jan 10, 2026

PR Summary

Improves developer workflow and hardens media/indexing behavior.

  • Docs/ DX: Expands CONTRIBUTING.md with guidance for building with ffmpeg,heif, troubleshooting, and new aliases (cargo daemon, cargo cli).
  • Build: Adds cargo aliases in .cargo/config.toml.mustache for running daemon/CLI with media features.
  • Core media gating: Moves speech/thumbnail/thumbstrip to compile-time guards; actions return clear errors when ffmpeg is disabled; adjusts core/Cargo.toml features (sd-images always on; heif extends it).
  • Indexing safety: Requires location.volume_id (no fallback), propagating errors in change detection and processing.
  • TS codegen: Refactors generate_typescript_types.rs (traits, sorting, helpers) and derives Clone for extracted types; regenerates packages/ts-client unions and wire maps; tweaks cloud config types.
  • UI: Shows toasts when media features are disabled; fixes validation call to query:locations.validate_path.
  • Tests/xtask: Adds sync backfill/realtime tests; test fixes create/link volumes before indexing.

Written by Cursor Bugbot for commit 6121956. Configure here.

}
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

The #[cfg(feature = "ffmpeg")] attribute on generate_thumbstrip_for_file means this function won't exist when the feature is disabled. The old code had a fallback #[cfg(not(feature = "ffmpeg"))] version that returned an error, which was removed. This could lead to compile errors if any code outside the action handler tries to call this function without the feature flag.

Consider either keeping the fallback stub or ensuring all call sites are also feature-gated.

});
} else {
toast.error({
title: "Transcription Failed",
Copy link
Contributor

Choose a reason for hiding this comment

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

There's duplicated error handling logic across the three media feature buttons (transcription, thumbnail, thumbstrip). Consider extracting this into a helper function:

Suggested change
title: "Transcription Failed",
// Check if it's a feature-disabled error
const errorMessage = error instanceof Error ? error.message : String(error);
handleMediaFeatureError(errorMessage, "Speech-to-text", "Transcription Failed");

Then define a helper at the top of the file or in a shared utility.

verified_count = verified_count,
nested_files_checked = nested_files_checked,
"Verified nested file structure"
);
Copy link
Contributor

Choose a reason for hiding this comment

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

The relaxed assertion logic here silently passes when no nested files exist. While the comment explains the reasoning, this could mask test regressions where nested files should exist but don't. Consider logging a more prominent message or adding a separate assertion to verify the test fixture contains expected data.

JobError::execution(
"Location volume_id not set - volume must be detected before indexing can proceed",
)
})?;
Copy link

Choose a reason for hiding this comment

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

Removing volume_id fallback breaks location indexing

High Severity

The change removes the unwrap_or(device_id) fallback for locations without volume_id set, replacing it with an error. However, all locations are created with volume_id: Set(None) (see create_location() at lines 258 and 196 in location/mod.rs), and no production code sets volume_id before indexing. The migration explicitly notes "No backfill - volume_id will be resolved lazily at runtime" - the unwrap_or(device_id) WAS the lazy resolution. The test file was patched to manually set volume_id before indexing (lines 109-128), masking this bug. In production, all location indexing will fail with "Location has no volume_id - volume must be detected before change detection".

🔬 Verification Test

Why verification test was not possible: This bug affects the integration between location creation and indexing, which requires a full database setup, library initialization, and job system. The test file modifications in the diff demonstrate the workaround needed (manually setting volume_id on locations before indexing), confirming the production code path is broken. The evidence is:

  1. create_location() always sets volume_id: Set(None) (line 258 in location/mod.rs)
  2. No code exists that sets volume_id on locations before indexing starts
  3. The test had to add manual update_many() calls to set volume_id (lines 109-128 in sync_backfill_test.rs)
  4. The old code used unwrap_or(device_id) as the "lazy resolution" mentioned in migration comments, which has been removed
Additional Locations (2)

Fix in Cursor Fix in Web

This commit modifies the cargo aliases in the configuration file to include specific features for the `sd-daemon` and `sd-cli` packages. Additionally, it introduces a new function for generating thumbstrips that returns an error when the `ffmpeg` feature is not enabled, improving error handling and clarity for users attempting to generate thumbstrips without the necessary features.
@jamiepine jamiepine closed this Jan 10, 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