Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 28 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions crates/nvisy-server/src/handler/detections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,12 +632,14 @@ async fn redact_detection(
let mut reviewed = blob.load_audit(&engine, workspace.id, &audit_file).await?;

// Layer the reviewer's edits onto the working audit's report before redaction.
// Validation is report-relative (an unknown target or a self-contradiction →
// 400, via `EditError`'s `From` impl) so a reviewer is never told a decision
// took effect when the document says otherwise.
// Both validation and landing are report-relative (an unknown target, a
// self-contradiction, or an edit naming a part of the wrong modality → 400, via
// `EditError`'s `From` impl), so a reviewer is never told a decision took effect
// when the document says otherwise. `apply` is fallible in its own right: some
// landing failures (a modality mismatch) surface only when the edit lands.
if let Some(edits) = &request.edits {
edits.validate(&reviewed.report)?;
edits.apply(&mut reviewed.report);
edits.apply(&mut reviewed.report)?;
}

let document = blob.build_document(&file, detection.id).await?;
Expand Down
13 changes: 12 additions & 1 deletion crates/nvisy-server/src/service/run_blob_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ impl RunBlobStore {

/// Reads a workspace file's bytes from object storage and builds an engine
/// [`Document`], stamping the run's id as the correlation id.
///
/// The document's name is the file's original filename, and its format is
/// resolved from the stored `file_extension` (the trusted, `NOT NULL` column
/// the codec dispatches on — the filename may lie about the type). The name is
/// the engine's identity for the document: it roots every part path and is how
/// `anonymize` matches an audit back to its document, so redaction would
/// silently no-op if it differed between passes. Both detect and redact build
/// from the same input-file row through here, so the name is identical by
/// construction.
pub async fn build_document(
&self,
file: &WorkspaceFile,
Expand Down Expand Up @@ -176,7 +185,9 @@ impl RunBlobStore {
.with_context(err.to_string())
})?;

Ok(Document::new(bytes, file.file_extension.clone()).with_correlation_id(correlation_id))
Ok(Document::new(file.original_filename.clone(), bytes)
.with_extension(file.file_extension.clone())
.with_correlation_id(correlation_id))
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

/// Encrypts the analysis, writes it to the audit bucket, and builds the
Expand Down