Skip to content

fix: correct 3 test bugs from workflow migration to build_workflow - #1376

Open
osilkin98 wants to merge 7 commits into
mainfrom
factory/run-3427af8a
Open

fix: correct 3 test bugs from workflow migration to build_workflow#1376
osilkin98 wants to merge 7 commits into
mainfrom
factory/run-3427af8a

Conversation

@osilkin98

Copy link
Copy Markdown
Collaborator

Changes

  • test_workflow_integration.py:143 — Changed wf.nodes.get("archivist") to wf.nodes.get("archivist_build"). The test was migrated from improve_workflow to build_workflow, but build_workflow has archivist_build and archivist_plan nodes, not archivist.
  • test_workflow_qa.py:155-157 — Removed test_registered method that checked 'deep-qa' in register_all(). deep-qa was intentionally removed from the registry; the remaining TestDeepQaWorkflow tests that verify the deep_qa.py module itself are kept.
  • test_cycle_analyzer.py:397-400 — Changed "researcher" in r.node_trace to "researcher_similar" in r.node_trace. The test was migrated from evolve_workflow to build_workflow, which uses forked researcher nodes (researcher_similar, researcher_techstack, researcher_pitfalls) instead of a single researcher node.

Test results

  • All 3 targeted tests pass
  • Full suite: 1194 passed, 1 unrelated failure (test_contained.py — missing oc/kubectl on this machine)

RobotSail and others added 4 commits August 21, 2026 18:58
…1346)

Delete 17 workflow functions (~3,300 lines) from definitions.py, their
registry entries, WORKFLOW_META entries in skill_export.py, MODE_PHASES/
MODE_AGENT_TO_PHASE/MODE_EVENT_TO_PHASE entries in visualizer/state.py,
and all associated artifacts.

Deleted workflow functions: improve, research, meta, discover, review,
refine, skill_refine, doc_generate, doc_update, spec_update,
frontend_design, frontend_design_scan, frontend_design_discover,
evolve, parallel_improve, founder, study_standalone.

Surviving modes: design, create, spec-generate (plus all contributed
benchmark workflows untouched).

Kept as library functions (not registered): build_workflow (called by
design_workflow), _study_subgraph, _deep_qa_subgraph,
_research_subgraph (imported by deep_qa.py and research.py).

Synced all 6 locations: registry, WORKFLOW_META, MODE_*_TO_PHASE,
_auto_detect_mode, --mode help text, CEO routing tables.

Deleted artifacts: factory/agents/prompts/frontend_design/ (13 files),
factory/templates/design_checks/ (6 scripts), 6 test files for
deleted modes, 18 skill directories (generated, not tracked).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- test_workflow_integration.py: use 'archivist_build' node (build_workflow
  has archivist_build/archivist_plan, not 'archivist')
- test_workflow_qa.py: remove test_registered checking deep-qa in registry
  (deep-qa was intentionally removed from register_all)
- test_cycle_analyzer.py: use 'researcher_similar' node (build_workflow
  uses forked researcher nodes, not a single 'researcher')

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…moval

Update test assertions across 5 files to match the reduced workflow
registry after removing 17 dead modes in the prior commit:

- test_prompts.py: Replace build/improve workflow refs with design
  workflow (16 tests fixed)
- test_visualizer.py: Replace improve/research/build/meta mode-specific
  phase tests with design mode tests (16 tests fixed)
- test_lazy_loading.py: Update expected workflow set, replace deep-qa
  with swebench for lazy import test (3 tests fixed)
- test_workflow_research.py: Replace registration assertions with
  not-registered check (2 tests fixed)
- test_dashboard.py: Replace improve mode phase-detail test with
  design mode (1 test fixed)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@osilkin98
osilkin98 force-pushed the factory/run-3427af8a branch from c6f9f6e to 5ed3499 Compare August 21, 2026 19:07
@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown

Sentrux Quality Report

Absolute

Scanning ....
[scan] git ls-files: 599 total, 585 kept, 14 dropped (ext:14, meta:0, big:0)
[build_project_map] 585 files, 103 unique dirs, 95 cache misses, 5.1ms
[resolve] 1114 resolved, 1521 unresolved (of 2635 total specs)
[resolve_imports] project_map 5.2ms, suffix_idx 1.1ms, suffix_resolve 18.3ms, total 24.5ms
[build_graphs] 585 files | maps 2.4ms, imports 24.7ms, calls+inherit 5.9ms, total 33.0ms | 1113 import, 8026 call, 1 inherit edges
sentrux check — 3 rules checked

Quality: 4460

