Repository navigation
feat(harness): enforce reviewed Permission flows - #15288
ogabrielluiz wants to merge 2 commits into
Conversation
Pre-merge checks:
|
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Test Quality And Coverage | The check cannot be assessed against PR #15288. The local checkout is detached at b01c86a on main. The repository holds only two commits. Neither the base branch review/harness-b06-compaction nor the … |
To finish this check, make the PR head and base available in the checkout. Fetch review/harness-b06-compaction and review/harness-b07-permissions, or fetch PR #15288 (refs/pull/15288/head) and its base. Then run `git diff ... --… |
|
| Excessive Mock Usage Warning | Could not establish the PR's test-file diff, so the check cannot be completed against the PR's changes. - The checkout is a single commit (b01c86a). Neither review/harness-b06-compaction nor review/ha… | Provide the PR #15288 head and base revisions, or a complete patch for review/harness-b07-permissions against review/harness-b06-compaction, so the changed test files can be identified. Then rerun this check on those test files. Review each… |

Passed checks: 2 passed
-
Check name Status Explanation Test Coverage For New Implementations The PR head commit is 26ee053, "feat(harness): enforce reviewed Permission flows", on top of 6e30c49 (the layer 14 compaction commit). The diff from 6e30c49 to 26ee053 includes 71 files. The PR ad… Test File Naming And Structure The check applies to PR #15288. The PR adds or changes 12 test files in commit 26ee053 (fetched from review/harness-b07-permissions; the branch head is b01c86a, which only adds an auto-bake commit). …Full details: Test Coverage For New Implementations
-
Explanation
The PR head commit is 26ee053, "feat(harness): enforce reviewed Permission flows", on top of 6e30c49 (the layer 14 compaction commit). The diff from 6e30c49 to 26ee053 includes 71 files. The PR adds or changes these test files: Backend and lfx Python tests (all match test_*.py): - src/lfx/tests/unit/components/models_and_agents/agent_helpers/test_permission_flows.py (new, 18 test functions). It runs real graphs, parallel tool calls, resume after recompile, tool-specific review, edited-argument checks, timeout, stale source, sync invocation, and changed binding cases. Assertions check effects, pending requests, and decision evidence. - src/lfx/tests/unit/projects/test_permission_bindings.py (new, 4 tests). It covers canvas reconciliation, conflicts that do not mutate data, reference validation, and reading empty values without running code. - src/lfx/tests/unit/projects/test_writer.py, test_slots.py, test_compaction_bindings.py, and helpers/test_run_flow_hitl_guard.py (modified). - src/backend/tests/unit/api/v1/test_permission_flow_runtime.py (new). It runs a stored PermissionGate flow through the durable Agent path. It checks ask, deny, and tool_defaults policies, checkpoint reload, and public message output. - src/backend/tests/unit/api/v1/test_project_permission_bindings.py (new, 7 tests). It covers save, removal, invalid-binding rollback, archive remap, and source-change review. These are integration tests with the API and database. - src/backend/tests/unit/api/v1/test_run_hitl_block.py (modified). Frontend tests (all match *.test.tsx): - harness-page.test.tsx (modified), instructions-flow-picker.test.tsx (new), instructions-contract.test.tsx (new). They test binding selection, creation, error retry, and save-state behavior. Naming follows the project conventions. The tests cover unit and integration levels. I found no skipped, xfail, or placeholder tests in the new files. The single bare pass in test_permission_flows.py is a no-op monkeypatch stub inside a real test. Minor gap: permission_gate.py, permission_request.py, and permission_flow_middleware.py have no direct test file. The agent-level tests exercise them, so this does not fail the check. The PR description also reports test runs. I did not run the tests, which the sandbox does not allow.
Full details: Test File Naming And Structure
-
Explanation
The check applies to PR
#15288. The PR adds or changes 12 test files in commit 26ee053 (fetched from review/harness-b07-permissions; the branch head is b01c86a, which only adds an auto-bake commit). I compared the PR test files to the criteria. 1. Naming and framework: - Backend tests aretest_*.pyundersrc/backend/tests/unit/api/v1/andsrc/lfx/tests/unit/.... They use pytest markers, fixtures andasync def test_...functions. - Frontend unit tests are*.test.tsxundersrc/frontend/src/pages/.... They import@testing-library/reactand usejest.fn,jest.mock,beforeEachandafterEach. - The PR adds no Playwright*.spec.tsfile. The check does not require one for this change. 2. Integration tests:test_project_permission_bindings.pyandtest_permission_flow_runtime.pyuse theclientandsession_scopefixtures. They sit intests/unit/api/v1, next to the existingtest_project_compaction_bindings.py. The repo does not use an integration marker here, so the PR follows the local convention. 3. Descriptive names: Test names state the behavior. Examples:test_invalid_permission_binding_rolls_back_all_writes,test_flow_cannot_skip_tool_specific_review,test_timeout_stops_before_tool_execution,test_stale_source_is_rejected_before_a_tool_executes, andcreates Permissions from the current policy and restores that policy when unbound. 4. Setup and teardown: The tests use fixtures (permission_agent,setup_permission, an autouse fixture intest_slots.py),tmp_path,monkeypatch,usefixtures, andbeforeEach/afterEachhooks. The contract test restores real timers inafterEach. 5. Edge and error cases: The tests use parametrized defects. Examples:foreign_project,foreign_user,shape,canvas,old_agentin the backend tests, andmanual,connected,foreign,old_agent,False,0,[],{}intest_permission_bindings.py. Timeout, stale-source, sync-invocation and invalid-timeout cases also appear. 6. Positive and negative coverage: Tests cover approve, reject and ask decisions, allowed and forbidden edited arguments, and rollback on invalid input. They also check that tool execution count stays at zero on failure. 7. Helper import:test_permission_flows.pyimportstest_harness_permissions.py. That file exists at the PR head. Gaps: None against the stated criteria. The PR does not add a Playwright test, and the check does not require one.
-
Full details: Test Quality And Coverage
-
Explanation
The check cannot be assessed against PR
#15288. The local checkout is detached at b01c86a on main. The repository holds only two commits. Neither the base branch review/harness-b06-compaction nor the head branch review/harness-b07-permissions exists locally. So the PR patch cannot be computed, and the tests it adds or changes cannot be identified. Evidence gathered: - The main tree contains permission-flow code and tests, for example src/lfx/src/lfx/projects/permissions.py, src/lfx/tests/unit/projects/test_permission_bindings.py, src/lfx/tests/unit/components/models_and_agents/agent_helpers/test_permission_flows.py, and src/backend/tests/unit/api/v1/test_permission_flow_runtime.py. - Those files exist on main. Their presence does not show that PR#15288introduced them. The stacked layers may already be merged, or the tree may be a different state. - The git history does not show a diff between the PR base and head. A git diff against 6c9aea6 shows many unrelated changes, so it cannot isolate this PR. - Provider-reported author is ogabrielluiz. No CodeRabbit review threads were returned, so no review-comment evidence is available. Because the changed test set cannot be established, the five criteria cannot be checked against this PR. Presence of tests on main does not establish coverage of this PR's new implementation. The PR description reports test runs (lfx 12,942 tests, jest 9,788, backend suites). These are author claims. They do not replace direct inspection of the tests.Resolution
To finish this check, make the PR head and base available in the checkout. Fetch review/harness-b06-compaction and review/harness-b07-permissions, or fetch PR
#15288(refs/pull/15288/head) and its base. Then rungit diff <base>...<head> --statand inspect the test files changed in the PR. Check each new implementation for: 1. Tests that cover the main behavior: allow, deny, ask, edited arguments, persistence, imports, and canvas validation. 2. Async tests that use pytest-asyncio patterns in the backend and lfx suites. 3. Assertions on behavior, not only on smoke-level execution. 4. Use of the project patterns: pytest for backend, Jest and React Testing Library for frontend unit tests, Playwright for end-to-end tests. 5. Success and error response tests for each new API endpoint.
Full details: Excessive Mock Usage Warning
-
Explanation
Could not establish the PR's test-file diff, so the check cannot be completed against the PR's changes. - The checkout is a single commit (b01c86a). Neither review/harness-b06-compaction nor review/harness-b07-permissions is present, so the PR patch and its base cannot be isolated from git history. - Candidate permission-related test files exist in the tree. These are src/lfx/tests/unit/components/models_and_agents/agent_helpers/test_permission_flows.py (389 lines), test_harness_permissions.py (263 lines), src/lfx/tests/unit/projects/test_permission_bindings.py (87 lines), and src/lfx/tests/unit/helpers/test_run_flow_hitl_guard.py (115 lines). I cannot confirm that all of them were added or changed by PR
#15288. - Among the candidates, mock-related usage is small. test_harness_permissions.py uses a fake chat model and a checkpoint store fixture, and runs real graph and agent execution. Its monkeypatch calls target seams: get_agent_requirements, send_message, _send_message_event, and _get_shared_callbacks. test_permission_flows.py has three monkeypatch calls on the same kind of seams. test_permission_bindings.py and test_run_flow_hitl_guard.py have no mock or patch usage. - The custom check defines warning conditions only and no explicit FAIL condition. The candidate files show no excessive mocking. Because the PR's test-file scope is unverified, a PASS cannot be established.Resolution
Provide the PR
#15288head and base revisions, or a complete patch for review/harness-b07-permissions against review/harness-b06-compaction, so the changed test files can be identified. Then rerun this check on those test files. Review each added test for mock objects that replace core permission, approval, or execution logic. Prefer real graph execution with fake models and real checkpoint stores, as the candidate files do.
- 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. |
Folded from the original layer: - chore(review): collapse generated starter snapshots in diffs
04b194d to
26ee053
Compare
A reviewed Permission flow returns allow, deny or ask for approval before a tool runs. Per-call approval, edited arguments, persistence, imports, canvas validation and the editor all use the existing resumable execution path.
This is layer 15 of 40 in stack #16628 and builds on #15287. It changes 576 source lines and 1,218 test lines, plus 1,759 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.