Repository navigation
feat(harness): save to the selected Agent with restore points - #15277
ogabrielluiz wants to merge 3 commits into
Conversation
Pre-merge checks:
|
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Test File Naming And Structure | The check assesses test files added or changed by PR #15277 (langflow-ai/langflow, author ogabrielluiz, base review/harness-a05-config-composition, head review/harness-a06-canvas-safe-save). I could n… |
Make the PR head branch review/harness-a06-canvas-safe-save and its base review/harness-a05-config-composition available in the checkout, for example by fetching both refs from origin. Then rerun this check against the merge-base diff. Conf… | |
| Excessive Mock Usage Warning | The check reviews test files changed by this PR for excessive mock usage. I could not establish the PR's test changes. The local checkout is detached at 9f896cc on main. Neither the base branch `revie… | Make the PR head and base refs available in the checkout (for example, fetch origin/review/harness-a06-canvas-safe-save and origin/review/harness-a05-config-composition, or check out PR #15277 with gh pr checkout 15277). Then rerun th… |

Passed checks: 2 passed
-
Check name Status Explanation Test Coverage For New Implementations PR #15277(langflow-ai/langflow, author ogabrielluiz, base review/harness-a05-config-composition, head review/harness-a06-canvas-safe-save) includes new and updated tests for its code changes. Method:…Test Quality And Coverage Test Quality and Coverage: PASS for PR #15277(langflow-ai/langflow, author ogabrielluiz). Scope and evidence limit: The checkout is a single shallow commit (9f896cc). The PR branches were not present…Full details: Test Coverage For New Implementations
-
Explanation
PR
#15277(langflow-ai/langflow, author ogabrielluiz, base review/harness-a05-config-composition, head review/harness-a06-canvas-safe-save) includes new and updated tests for its code changes. Method: The local checkout was detached at main (9f896cc), which equals the PR head. I fetched both PR branches from origin and diffed b043d5b..9f896cc. The diff has 25 files. Four are test files. Backend tests (criteria 1, 3, 4, 5): - New file src/backend/tests/unit/api/v1/test_project_config_write_through.py (+524 lines). It covers the new config writer and its API behavior. Test names include: - test_the_saved_form_reaches_the_flow - test_only_the_selected_agent_flow_is_written - test_ambiguous_agent_selection_changes_nothing (422 path) - test_invalid_tool_does_not_partially_apply_other_fields (422, no partial apply) - test_writes_have_a_restorable_version_and_noop_saves_add_none (restore points) - test_snapshot_failure_does_not_break_the_save (restore-point failure path) - test_canvas_edits_win_and_baselines_cannot_be_replaced_by_the_form (canvas-safe save) - test_tools_are_visible_callable_and_idempotent (builds the real Run Flow tool and invokes it) - Assertions check concrete state: status codes, stored template values, and restore_version_ids. These are not placeholder tests. - src/backend/tests/unit/api/v1/test_projects.py has updated expectations. project_config now includes "applied": {}. These updates match the new behavior. Frontend tests (criteria 1, 4, 5): - harness-page.test.tsx (+161 lines) adds tests for the Agent selection and save. Examples: - saves the unique agent and excludes it from the tools picker - requires a choice when multiple agent flows are available - requires replacing a saved agent that is no longer available - keeps canvas protection and restore results visible after saving - shows the server's actionable validation error - offers a retry instead of treating a failed flow query as an empty project - project-flow-picker.test.tsx (+35 lines) adds tests for filtering, preserved selections, and disabled state during save. - Naming follows the convention: test*.py for backend, *.test.tsx for frontend unit tests. Gaps noted: - agent-flow-picker.tsx (new, 98 lines) has no dedicated test file. It is exercised through harness-page.test.tsx. - No *.spec.ts end-to-end test was added. The check requires integration tests only "where appropriate". The backend API tests use the full HTTP client, which covers this layer. These gaps do not match any explicit failure condition in the check. Each new feature has corresponding tests that check its behavior.
Full details: Test Quality And Coverage
-
Explanation
Test Quality and Coverage: PASS for PR
#15277(langflow-ai/langflow, author ogabrielluiz). Scope and evidence limit: The checkout is a single shallow commit (9f896cc). The PR branches were not present, so I could not isolate the PR diff. I matched the feature by content: the save path infolder/config_writer.py(agent selection, tool validation, canvas baseline, restore points),api/v1/projects.py, and the harness page. I evaluated the tests that exercise that behavior. Criterion results: 1. Main functionality is covered. -test_project_config_write_through.py(524 lines) uses a real database and the real HTTP PATCH route. It checks that the form reaches the agent flow, that only the selected agent is written, that untargeted flows are left alone, and that repeated saves are idempotent. - It also covers canvas-edit precedence, legacy baselines, locked flows (flows_locked),updated_at, and tool composition (compose_tools). -lfx/tests/unit/projects/test_tool_composition.pyandtest_writer.pycover the lfx composition and writer helpers. - Restore points are tested: a version is created, its data equals the original, a no-op save adds none, and a version-storage failure does not break the save. 2. Async patterns are correct.pyproject.tomlsetsasyncio_mode = "auto", so the async pytest tests follow the project pattern. 3. Tests validate behavior, not smoke. They assert stored template values,FlowVersioncontents, flow counts,422status, and unchanged state after rejected saves. 4. Project patterns are followed. Backend uses pytest. The frontend uses Jest with@testing-library/reactinharnessPage/__tests__/. The tests cover a success toast with a count, a save-result panel (canvas-skipped, locked, restore point), a server error message surfaced throughonError, a failed-query retry, and the agent picker states. 5. API success and error paths are tested. Success is covered by the write-through tests. Error responses are covered for ambiguous agent selection (422), a tool from another project (422), an invalid tool with no partial apply (422), and an agent not in the project (422). The frontend covers the server error display. Gaps (noted, not failures): - Several422branches inselected_toolsandselect_agent_flowhave no test. These are "Tools must be a list", "The agent flow cannot call itself as a tool", "A selected tool calls back into the agent flow", "Choose an agent flow before adding tools", and the "Could not configure the selected tools" wrap aroundcompose_toolserrors. - No test asserts that a failed save leaves noFlowVersionrow. The "same transaction" claim is therefore not tested for the failure path. - No Playwright end-to-end test covers the harness save flow. - Some frontenditblocks (lines 399–498) sit outside adescribe. This is a style point only.
-
Full details: Test File Naming And Structure
-
Explanation
The check assesses test files added or changed by PR
#15277(langflow-ai/langflow, author ogabrielluiz, base review/harness-a05-config-composition, head review/harness-a06-canvas-safe-save). I could not establish that PR's diff in this run. Evidence gathered: - The local checkout is detached at 9f896cc, a "[autofix.ci]" commit on the main line. Only main and origin/main exist locally. - Neither the base branch nor the head branch exists locally, sogit diffagainst the PR base is not possible. - Searches for "canvas safe save", "safe-save", and "harness-a0" found no PR-specific code or test files in the checkout. - The PR description lists 735 test lines but names no test files. - No CodeRabbit review threads were returned, so there is no reviewer-side evidence of test structure. Because the PR's test files could not be read, I cannot check naming, layout, the Jest/Playwright split, test names, or negative-case coverage. Existing repository test files (for example, src/backend/tests/unit/agentic/services/test_restore_point.py) show the expected conventions. They do not show what this PR added. Missing evidence cannot establish PASS. The check does not define a FAIL condition for an unavailable diff.Resolution
Make the PR head branch review/harness-a06-canvas-safe-save and its base review/harness-a05-config-composition available in the checkout, for example by fetching both refs from origin. Then rerun this check against the merge-base diff. Confirm that: 1. Backend tests are named test_*.py and use pytest structure. 2. Frontend unit tests are *.test.ts or *.test.tsx under src/frontend/src. End-to-end tests are *.spec.ts under src/frontend/tests. 3. Integration tests are marked and placed in the expected directories. 4. Test function names describe the behavior under test. 5. Setup and teardown are present where the tests need them. 6. Edge-case and error-path tests exist for the save, tool-selection validation, and restore-point logic, with positive and negative cases.
Full details: Excessive Mock Usage Warning
-
Explanation
The check reviews test files changed by this PR for excessive mock usage. I could not establish the PR's test changes. The local checkout is detached at 9f896cc on main. Neither the base branch
review/harness-a05-config-compositionnor the head branchreview/harness-a06-canvas-safe-saveexists locally or as a remote ref, andgit log --allshows no PR commits. Searches for harness or restore-point tests returned only files already on main, such assrc/frontend/src/pages/MainPage/pages/harnessPage/__tests__/harness-summary.test.tsx. Those files predate this PR and cannot be attributed to it. No mock-usage evidence from the PR's test diff was available, so I cannot establish PASS or FAIL. The PR description says the change adds 735 test lines, which the check would need to review.Resolution
Make the PR head and base refs available in the checkout (for example, fetch
origin/review/harness-a06-canvas-safe-saveandorigin/review/harness-a05-config-composition, or check out PR#15277withgh pr checkout 15277). Then rerun this check againstgit diff <base>...<head>restricted to the test files. Review those tests for mock-heavy setups, mocks of core logic rather than external dependencies, and missing integration coverage.
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
|
✅ Migration Validation Passed All migrations follow the Expand-Contract pattern correctly. |
a25c10e to
be4da33
Compare
Saving the agent harness writes to the Agent you choose, validates the tool selection, keeps canvas changes, and creates restore points in the same transaction. The UI shows which Agent it saves to and whether the save worked.
This is layer 6 of 40 in stack #16628 and builds on #15276. It changes 719 source lines and 735 test lines, plus 264 lines in generated files (component index, starter projects, locales, secrets baseline).
The stack is rebased onto release-1.14.0 at
f60d17696c. Ruff, Biome and the detect-secrets hook pass on every layer. Before the Run Flow refactor, the stack tip passed lfx (12,942 tests), jest (9,788), and the Postgres migration, concurrency and background execution suites, and the backend unit suite failed only on tests that also fail on the base. After the refactor, the lfx suite and the backend api, agentic and base suites ran again at the tip. Three new lfx failures were fixed and rerun. The only other new failures, intest_files.py, also fail on the base.Still a draft. Live provider calls and a deployed topology were not tested.