✗ [Error] max_cc: 3 function(s) exceed max cyclomatic complexity of 30
    factory/cli/_ceo_helpers.py:_validate_ceo_flags (cc=43)
    factory/cli/_ceo_helpers.py:_execute_ceo (cc=43)
    factory/cli/run.py:cmd_run (cc=32)

✗ 1 violation(s) found

Diff (vs base branch)

Scanning ....
[scan] git ls-files: 599 total, 585 kept, 14 dropped (ext:14, meta:0, big:0)
[build_project_map] 585 files, 103 unique dirs, 95 cache misses, 5.1ms
[resolve] 1114 resolved, 1521 unresolved (of 2635 total specs)
[resolve_imports] project_map 5.2ms, suffix_idx 1.1ms, suffix_resolve 18.0ms, total 24.4ms
[build_graphs] 585 files | maps 2.3ms, imports 24.6ms, calls+inherit 5.9ms, total 32.9ms | 1113 import, 8026 call, 1 inherit edges
sentrux gate — structural regression check

Quality:      4467 -> 4460
Coupling:     0.80 → 0.80
Cycles:       4 → 4
God files:    3 → 3

Distance from Main Sequence: 0.39

✓ No degradation detected

RobotSail and others added 3 commits August 21, 2026 20:48
Clean up 16 lint errors across 11 files introduced during rebase:
- Remove unused imports (build_workflow, FnNode, register_all)
- Remove stale noqa: F401 directives on symbols that are now used
- Remove noqa directives for non-enabled rules (ANN001, ANN202, BLE001, PLW0603, F841)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- test_cli.py: remove templates/ dir assertion since factory/templates/
  is now empty after design_checks/ deletion
- test_plan_workflow.py: remove test_plan_workflow_validates which calls
  `factory workflow validate plan` — plan is no longer a separate
  registry entry (produced via design_workflow(just_plan=True) instead)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.29%. Comparing base (e2cfca0) to head (ec5d1b4).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
factory/contained/bundle.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1376      +/-   ##
==========================================
- Coverage   84.89%   83.29%   -1.61%     
==========================================
  Files         205      205              
  Lines       23227    23003     -224     
  Branches     3688     3695       +7     
==========================================
- Hits        19719    19160     -559     
- Misses       2679     2988     +309     
- Partials      829      855      +26     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RobotSail

Copy link
Copy Markdown
Contributor

@ceo-review

@osilkin98
osilkin98 marked this pull request as ready for review August 22, 2026 00:44

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Factory Review: KEEP

Verdict: KEEP
Reason: QA: CLEAN — 4957 tests pass, composite score 0.9633, all 7 code review categories PASS, adversarial QA verified all 3 fixes correct with 298 tests and 0 failures

QA Analysis

Adversarial QA Report — PR #1376 Test Fixes

Project type: Library (Python CLI + workflow engine)
Date: 2026-08-22
Scope: 3 test bug fixes from workflow migration to build_workflow, plus 2 follow-up stale assertion removals


Smoke Test

Status: VERIFIED

$ uv run python -c "from factory.workflow.definitions import build_workflow, register_all; build_workflow(); register_all()"

No errors. Core workflow imports and construction succeed.


Test Plan

Derived from PR #1376 commit 0c176b80 which fixes 3 test bugs:

  1. Fix 1: test_workflow_integration.py:143 — changed wf.nodes.get('archivist') to wf.nodes.get('archivist_build')
  2. Fix 2: test_workflow_qa.py:155-157 — removed test_registered checking deep-qa in register_all()
  3. Fix 3: test_cycle_analyzer.py:397-400 — changed 'researcher' in r.node_trace to 'researcher_similar' in r.node_trace

Plus follow-up commit ec5d1b4f removing 2 additional stale assertions in test_cli.py and test_plan_workflow.py.


Acceptance Criteria Verification

Criterion 1: archivistarchivist_build node name fix

Status: VERIFIED

Evidence — node existence check:

$ uv run python -c "from factory.workflow.definitions import build_workflow; wf = build_workflow(); print('archivist_build:', 'archivist_build' in wf.nodes); print('archivist:', 'archivist' in wf.nodes)"
archivist_build: True
archivist: False

The old node name archivist does not exist in build_workflow(). The fix to archivist_build is correct.

Evidence — test execution:

$ uv run pytest tests/test_workflow_integration.py::TestImproveWorkflowMock::test_improve_archivist_nonblocking -v
PASSED

Criterion 2: Removal of test_registered checking deep-qa in register_all()

Status: VERIFIED

Evidence — registry check:

