0506c5da63
TIER-2 READ AGENTS.md, conductor/workflow.md, conductor/edit_workflow.md,
conductor/tier2/githooks/forbidden-files.txt,
conductor/tracks/tier2_leak_prevention_20260620/spec.md,
conductor/code_styleguides/data_oriented_design.md,
conductor/code_styleguides/error_handling.md,
conductor/code_styleguides/type_aliases.md before Phase 1.
Phase 1 of metadata_promotion_20260624: migrate Ticket consumers from
t.get('key', default) / t['key'] to direct field access (t.id, t.status, etc.).
Changes:
- self.active_tickets: list[Metadata] -> list[models.Ticket]
- _deserialize_active_track_result populates self.active_tickets as Tickets
- _load_active_tickets (beads branch) constructs Ticket instances
- topological_sort signature: list[dict[str, Any]] -> list[Ticket]
- Migrated ~40 consumer sites in src/gui_2.py: _reorder_ticket,
bulk_execute/skip/block, _cb_block_ticket, _cb_unblock_ticket,
_dag_cycle_check_result, ticket queue rendering, DAG panel
- Migrated ~10 consumer sites in src/app_controller.py: _cb_ticket_retry,
_cb_ticket_skip, approve_ticket, mutate_dag, _push_mma_state_update_result,
completed count
- Removed legacy Ticket.get() compat method (Task 1.5)
- Added tests/test_metadata_promotion_phase1.py with 15 regression-guard tests
- Updated existing tests to construct Ticket instances instead of dicts
Verified: 1885 of 1910 unit tests pass (25 pre-existing failures unrelated
to Ticket migration; many are live_gui/sim tests that need a running GUI).
52 lines
1.7 KiB
Python
52 lines
1.7 KiB
Python
import pytest
|
|
from pathlib import Path
|
|
from src import app_controller, beads_client, models
|
|
import tomli_w
|
|
|
|
def test_load_active_tickets_from_beads(tmp_path: Path):
|
|
# 1. Setup mock Beads repository
|
|
workspace_dir = tmp_path / "workspace"
|
|
workspace_dir.mkdir()
|
|
bclient = beads_client.BeadsClient(workspace_dir)
|
|
bclient.init_repo()
|
|
bclient.create_bead(title="Bead 1", description="Description 1")
|
|
|
|
# 2. Setup mock project file
|
|
proj_path = workspace_dir / "project.toml"
|
|
proj_data = {
|
|
"project": {
|
|
"name": "test_project",
|
|
"execution_mode": "beads"
|
|
},
|
|
"mma": {
|
|
"active_track": {
|
|
"id": "track_20260309",
|
|
"description": "Mock Track",
|
|
"tickets": []
|
|
}
|
|
}
|
|
}
|
|
with open(proj_path, "wb") as f:
|
|
tomli_w.dump(proj_data, f)
|
|
|
|
# 3. Initialize AppController (minimal)
|
|
ctrl = app_controller.AppController()
|
|
ctrl.active_project_path = str(proj_path)
|
|
ctrl.project = proj_data
|
|
ctrl.ui_project_execution_mode = "beads"
|
|
# We'll need this to resolve the beads repo
|
|
ctrl.ui_files_base_dir = str(workspace_dir)
|
|
|
|
# 4. Call the new loading method (to be implemented)
|
|
# For now, we simulate what we expect to happen
|
|
if hasattr(ctrl, "_load_active_tickets"):
|
|
ctrl._load_active_tickets()
|
|
else:
|
|
# Initial implementation will go here or in init_state
|
|
pass
|
|
|
|
# 5. Verify active_tickets populated from Beads
|
|
assert len(ctrl.active_tickets) == 1
|
|
assert ctrl.active_tickets[0].id == "bead-1"
|
|
assert ctrl.active_tickets[0].description == "Description 1"
|