Fix : Run lifeCycle & other little things#116
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR is a broad stability/hardening bundle that (1) makes frontend/src/types/generated.ts fully auto-regenerated from Rust ts-rs bindings, (2) adds “resume Interrupted run” support end-to-end (UI → API → runner) with stronger run-status guards and foreach reconciliation, and (3) tightens multiple operational/security invariants (destructive-route gating, zip-bomb caps, safer exports/imports, better invariant logging).
Changes:
- Replace the old “type drift” guard with a deterministic full regeneration pipeline for
generated.ts, plus generator and hygiene tests. - Add manual resume for
Interruptedworkflow runs, including atomic claim semantics and foreach resume reconciliation. - Add/extend reliability + security safeguards across API, DB, config persistence, export/import, and API-call pagination.
Reviewed changes
Copilot reviewed 82 out of 86 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Makefile | Updates typegen to assemble/regenerate generated.ts from bindings. |
| frontend/src/types/tests/typegen-transform.test.ts | Tests serde→TS optionalization logic against Rust fixtures. |
| frontend/src/types/tests/generated-hygiene.test.ts | Adds hygiene invariants for regenerated generated.ts. |
| frontend/src/pages/WorkflowsPage.tsx | Tightens typing around batch QA payload JSON items. |
| frontend/src/pages/Dashboard.tsx | Aligns fallback mcpOverview shape with new fields. |
| frontend/src/pages/tests/WorkflowsPage.test.tsx | Updates step mocks for new required step fields. |
| frontend/src/pages/tests/WorkflowsPage.qp-launch.test.tsx | Updates QuickPrompt mocks with newly required fields. |
| frontend/src/pages/tests/DiscussionsPage.test.tsx | Updates Discussion/Project mocks for expanded type shapes. |
| frontend/src/pages/tests/Dashboard.test.tsx | Updates Discussion/Project mocks for expanded type shapes. |
| frontend/src/lib/i18n.ts | Adds i18n strings for “resume run” UI. |
| frontend/src/lib/api.ts | Adds workflows.resumeRun API client call. |
| frontend/src/lib/tests/runFilters.test.ts | Updates WorkflowRun/StepResult mocks for new fields. |
| frontend/src/lib/tests/regression.test.ts | Updates Discussion mocks for expanded type shapes. |
| frontend/src/lib/tests/batchTriage.test.ts | Updates Discussion mocks for expanded type shapes. |
| frontend/src/components/workflows/WorkflowWizard.tsx | Ensures new steps include step_type. |
| frontend/src/components/workflows/WorkflowDetail.tsx | Adds resume hook + ensures batch item steps include output_format. |
| frontend/src/components/workflows/RunDetail.tsx | Adds “Resume” button for eligible Interrupted runs. |
| frontend/src/components/workflows/QuickApiForm.tsx | Narrows apiBody to `JsonValue |
| frontend/src/components/workflows/ApiCallStepCard.tsx | Narrows JSON body editor onChange to `JsonValue |
| frontend/src/components/workflows/apiCallPlaceholders.ts | Casts placeholder-substituted JSON body to JsonValue. |
| frontend/src/components/workflows/tests/WorkflowWizard.test.tsx | Updates Project mocks for expanded type shapes. |
| frontend/src/components/workflows/tests/WorkflowWizard.coverage.test.tsx | Updates mocks + workspace_config.require_isolation expectation. |
| frontend/src/components/workflows/tests/WorkflowDetail.liveStepWaitingKey.test.ts | Adjusts typing workaround around optional step_type. |
| frontend/src/components/workflows/tests/RunDetail.test.tsx | Updates run/step-result mocks for new fields. |
| frontend/src/components/workflows/tests/QuickPromptForm.bindings.test.tsx | Updates QuickPrompt mock with required project_id. |
| frontend/src/components/settings/AgentsSection.tsx | Refreshes Codex model tier suggestions. |
| frontend/src/components/tests/TestModeBanner.test.tsx | Updates Discussion mocks for expanded type shapes. |
| frontend/src/components/tests/ProjectList.missing-path.test.tsx | Updates Project mocks for expanded type shapes. |
| frontend/src/components/tests/ProjectCard.remap.test.tsx | Updates Project mocks for expanded type shapes. |
| frontend/src/components/tests/ProjectCard.migration.test.tsx | Updates Project mocks for expanded type shapes. |
| frontend/src/components/tests/ProjectCard.header-a11y.test.tsx | Updates Project mocks for expanded type shapes. |
| frontend/src/components/tests/ProjectCard.audit-resume.test.tsx | Updates Project mocks for expanded type shapes. |
| frontend/src/components/tests/NewDiscussionForm.test.tsx | Updates Project mocks for expanded type shapes. |
| frontend/src/components/tests/MessageBubble.lintPill.test.tsx | Updates lint-report mocks to include unverified_count. |
| frontend/src/components/tests/HostSyncPreview.test.tsx | Updates Project mock for expanded type shapes. |
| frontend/src/components/tests/DiscussionSidebar.sourceBadge.test.tsx | Updates Discussion mocks for expanded type shapes. |
| frontend/src/components/tests/DiscussionSidebar.markAllRead.test.tsx | Updates mocks for new Discussion fields (currently has a syntax issue). |
| frontend/src/components/tests/DiscussionSidebar.grouping.test.tsx | Updates Discussion/Project mocks for expanded type shapes. |
| frontend/src/components/tests/ChatHeader.profileEditor.test.tsx | Updates Discussion mock for expanded type shapes. |
| frontend/src/components/tests/ChatHeader.pendingFiles.test.tsx | Updates Discussion mock for expanded type shapes. |
| frontend/src/components/tests/ActiveAuditsPopover.test.tsx | Updates Project mock for expanded type shapes. |
| frontend/scripts/check-types-drift.mjs | Removes superseded “field drift” checker script. |
| frontend/scripts/assemble-generated-types.mjs | Adds Rust-source scan + optionalization + whitespace normalization; now writes generated.ts. |
| docs/tech-debt/TD-20260713-typescript-7-native.md | New tech-debt note about TS7 adoption strategy. |
| docs/tech-debt/TD-20260701-typegen-generated-aggregate.md | Marks typegen auto-regeneration as resolved; documents new workflow. |
| docs/tech-debt/TD-20260630-apicall-link-header-pagination.md | Marks Link-header pagination work as resolved. |
| docs/design/adr-001-db-connection-model.md | New ADR proposal about SQLite connection model (currently in French). |
| CHANGELOG.md | Documents new features/fixes: resume, pagination, typegen, security hardening, etc. |
| backend/tests/learnings_api.rs | Ensures integration tests isolate config dir. |
| backend/tests/config_write_guard.rs | Adds proof test for config write chokepoint guard. |
| backend/tests/api_tests.rs | Isolates config dir + injects ConnectInfo; updates assertions for export version constant. |
| backend/src/workflows/template.rs | Hardens envelope extraction; adds corpus + fuzz-lite tests + invariant logging. |
| backend/src/workflows/sub_workflow_step.rs | Adds foreach done-set recording + 3-source resume reconciliation + tests. |
| backend/src/workflows/steps.rs | Moves envelope-repair logging under invariant target. |
| backend/src/workflows/runner.rs | Fixes resume detection (workspace_path implies resume); adds interrupted-resume claim/resume + tests. |
| backend/src/workflows/api_call_step.rs | Updates pagination max_pages for new LinkHeader variant. |
| backend/src/workflows/api_call_executor.rs | Adds LinkHeader pagination + bare-array merging + same-origin protection + tests. |
| backend/src/models/workflows.rs | Adds PaginationSpec::LinkHeader; adds RunStatus::is_terminal. |
| backend/src/models/learnings.rs | Exports LearningRejection model for export/import. |
| backend/src/models/db.rs | Bumps export schema to v5 and includes new tables in DbExport. |
| backend/src/main.rs | Routes orphan-scan warning into invariant tracing target. |
| backend/src/lib.rs | Hardens auth gating (method-aware destructive detection, Docker-only X-Real-IP trust) + adds resume route. |
| backend/src/db/workflows.rs | Adds atomic status-claim helper; adds state-key merge + foreach done-set helpers; tightens batch counter updates; strengthens status guards + logging. |
| backend/src/db/tests.rs | Adds unit tests for new DB helpers and state-machine guard behavior. |
| backend/src/db/quick_prompts.rs | Adds export/import helpers for quick-prompt version history. |
| backend/src/db/learnings.rs | Adds export/import helpers for learning rejection counters. |
| backend/src/db/contacts.rs | Adds invite-code auth helper enforcing accepted-only status + tests. |
| backend/src/core/config.rs | Adds runtime guard to prevent tests clobbering real config.toml; retries for transient fd exhaustion in lock test. |
| backend/src/api/workflows.rs | Adds POST /api/workflow-runs/:id/resume endpoint + response type. |
| backend/src/api/setup.rs | Export/import v5 additions (QP versions + rejections), selective clears, prune, zip entry caps, and open-url test suppression + tests. |
| backend/src/api/mcps.rs | Exports AdoptHostMcpRequest via ts-rs. |
| backend/src/api/mcp_remote.rs | Uses RunStatus::is_terminal() as a single source of truth. |
| backend/src/api/learnings.rs | Exports propose request/result types for ts-rs binding. |
| backend/src/api/federation.rs | Requires accepted contacts for file fetch on F8 announce. |
| backend/src/api/disc_source.rs | Adds lint-on-append summary + attaches report to stored message + tests. |
| backend/src/api/disc_invite.rs | Enforces accepted-only invite-code auth for claim-by-token/fetch-file + invariant logging + tests. |
| backend/src/api_tests.rs | Serializes + isolates tests that invoke config saves. |
| backend/src/agents/runner.rs | Updates Codex model-tier defaults; improves Ollama truncation detection. |
| backend/src/agents/runner_test.rs | Updates tests for Ollama truncation + new model-tier defaults. |
| backend/scripts/disc-introspection-mcp.py | Adds MCP tool workflow_resume_run + documents LinkHeader pagination spec. |
| .github/workflows/ci-test.yml | Switches CI typegen check to full regen + git diff guard on generated.ts. |
4ed128c to
0076fda
Compare
0076fda to
051d4e4
Compare
Signed-off-by: Romuald Priol <romuald.priol@protonmail.com>
051d4e4 to
cf3a41f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix few other things to improve Application stability
Changes
Run lifecycle
Observability
kronn::invarianttracing target — blocked writes, frozen counters, refused fetches, broken envelopes, boot probeprompt_eval_countvsnum_ctxEnvelope contract
Typegen (TD-20260701 resolved)
generated.tsfully auto-generated — 281 types, deterministic assemblergit diff --exit-codeAPI calls (TD-20260630 resolved)
LinkHeaderpagination — GitHub-style bare arrays +rel="next"walkingSecurity / P2P
X-Real-IPtrusted only in Docker — LAN spoof bypass closedTest suite & DX
cargo testno longer opens a browser tab — open-url test-binary guardDocs