Skip to content

Latest commit

 

History

History
135 lines (93 loc) · 4.97 KB

File metadata and controls

135 lines (93 loc) · 4.97 KB

Deprecated — cube-standard

Code and artifacts flagged for future cleanup. Each item is actionable — remove, replace, rewrite, or consolidate. Nothing here is currently in progress; the list exists so we can pick up simplification work when timing allows.


Dead / placeholder code

AudioContent and VideoContent are placeholder classes

src/cube/core.py:331-370

Both classes raise NotImplementedError for to_markdown() and to_llm_message(). No code path in the framework ever constructs them.

class AudioContent(Content):
    data: bytes
    duration_seconds: float | None = None

    def to_markdown(self) -> str:
        raise NotImplementedError("Markdown rendering is not supported for audio content.")

    def to_llm_message(self) -> dict:
        raise NotImplementedError("Audio is not supported by LLM message format.")

Action: delete both classes. If audio/video support ever materializes, do it as a concrete openspec change with a real rendering strategy (transcript? thumbnail?).

ResourceConfig.source_hash is declared unused

src/cube/resource.py:127-128

source_hash: str | None = None
"""Content hash for informational purposes; not used for deduplication in v1."""

Action: remove the field. If v2 dedup is planned, reintroduce with the actual dedup logic in the same PR.

Legacy tuple format in aggregate_profiling

src/cube/testing.py — search for (start_ts, end_ts) tuple handling

The function accepts a legacy (start_ts, end_ts) tuple alongside the current float | dict shape. Benchmark authors migrated to the new format.

Action: drop the tuple branch; require float or dict.

Double task.close() in debug episode

src/cube/testing.py:173-178

run_debug_episode calls close() twice to verify idempotency — once outside the try and once inside a try/except that writes close_idempotent_ok.

Action: call close() once in finally. Move idempotency into a dedicated unit test in tests/.


Legacy parameters / migration debt

container_backend is being replaced by the infra/resource pattern

server.py already comments "container_backend is intentionally not forwarded — it is a legacy parameter being replaced by the infra / resource pattern."

Action: remove the parameter from Task, TaskConfig.make, and Benchmark in a single breaking change. Downstream callers in cube-harness (episode.py:48,113 and experiment.py:87) must be updated in the same PR.

Task.step never sets truncated=True

src/cube/task.py:256-257

# TODO: Add truncation logic based on step limits or time limits

Action: decide whether truncation is a Task concern or a harness concern. If Task-level, implement. If harness-level, remove the unused truncated field from EnvironmentOutput (or document that it's harness-owned).


Untyped dicts that should be models

RuntimeContext is a bare dict

src/cube/task.py:39-45

RuntimeContext = dict[str, Any]
"""
example:
    {"container_id": "abc123", "vm_address": "http://12.34.56.78", "ssh_session": session}
"""

Every benchmark stores its own shape; no validation; documented keys rot.

Action: introduce a RuntimeContext(TypedBaseModel) with typed slots for the common infra references (server URLs, DB connections, handles). Benchmarks that need custom fields subclass.


Duplication to consolidate

BrowserSession / AsyncBrowserSession are near-duplicates

src/cube/resources/browser_session.py (and matching configs)

Two abstracts + two config classes differ only in async def. Pattern will repeat for every new session type.

Action: consolidate on one protocol with an async mode flag, or generate one from the other with a decorator. Same treatment for ChatSession siblings if they appear.


Template drift risk

cube init template ships inside the package

src/cube/_template/new_cube_package/ + src/cube/cli.py:105

Any API change in cube.task, cube.benchmark, cube.tool must be reflected in the template or cube init emits stale scaffolding.

Action: add a lint-in-CI that imports the template files against the current package to catch drift. Or run cube test against the scaffold as part of CI.