$ uv run python -c "from factory.workflow.definitions import register_all; all_wf = register_all(); print('deep-qa in register_all:', 'deep-qa' in all_wf); print('registered:', sorted(all_wf.keys()))"
deep-qa in register_all: False
registered: ['create', 'design', 'devopsgym', 'featurebench', 'legacybench', 'mini-swebench', 'outer-loop', 'programbench', 'salitrap', 'spec-generate', 'swebench', 'swebenchifyhard', 'terminalbench', 'tomswe']

deep-qa was intentionally removed from register_all() as part of the workflow mode removal. The removed assertion was stale. The deep-qa workflow still exists as a subgraph (via deep_qa_workflow()) and is tested separately — only the standalone registration was removed.

Evidence — test execution:

$ uv run pytest tests/test_workflow_qa.py -v
22 passed in 0.90s

Criterion 3: researcherresearcher_similar node trace fix

Status: VERIFIED

Evidence — node existence check:

$ uv run python -c "from factory.workflow.definitions import build_workflow; wf = build_workflow(); print('researcher_similar:', 'researcher_similar' in wf.nodes); print('researcher:', 'researcher' in wf.nodes)"
researcher_similar: True
researcher: False

build_workflow() uses forked researcher nodes (researcher_similar, researcher_techstack, researcher_pitfalls), not a single researcher. The fix is correct.

Evidence — test execution:

$ uv run pytest tests/test_cycle_analyzer.py::TestCycleAnalyzerDagMapping::test_node_trace_with_workflow -v
PASSED

Criterion 4: Follow-up stale assertion removals (commit ec5d1b4)

Status: VERIFIED

Evidence — test execution:

$ uv run pytest tests/test_cli.py::TestCmdHomeReturnsFactoryDir -v
1 passed in 0.08s

$ uv run pytest tests/test_plan_workflow.py -v
19 passed (test_plan_workflow_validates removed)

Regression Tests

Workflow definitions (62 tests)

Status: VERIFIED

$ uv run pytest tests/test_workflow_definitions.py -v
62 passed in 0.27s

Workflow registry (6 tests)

Status: VERIFIED

$ uv run pytest tests/test_workflow_registry.py -v
6 passed in 0.04s

Workflow research (19 tests)

Status: VERIFIED

$ uv run pytest tests/test_workflow_research.py -v
19 passed in 0.08s

Plan workflow (19 tests)

Status: VERIFIED

$ uv run pytest tests/test_plan_workflow.py -v
19 passed in 0.15s

Skill export (46 tests)

Status: VERIFIED

$ uv run pytest tests/test_skill_export.py -v
46 passed in 0.31s

Full cycle analyzer (43 tests)

Status: VERIFIED

$ uv run pytest tests/test_cycle_analyzer.py -v
43 passed in 0.24s

Full workflow integration (9 tests)

Status: VERIFIED

$ uv run pytest tests/test_workflow_integration.py -v
9 passed in 0.13s

Edge Case Tests

Edge Case 1: archivist_build blocking property

Status: VERIFIED

$ uv run python -c "from factory.workflow.definitions import build_workflow; wf = build_workflow(); print('blocking:', wf.nodes['archivist_build'].blocking)"
blocking: False

The archivist_build node retains the blocking=False property the test asserts.

Edge Case 2: researcher_similar role mapping

Status: VERIFIED

$ uv run python -c "from factory.workflow.definitions import build_workflow; wf = build_workflow(); n = wf.nodes['researcher_similar']; print('role:', n.role)"
role: researcher

The researcher_similar node correctly maps to role researcher, matching the test assertion r.node_trace["researcher_similar"].role == "researcher".

Edge Case 3: deep-qa workflow still functions as subgraph

Status: VERIFIED

$ uv run python -c "from factory.workflow.definitions import deep_qa_workflow; wf = deep_qa_workflow(); print('name:', wf.name); print('nodes:', len(wf.nodes))"
name: deep-qa
nodes: 7

The deep-qa workflow still exists and functions — it was only removed from the standalone registry, not deleted.


Process Cleanup

No servers, tmux sessions, or background processes were started. No cleanup needed.


Summary

# Criterion Status
1 archivistarchivist_build fix VERIFIED
2 Remove stale deep-qa registry assertion VERIFIED
3 researcherresearcher_similar fix VERIFIED
4 Follow-up stale assertion removals VERIFIED
5 No regressions in related test suites (224 tests) VERIFIED

Total tests executed: 298 (74 directly affected + 224 regression)
Total tests passed: 298
Total tests failed: 0

Adversarial Verdict: PASS

All 3 test fixes are correct and match the actual workflow state after the migration to build_workflow. The node names, registry contents, and role mappings all align. No regressions detected across 7 related test files.


Posted by Factory CEO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants