Skip to content

Run file names, audit-list fix, and named query row types - #225

Merged
martsokha merged 3 commits into
mainfrom
feat/run-files-and-query-cleanup
Aug 12, 2026
Merged

Run file names, audit-list fix, and named query row types#225
martsokha merged 3 commits into
mainfrom
feat/run-files-and-query-cleanup

Conversation

@martsokha

Copy link
Copy Markdown
Member

Three related changes to the run/file query layer, one commit each.

1. Fix: audit/artifact files leaking into the file list

cursor_list_workspace_files builds its count and item-fetch queries separately; the count filtered file_kind IN (original, redacted) but the fetch query omitted it. So audit (and would-be artifact) rows were returned in the list even though the total count excluded them — after running detection this showed up as analysis.audit rows in listFiles. Reapplies the document-kind filter to the fetch query.

(Read-path only; existing audit rows stop appearing as soon as the server runs this — no migration, no data change.)

2. Feat: show input/output file names on runs

Runs exposed only inputFileId/outputFileId (raw UUIDs). Now the file display names are resolved so a run renders without a follow-up lookup:

  • listRuns joins the input file (one LEFT JOIN per query) and returns its name.
  • Single-run responses (get / create / replay / redact) resolve input and output names via a run_file_names query method (indexed lookups; output only when present).
  • PipelineRun gains inputFileName / outputFileName (omitted when absent, e.g. a file removed by retention).

3. Refactor: name the query row types instead of positional tuples

  • Both list queries now return a named PipelineRunListRow { run, account, pipeline_slug, input_file_name } instead of a growing (WithAccountRef, Handle, Option<String>) tuple (also clears clippy's very complex type).
  • imported_files_for_connectionVec<ImportedFileRef { source_key, file_id, storage_path }> and files_due_for_expiryVec<ExpiredFileRef { id, storage_path, storage_bucket }> — previously (String, Uuid, String) / (Uuid, String, String), same-typed positional fields a caller could transpose. #[derive(Queryable)] keeps the select tuples unchanged; the retention sweep and sync-reconciliation callers now read fields by name.

Testing

Full gate green (check / fmt / clippy / doc / test).

🤖 Generated with Claude Code

martsokha and others added 3 commits August 12, 2026 03:49
cursor_list_workspace_files builds its count and item-fetch queries
separately; the count filtered file_kind IN (original, redacted) but the
fetch query omitted it, so audit (and would-be artifact) rows were
returned in the list even though the total count excluded them. After
running detection this showed up as `analysis.audit` rows in listFiles.

Reapply the document-kind filter to the fetch query.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Runs exposed only input_file_id/output_file_id (raw UUIDs). Resolve and
return the file display names so a run can be rendered without a separate
lookup:

- listRuns joins the input file (one LEFT JOIN per query) and returns its
  name; both list queries now return a named PipelineRunListRow instead of
  a growing tuple.
- Single-run responses (get / create / replay / redact) resolve input and
  output names via a run_file_names query method (indexed lookups).
- PipelineRun gains inputFileName / outputFileName (omitted when absent).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
imported_files_for_connection returned Vec<(String, Uuid, String)> and
files_due_for_expiry Vec<(Uuid, String, String)> — same-typed positional
fields a caller could transpose (e.g. source_key vs storage_path). Give
them Queryable structs ImportedFileRef { source_key, file_id, storage_path }
and ExpiredFileRef { id, storage_path, storage_bucket }; the select tuples
are unchanged, and the retention sweep and sync reconciliation callers now
read fields by name.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@martsokha martsokha added bug something isn't working as intended feat request for or implementation of a new feature server API handlers, middleware, auth postgres ORM, models, queries, migrations labels Aug 12, 2026
@martsokha martsokha self-assigned this Aug 12, 2026
@martsokha
martsokha merged commit 9bfc43e into main Aug 12, 2026
9 checks passed
@martsokha
martsokha deleted the feat/run-files-and-query-cleanup branch August 12, 2026 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug something isn't working as intended feat request for or implementation of a new feature postgres ORM, models, queries, migrations server API handlers, middleware, auth

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant