diff --git a/apps/presentation/dashboard/src/data/chat.ts b/apps/presentation/dashboard/src/data/chat.ts index 8488f528ef..c3db5a2c22 100644 --- a/apps/presentation/dashboard/src/data/chat.ts +++ b/apps/presentation/dashboard/src/data/chat.ts @@ -16,7 +16,6 @@ import { type CollaborationReadback, type LoopXModeSettings, type TodoApplyResult, - type TodoPreview, } from "./chat-model.js"; import type {DelegationPreflight} from "./delegation-preflight.js"; diff --git a/apps/presentation/dashboard/src/data/delivery-review.ts b/apps/presentation/dashboard/src/data/delivery-review.ts index 4986e2f37a..39781a7e42 100644 --- a/apps/presentation/dashboard/src/data/delivery-review.ts +++ b/apps/presentation/dashboard/src/data/delivery-review.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { hasConfiguredGoalChecks, type GoalAcceptanceChecks, goalAcceptanceDisplayStatus, goalAcceptanceObservationSchema, projectGoalAcceptanceCriteria, type GoalAcceptanceContract } from "./goal-acceptance-observation.js"; +import { hasConfiguredGoalChecks, type GoalAcceptanceChecks, goalAcceptanceDisplayStatus, goalAcceptanceObservationSchema, projectGoalAcceptanceCriteria } from "./goal-acceptance-observation.js"; // Consumer validation only; freshness and coverage remain kernel decisions. const projectionEnvelopeSchema = z.object({ diff --git a/apps/presentation/dashboard/src/data/goal-channel-frontstage.ts b/apps/presentation/dashboard/src/data/goal-channel-frontstage.ts index 66374f9adb..4dfa2baca4 100644 --- a/apps/presentation/dashboard/src/data/goal-channel-frontstage.ts +++ b/apps/presentation/dashboard/src/data/goal-channel-frontstage.ts @@ -401,13 +401,6 @@ export function leaseStatusTone(status?: string | null): BadgeTone { return LEASE_STATUS_TONES[normalizeToken(status)] ?? "neutral"; } -function stringifySourceRef(value: string | number | boolean | null | undefined): string { - if (value === null || value === undefined) { - return "n/a"; - } - return String(value); -} - export function deriveOperatorStateSignals( projection: GoalChannelProjection, ): OperatorStateSignal[] { diff --git a/apps/presentation/dashboard/src/features/personal-workspace/message-activity.tsx b/apps/presentation/dashboard/src/features/personal-workspace/message-activity.tsx index f82e1b24a9..ec907647ac 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/message-activity.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/message-activity.tsx @@ -11,7 +11,7 @@ export function MessageActivity({ message, onInterruptTurn, onAdjustTurn, onCanc onInterruptTurn?: (turnId: string) => Promise; onAdjustTurn?: (turnId: string) => void; }) { - const { locale, t } = useWorkspaceI18n(); + const { locale } = useWorkspaceI18n(); const zh = locale === "zh-CN"; const [stopping, setStopping] = useState(false); const [error, setError] = useState(null); diff --git a/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-page.tsx b/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-page.tsx index a87734025c..94e96ece80 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-page.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-page.tsx @@ -69,7 +69,7 @@ import { GoalOverview, goalOverviewAttentionId } from "./goal-overview"; import { GoalVitals, GoalVitalsSkeleton, type GoalVitalRegion } from "./goal-masthead"; import { GoalWorkspacePanels } from "./goal-workspace-panels"; import {GoalWorkBrowseProvider, readGoalWorkBrowse, type GoalWorkBrowseState} from "./goal-work-browse"; -import { localizedGoalState, localizedSessionStatus, useWorkspaceI18n, type WorkspaceTranslate } from "./i18n"; +import { localizedSessionStatus, useWorkspaceI18n, type WorkspaceTranslate } from "./i18n"; import {returnedAnswerStart} from "./message-reading"; import type { PersonalWorkspaceCallbacks, @@ -869,7 +869,6 @@ export function PersonalWorkspacePage({ model, researchApi, readOnly: sourceReadOnly = false, - typedActionsRevision = 0, selectedAgentId: controlledAgentId, selectedAgentModelId, selectedAgentModelReadback, @@ -2649,7 +2648,6 @@ export function PersonalWorkspacePage({ } } - const selectedAgentLabel = agents.find((agent) => agent.agentId === selectedAgentId)?.label ?? selectedAgentId; async function selectImages(files: FileList | readonly File[] | null) { diff --git a/apps/presentation/dashboard/src/views/dashboard-page.tsx b/apps/presentation/dashboard/src/views/dashboard-page.tsx index 0a85804d04..a3a6eabbba 100644 --- a/apps/presentation/dashboard/src/views/dashboard-page.tsx +++ b/apps/presentation/dashboard/src/views/dashboard-page.tsx @@ -412,7 +412,7 @@ function quotaStateForShare(row?: GoalDirectoryRow) { function buildAgentManagementRows( rows: GoalDirectoryRow[], - todoIndex?: TodoIndexSummary | null, + _todoIndex?: TodoIndexSummary | null, projection?: AgentManagementProjection | null, ): AgentManagementRow[] { const items: TodoExplorerItem[] = []; diff --git a/apps/presentation/dashboard/src/views/frontstage-developer-page.tsx b/apps/presentation/dashboard/src/views/frontstage-developer-page.tsx index f70d2a38f4..da3076605b 100644 --- a/apps/presentation/dashboard/src/views/frontstage-developer-page.tsx +++ b/apps/presentation/dashboard/src/views/frontstage-developer-page.tsx @@ -7,7 +7,6 @@ import { FileJson, GitCompareArrows, LayoutDashboard, - ListChecks, ShieldCheck, TestTube2, } from "lucide-react"; diff --git a/docs/concepts/interaction-pattern-catalog.md b/docs/concepts/interaction-pattern-catalog.md index 944581b480..f5c69c200e 100644 --- a/docs/concepts/interaction-pattern-catalog.md +++ b/docs/concepts/interaction-pattern-catalog.md @@ -1328,10 +1328,15 @@ reward signals, oracle information, or unbounded human hints. **Validation** -- `examples/worker-bridge-active-user-after-start-observation-smoke.py` -- `examples/worker-bridge-install-contract-smoke.py` +- [`examples/worker-bridge-active-user-after-start-observation-smoke.py`](https://github.com/loopx-project/loopx/blob/0cd999ca0dd6290c9b48b84bc23c5f6b40630516/examples/worker-bridge-active-user-after-start-observation-smoke.py) +- [`examples/worker-bridge-install-contract-smoke.py`](https://github.com/loopx-project/loopx/blob/0cd999ca0dd6290c9b48b84bc23c5f6b40630516/examples/worker-bridge-install-contract-smoke.py) - benchmark active-user protocol docs. +The linked scripts are historical versions. They were removed from the current +checkout in [#3267](https://github.com/loopx-project/loopx/pull/3267). Current +checks include `examples/worker-bridge-active-user-feed-smoke.py` and +`examples/cli-worker-bridge-command-modularization-smoke.py`. + #### IP-033 Recorded Rejection Is Not Absent Authority **Trigger** diff --git a/docs/development/control-plane-course/04-state-substrate.md b/docs/development/control-plane-course/04-state-substrate.md index d9fc1e6f53..b839530019 100644 --- a/docs/development/control-plane-course/04-state-substrate.md +++ b/docs/development/control-plane-course/04-state-substrate.md @@ -199,7 +199,7 @@ Registry 适合保存: ### 2. Event ledger:追加式事实 -事件流保存“发生过什么”。协议见 `docs../../reference/protocols/event-sourced-state-contract-v0.md`。 +事件流保存“发生过什么”。协议见 `docs/reference/protocols/event-sourced-state-contract-v0.md`。 代表性事件包括: @@ -555,7 +555,7 @@ def resolve_state_file(repo: Path, state_file: str | None) -> Path | None: ### 2. Event store 用锁、sequence 和 fingerprint 保证可 replay -`loopx/event_sourced_state.py` 先规范化事件,再在 append 时重新读取锁内真相: +历史版本的 [`loopx/event_sourced_state.py`](https://github.com/loopx-project/loopx/blob/4619475a39c760e04e7f2df4f7fd3608eaa1bb7b/loopx/event_sourced_state.py#L509) 先规范化事件,再在 append 时重新读取锁内真相: ```python def make_state_event(*, event_id, goal_id, event_type, @@ -595,7 +595,7 @@ def append(self, event): 这就是“append-only”比“只用文件追加模式打开”更强的地方。 -建议断点:`AppendOnlyStateEventStore.append:511`。用同一事件 append 两次,再修改 payload append 第三次,比较两个结果。 +历史版本的建议断点:`AppendOnlyStateEventStore.append:560`。用同一事件 append 两次,再修改 payload append 第三次,比较两个结果。 ### 3. Todo projection 先信结构化事件,缺失时才兼容 Markdown @@ -692,7 +692,7 @@ loopx --format json quota should-run --goal-id --agent-id | --- | --- | --- | | 1 | `examples/registry.example.json` | 注册配置的边界 | | 2 | `examples/active-goal-state.example.md` | 人可读工作台 | -| 3 | `docs../../reference/protocols/event-sourced-state-contract-v0.md` | 事件与 replay | +| 3 | `docs/reference/protocols/event-sourced-state-contract-v0.md` | 事件与 replay | | 4 | `docs/reference/protocols/active-state-structured-projection-v0.md` | projection 非写 API | | 5 | `docs/status-data-contract.md` | status read model | | 6 | `loopx/control_plane/todos/`、`loopx/control_plane/work_items/lifecycle.py` | todo contract 与 transition lifecycle | diff --git a/examples/canary/catalog-planner-smoke.py b/examples/canary/catalog-planner-smoke.py index f27dc612cf..93a0875b79 100644 --- a/examples/canary/catalog-planner-smoke.py +++ b/examples/canary/catalog-planner-smoke.py @@ -712,7 +712,7 @@ def assert_pr_release_and_refactor_profiles_select() -> None: in runtime_connector_commands ) assert "python3 examples/claude-goalmode-lifecycle-smoke.py" in runtime_connector_commands - assert "python3 examples/worker-bridge-install-contract-smoke.py" in runtime_connector_commands + assert "python3 examples/cli-worker-bridge-command-modularization-smoke.py" in runtime_connector_commands assert all(check["tier"] == "default" for check in runtime_connector_profile["checks"]) assert runtime_connector_profile["deep_checks_available"] is True, runtime_connector_profile assert runtime_connector_profile["deep_checks_included"] is False, runtime_connector_profile diff --git a/examples/cli-worker-bridge-command-modularization-smoke.py b/examples/cli-worker-bridge-command-modularization-smoke.py index 1dcd9f1e0e..5ca921963c 100644 --- a/examples/cli-worker-bridge-command-modularization-smoke.py +++ b/examples/cli-worker-bridge-command-modularization-smoke.py @@ -12,6 +12,9 @@ CLI = ROOT / "loopx" / "cli.py" MODULE = ROOT / "loopx" / "cli_commands" / "worker_bridge.py" INIT = ROOT / "loopx" / "cli_commands" / "__init__.py" +sys.path.insert(0, str(ROOT)) + +from loopx.worker_bridge import build_worker_bridge_install_contract # noqa: E402 def run_cli(*args: str, stdin: str | None = None) -> subprocess.CompletedProcess[str]: @@ -78,6 +81,64 @@ def main() -> None: == "loopx_worker_bridge_install_contract_v0", "contract schema changed", ) + require( + contract_payload["bridge_surface"] == "loopx_worker_bridge_source_mount_v0", + "bridge surface changed", + ) + require(contract_payload["install_mode"] == "source_mount_read_only_pythonpath", "install mode changed") + require( + contract_payload["runtime_policy"] == "ensure_python3_before_worker_cli_bridge", + "runtime policy changed", + ) + require("apt-get install -y python3" in contract_payload["runtime_preflight_command"], "Python preflight missing") + require("importlib.import_module" in contract_payload["runtime_preflight_command"], "module preflight missing") + require( + contract_payload["mounts"] == [ + { + "read_only": True, "source": "", + "target": "", "type": "bind", + }, + { + "read_only": True, "source": "", + "target": "", "type": "bind", + }, + ], + "default mounts must be read-only", + ) + require(contract_payload["boundary"]["no_upload"] is True, "contract must not upload") + require( + contract_payload["boundary"]["credential_values_recorded"] is False, + "contract must not record credentials", + ) + agent_kwargs = contract_payload["agent_kwargs"] + require( + agent_kwargs["loopx_command_prefix"] == "PYTHONPATH='' python3 -m loopx.cli", + "worker CLI prefix changed", + ) + require(agent_kwargs["loopx_registry_arg"] == "/registry.global.json", "registry path changed") + require(contract_payload["trace"]["raw_trace_public"] is False, "raw trace must stay private") + + writable_contract = build_worker_bridge_install_contract(active_user_host_dir="") + require( + writable_contract["mounts"][-1] + == { + "read_only": False, "source": "", + "target": "/loopx-active-user", "type": "bind", + }, + "active-user feed mount changed", + ) + require( + writable_contract["active_user_external_update_mount"]["raw_host_path_recorded"] is False, + "host path must not be recorded", + ) + require( + writable_contract["agent_kwargs"]["loopx_active_user_feed_jsonl"] + == "/loopx-active-user/loopx-active-user-interventions.jsonl", + "active-user feed path changed", + ) + channel_boundary = writable_contract["active_user_intervention_channel_contract"]["claim_boundary"] + require(channel_boundary["direct_codex_chat_injection"] is False, "direct chat injection must be disabled") + require(channel_boundary["worker_pull_required"] is True, "worker pull must be required") with tempfile.TemporaryDirectory(prefix="loopx-worker-bridge-cli-") as tmp: root = Path(tmp) diff --git a/loopx/canary/planner.py b/loopx/canary/planner.py index 29af2a36eb..887a6eed78 100644 --- a/loopx/canary/planner.py +++ b/loopx/canary/planner.py @@ -272,7 +272,7 @@ "reason": "samples project-local uninstall safety with isolated fixture registries", }, { - "command": "python3 examples/worker-bridge-install-contract-smoke.py", + "command": "python3 examples/cli-worker-bridge-command-modularization-smoke.py", "tier": "deep", "reason": "checks generic worker bridge install contracts without exposing private runtime material", }, @@ -1010,9 +1010,9 @@ "reason": "checks the Claude Code goal-mode loop lifecycle without production actions", }, { - "command": "python3 examples/worker-bridge-install-contract-smoke.py", + "command": "python3 examples/cli-worker-bridge-command-modularization-smoke.py", "tier": "default", - "reason": "checks generic worker bridge install/status contracts without private runtime material", + "reason": "checks the worker bridge install and active-user observation contracts without private runtime material", }, { "command": "python3 examples/computer-use-runtime-contract-smoke.py", diff --git a/loopx/control_plane/capabilities/explore_research_execution.ts b/loopx/control_plane/capabilities/explore_research_execution.ts index 12713b9684..28f47ca25d 100644 --- a/loopx/control_plane/capabilities/explore_research_execution.ts +++ b/loopx/control_plane/capabilities/explore_research_execution.ts @@ -4,7 +4,7 @@ import {EffectRuntimeRequestError} from "../effect_runtime_errors.ts"; import {requireJsonObject} from "../runtime_decode.ts"; import {normalizeResearchCompositionPolicy} from "./explore_configuration.ts"; export {normalizeResearchCompositionPolicy} from "./explore_configuration.ts"; -import {normalizeResearchObservation, researchCompositionGaps, researchIdentifier, researchDigest, +import {normalizeResearchObservation, researchCompositionGaps, researchDigest, validateResearchAttribution} from "./explore_research.ts"; import {evaluateTodoResumeConditions, TODO_RESUME_EVALUATION_REQUEST_SCHEMA_VERSION, resumeConditionHasKnownPendingTarget} from "../todos/resume_condition.ts"; diff --git a/loopx/control_plane/coordination/cold_source_import.ts b/loopx/control_plane/coordination/cold_source_import.ts index 209804f008..82300faac6 100644 --- a/loopx/control_plane/coordination/cold_source_import.ts +++ b/loopx/control_plane/coordination/cold_source_import.ts @@ -5,7 +5,7 @@ import {createHash} from "node:crypto"; import {createReadStream} from "node:fs"; import {lstat, readFile, readdir, statfs} from "node:fs/promises"; -import {join, isAbsolute, relative, resolve} from "node:path"; +import {join, isAbsolute, relative} from "node:path"; import type {JsonObject} from "../effect_program.ts"; import {durableWriteJson} from "../effect_runtime_io.ts"; import {requireJsonObject} from "../runtime_decode.ts"; diff --git a/loopx/control_plane/coordination/continuation_note.ts b/loopx/control_plane/coordination/continuation_note.ts index 8a80bd9d3b..51e3374c9d 100644 --- a/loopx/control_plane/coordination/continuation_note.ts +++ b/loopx/control_plane/coordination/continuation_note.ts @@ -103,7 +103,7 @@ const APPROACH_KEYS = new Set(["approach", "outcome", "reason"]); const FILE_KEYS = new Set(["path", "action", "summary"]); const DECISION_KEYS = new Set(["decision", "rationale"]); -function boundedString(value: unknown, name: string, max: number): value is string { +function boundedString(value: unknown, _name: string, max: number): value is string { return typeof value === "string" && value.trim().length > 0 && value.length <= max; } diff --git a/loopx/control_plane/coordination/local_authority_runtime.ts b/loopx/control_plane/coordination/local_authority_runtime.ts index 3115e78b46..defde2dcb7 100644 --- a/loopx/control_plane/coordination/local_authority_runtime.ts +++ b/loopx/control_plane/coordination/local_authority_runtime.ts @@ -13,8 +13,7 @@ import {executeTodoContinuation} from "./todo_continuation.ts"; import {canonicalAuthorityRouteFailure, requireCanonicalAuthority, withCanonicalWriter} from "./local_authority_write.ts"; import { ShadowManagementError, withShadowMaintenanceLock } from "./shadow_management.ts"; import { isAbsolute, join } from "node:path"; -import {readFile, realpath} from "node:fs/promises"; -import {createHash} from "node:crypto"; +import {realpath} from "node:fs/promises"; import type { JsonObject } from "../effect_program.ts"; import {decodeCompletionValidationRevision} from "../todos/completion_validation_revision.ts"; @@ -27,10 +26,6 @@ import { LOCAL_COORDINATION_PROMOTION_RESULT_SCHEMA, LOCAL_COORDINATION_PROMOTION_REVIEW_REQUEST_SCHEMA, LOCAL_COORDINATION_PROMOTION_REVIEW_RESULT_SCHEMA, - LOCAL_COORDINATION_TODO_LIST_REQUEST_SCHEMA, - LOCAL_COORDINATION_TODO_LIST_RESULT_SCHEMA, - LOCAL_COORDINATION_TODO_READ_REQUEST_SCHEMA, - LOCAL_COORDINATION_TODO_READ_RESULT_SCHEMA, } from "./coordination_state_contract.generated.ts"; import { indexCoordinationProjection, diff --git a/loopx/control_plane/coordination/postgresql_authority_seed.ts b/loopx/control_plane/coordination/postgresql_authority_seed.ts index e41aed182e..19e5c5abb5 100644 --- a/loopx/control_plane/coordination/postgresql_authority_seed.ts +++ b/loopx/control_plane/coordination/postgresql_authority_seed.ts @@ -17,7 +17,6 @@ import { link, lstat, open, unlink } from "node:fs/promises"; import { dirname, join } from "node:path"; import type { JsonObject } from "../effect_program.ts"; import { - canonicalAuthorityObject, canonicalAuthoritySha256, isAuthorityJsonObject, requireAuthorityStoreId, @@ -29,7 +28,6 @@ import { installPostgreSqlAuthorityStoreSchema, PostgreSqlAuthorityStore, type PostgreSqlAuthorityDatabase, - type PostgreSqlAuthorityConnection, } from "./postgresql_authority_store.ts"; import { syncAuthorityDirectory } from "./file_authority_store.ts"; import { openLocalAuthorityStoreHandle } from "./local_authority_provider.ts"; diff --git a/loopx/control_plane/coordination/shadow_management.ts b/loopx/control_plane/coordination/shadow_management.ts index 02698590d2..de8718f7a5 100644 --- a/loopx/control_plane/coordination/shadow_management.ts +++ b/loopx/control_plane/coordination/shadow_management.ts @@ -158,7 +158,7 @@ function validBinding(value: unknown, digest: string, goal: string, exactIdentit && /^file:[1-9][0-9]*:[0-9a-f]{24}$/.test(String(value.bootstrap_provider_revision)) && (!exactIdentity || sameGoalRef(value.goal_ref, value.goal_ref, goal)); } -function decodeState(value: unknown, root: string, goal: string): ShadowManagementState { +function decodeState(value: unknown, _root: string, goal: string): ShadowManagementState { const fail = () => { throw new ShadowManagementError("shadow_management_state_invalid"); }; if (!exact(value, ["schema_version", "goal_id", "source_root_digest", "status", "binding", "operation", "previous_operation_id", "result"])) return fail(); const exactIdentity = value.schema_version === SHADOW_MANAGEMENT_EXACT_STATE_SCHEMA; diff --git a/loopx/control_plane/coordination/sqlite_authority_migration.ts b/loopx/control_plane/coordination/sqlite_authority_migration.ts index 301f37870b..305f780ad0 100644 --- a/loopx/control_plane/coordination/sqlite_authority_migration.ts +++ b/loopx/control_plane/coordination/sqlite_authority_migration.ts @@ -22,7 +22,7 @@ import type { DatabaseSync } from "node:sqlite"; import type { JsonObject } from "../effect_program.ts"; import { AuthorityStoreProtocolError, canonicalAuthorityObject, canonicalAuthorityObjectList, requireAuthorityStoreId } from "./authority_store_codec.ts"; -import { applyAuthorityStateDelta, authorityStateCheckpointCursor, authorityStateDelta, +import { applyAuthorityStateDelta, authorityStateDelta, authorityStateDeltaReconstructs, authorityStateDigest, decodeAuthorityStateDelta, isAuthorityStateCheckpoint } from "./authority_state_log.ts"; import { diff --git a/loopx/control_plane/coordination/task_lease_lifecycle.ts b/loopx/control_plane/coordination/task_lease_lifecycle.ts index 9290c000c9..3a5b6ad62a 100644 --- a/loopx/control_plane/coordination/task_lease_lifecycle.ts +++ b/loopx/control_plane/coordination/task_lease_lifecycle.ts @@ -13,7 +13,7 @@ import {decideTaskLeaseLifecycle, materializeTaskLeaseLifecycle, import {requireStringLiteral} from "../runtime_decode.ts"; import {HANDOFF_MODES, EXECUTION_HANDOFF_MODES, retiredHandoffModeRejection, HANDOFF_MODE_RETIRED_REASON, type ExecutionHandoffMode} from "./handoff_mode_policy.ts"; -import {leaseEpoch, leaseIsActive, leaseVersion, normalizeAgent, normalizeGoalId, +import {leaseEpoch, leaseIsActive, leaseVersion, normalizeGoalId, normalizeIdempotencyKey, normalizeOwner, normalizeTodoId, normalizeTtl, utcIsoformat, TaskLeaseAcquireError, type LeaseRecord} from "../work_items/task_lease_acquire.ts"; import {taskLeaseOperationIdentity, taskLeaseOperationRequestDigest} from "../work_items/task_lease_operation_identity.ts"; diff --git a/loopx/control_plane/coordination/todo_claim.ts b/loopx/control_plane/coordination/todo_claim.ts index b85f72f070..10d9eb0513 100644 --- a/loopx/control_plane/coordination/todo_claim.ts +++ b/loopx/control_plane/coordination/todo_claim.ts @@ -28,7 +28,6 @@ import { import { leaseInteger, leaseIsActive, - normalizeAgent, normalizeIdempotencyKey, normalizeTtl, } from "../work_items/task_lease_acquire.ts"; diff --git a/loopx/control_plane/goals/vision_wait_coverage.ts b/loopx/control_plane/goals/vision_wait_coverage.ts index 65dda2aca4..60ae6e8b27 100644 --- a/loopx/control_plane/goals/vision_wait_coverage.ts +++ b/loopx/control_plane/goals/vision_wait_coverage.ts @@ -1,6 +1,6 @@ import type { JsonObject } from "../effect_program.ts"; import { EffectRuntimeRequestError } from "../effect_runtime_errors.ts"; -import { jsonObject, optionalNonEmptyString, requireInteger, requireJsonObject, requireStringArray } from "../runtime_decode.ts"; +import { optionalNonEmptyString, requireInteger, requireJsonObject, requireStringArray } from "../runtime_decode.ts"; import { projectTodoResumePlanning } from "../todos/resume_planning.ts"; import { automaticResumeFields, normalizedTodoId, selectPendingResume } from "../todos/automatic_resume.ts"; diff --git a/loopx/control_plane/todos/authoring_scope.ts b/loopx/control_plane/todos/authoring_scope.ts index f102b296e8..d986ce2fb6 100644 --- a/loopx/control_plane/todos/authoring_scope.ts +++ b/loopx/control_plane/todos/authoring_scope.ts @@ -244,7 +244,7 @@ export function userTodoScopeConflict(taskClass: string | null, scope: Scope, } function validateScope(role: string, taskClass: string | null, scope: Scope, agentCount: number): void { - const { bound_agent: bound, goal_bound: goal, blocks_agent: blocks, global_gate: global } = scope; + const { bound_agent: bound, goal_bound: goal } = scope; if (role !== "user") { if (bound || goal) fail("bound_agent and goal_bound are only valid for user todos"); return; diff --git a/loopx/control_plane/todos/field_update.ts b/loopx/control_plane/todos/field_update.ts index 64362b10a1..03e9507087 100644 --- a/loopx/control_plane/todos/field_update.ts +++ b/loopx/control_plane/todos/field_update.ts @@ -1,6 +1,6 @@ /** Pure field intent planning. Admission, leases, validation and commit stay * with the calling lifecycle transaction; this result grants no write right. */ -import { appendTodoExploreReferences, normalizeTodoWorkRequirements } from "./work_requirements.ts"; +import { appendTodoExploreReferences } from "./work_requirements.ts"; import {planTodoPriority} from "./priority.ts"; import type { JsonObject } from "../effect_program.ts"; import { EffectRuntimeRequestError } from "../effect_runtime_errors.ts"; diff --git a/loopx/control_plane/todos/read_codec.ts b/loopx/control_plane/todos/read_codec.ts index 60ba4f952a..7f6110b729 100644 --- a/loopx/control_plane/todos/read_codec.ts +++ b/loopx/control_plane/todos/read_codec.ts @@ -115,7 +115,7 @@ function repr(value: unknown): string { if (value == null) return "None"; if (typeof value === "boolean") return value ? "True" : "False"; if (Array.isArray(value)) return "[" + value.map((_, i) => fieldRepr(value, i)).join(", ") + "]"; - if (typeof value === "object") return "{" + Object.entries(value).map(([k, v]) => `${repr(k)}: ${fieldRepr(value as JsonObject, k)}`).join(", ") + "}"; + if (typeof value === "object") return "{" + Object.entries(value).map(([k]) => `${repr(k)}: ${fieldRepr(value as JsonObject, k)}`).join(", ") + "}"; if (typeof value !== "string") return String(value); const quote = value.includes("'") && !value.includes('"') ? '"' : "'"; return quote + Array.from(value).map(point => { @@ -198,7 +198,7 @@ export function handoffSource(item: JsonObject): JsonObject { for (const key of ["handoff", "handoff_note"]) { const value = item[key], row = object(value); if (truthy(value)) nested[key] = {truthy: true, fields: value !== null && typeof value === "object" && !Array.isArray(value) - ? Object.fromEntries(Object.entries(row).map(([k, v]) => [k, pythonFieldText(row, k)])) : null}; + ? Object.fromEntries(Object.entries(row).map(([k]) => [k, pythonFieldText(row, k)])) : null}; nestedMetadata[key] = {from_agent: readAgent(truthy(row.from_agent) ? row.from_agent : item.agent_id), to_agent: readAgent(row.to_agent), evidence_refs: refs(row.evidence_refs)}; } diff --git a/loopx/control_plane/turn_driver/settlement.ts b/loopx/control_plane/turn_driver/settlement.ts index 6f530cc1d4..35e8514894 100644 --- a/loopx/control_plane/turn_driver/settlement.ts +++ b/loopx/control_plane/turn_driver/settlement.ts @@ -260,7 +260,7 @@ function reductionWithTurnOutcome( state: TurnSettlementState, receipts: SettlementResult["receipts"], terminalPayload: JsonObject | null, - identity: BoundSettlementIdentity, + _identity: BoundSettlementIdentity, ): TurnSettlementOutcome { validateTurnOutcomeKind(request); const result = settlementPure(state, receipts); diff --git a/loopx/control_plane/turn_driver/turn_journal_effects.ts b/loopx/control_plane/turn_driver/turn_journal_effects.ts index 12035dbda0..4d5a5527fc 100644 --- a/loopx/control_plane/turn_driver/turn_journal_effects.ts +++ b/loopx/control_plane/turn_driver/turn_journal_effects.ts @@ -27,7 +27,6 @@ import { journalPhaseViolation, parseTurnJournalGoalBinding, supportedJournalStatuses, - transactionPhases, type TurnJournalGoalBinding, } from "./turn_journal.ts"; diff --git a/loopx/control_plane/work_items/task_lease_acquire.ts b/loopx/control_plane/work_items/task_lease_acquire.ts index 07e83296d2..bba12844c6 100644 --- a/loopx/control_plane/work_items/task_lease_acquire.ts +++ b/loopx/control_plane/work_items/task_lease_acquire.ts @@ -18,9 +18,6 @@ import { EffectRuntimeLockTimeoutError, EffectRuntimeRequestError, } from "../effect_runtime_errors.ts"; -import { - taskLeaseLockPath, -} from "../coordination/legacy_writer_lock_paths.ts"; import { settlementIdentity, type JsonObject, @@ -578,7 +575,7 @@ export async function revalidateAuthoritySources(receipts: readonly SourceReceip } function successEnvelope( - request: AcquireRequest, + _request: AcquireRequest, lease: LeaseRecord, leasePath: string, effectId: string, diff --git a/loopx/control_plane/work_items/task_lease_lifecycle.ts b/loopx/control_plane/work_items/task_lease_lifecycle.ts index 26e69600cc..e1b2123cfd 100644 --- a/loopx/control_plane/work_items/task_lease_lifecycle.ts +++ b/loopx/control_plane/work_items/task_lease_lifecycle.ts @@ -4,7 +4,6 @@ import {taskLeaseStableValue as stableValue, taskLeaseDigest as digest, taskLeaseOperationRequestDigest as operationRequestDigest} from "./task_lease_operation_identity.ts"; import { ShadowManagementError } from "../coordination/shadow_management.ts"; import { LegacyCoordinationWriteError, requireLegacyCoordinationPrimaryWriteAllowed } from "../coordination/legacy_writer_fence.ts"; -import { createHash } from "node:crypto"; import { readFile, readdir } from "node:fs/promises"; import { join } from "node:path"; @@ -34,10 +33,8 @@ import { import { requireJsonObject } from "../runtime_decode.ts"; import { leaseEpoch, - leaseInteger, leaseIsActive, leaseVersion, - normalizeAgent, normalizeGoalId, normalizeIdempotencyKey, normalizeOwner, @@ -47,7 +44,6 @@ import { taskLeaseDirectory, taskLeaseLockPath, taskLeasePath, - type AuthorityFacts, type LeaseRecord, } from "./task_lease_acquire.ts"; import { @@ -615,7 +611,7 @@ async function readOperationReceipt( ); } const expectedOperationId = operationIdentity(request); - const expectedRequestDigest = operationRequestDigest(request); + operationRequestDigest(request); if ( record.schema_version !== TASK_LEASE_LIFECYCLE_RECEIPT_SCHEMA || typeof record.operation_id !== "string" || diff --git a/loopx/zcode_goal_mode/cli.ts b/loopx/zcode_goal_mode/cli.ts index 0639771aa7..e61392c360 100644 --- a/loopx/zcode_goal_mode/cli.ts +++ b/loopx/zcode_goal_mode/cli.ts @@ -5,7 +5,7 @@ import {createServer, request as httpRequest} from "node:http"; import {mkdir, readFile, unlink} from "node:fs/promises"; import type {JsonObject} from "../control_plane/effect_program.ts"; import {BARE_SHA256_PATTERN} from "../control_plane/content_digest.ts"; -import {dirname, isAbsolute, join} from "node:path"; +import {isAbsolute, join} from "node:path"; import {fileURLToPath} from "node:url"; import {ZCODE_GOAL_ACTIONS, isGoalBasis, sameBinding, ZCodeGoalError, safeFailure, type NativeRequest, type ZCodeGoalReadback} from "./contract.ts"; import {NativeGoalController, readState, atomicState, type BindingState} from "./runtime.ts"; diff --git a/tests/canary/test_quality_surface_catalog.py b/tests/canary/test_quality_surface_catalog.py index 25e5c794e7..d64a695955 100644 --- a/tests/canary/test_quality_surface_catalog.py +++ b/tests/canary/test_quality_surface_catalog.py @@ -1,5 +1,6 @@ from __future__ import annotations +import shlex from copy import deepcopy from pathlib import Path from types import SimpleNamespace @@ -13,6 +14,21 @@ ) +def test_canary_python_script_checks_exist() -> None: + repo_root = Path(__file__).resolve().parents[2] + profiles = canary_planner.build_catalog_canary_profiles() + assert profiles["ok"] is True + checks = [check for profile in profiles["profiles"] for check in profile["candidate_checks"]] + checks.extend(check for profile in profiles["domain_profiles"] for check in profile["checks"]) + missing = [] + for check in checks: + args = shlex.split(check["command"]) + if len(args) > 1 and args[0] in {"python", "python3"} and args[1].endswith(".py"): + if not (repo_root / args[1]).is_file(): + missing.append(check["command"]) + assert not missing, f"Canary scripts missing: {missing}" + + def test_current_high_risk_surfaces_have_no_catalog_drift() -> None: audit = build_quality_surface_catalog_audit( CURRENT_REPO_PROFILES, diff --git a/tests/control_plane_ts/authority_store_conformance.ts b/tests/control_plane_ts/authority_store_conformance.ts index b5a4392686..b7c172bead 100644 --- a/tests/control_plane_ts/authority_store_conformance.ts +++ b/tests/control_plane_ts/authority_store_conformance.ts @@ -588,7 +588,6 @@ export function registerAuthorityStoreConformance( const goal = "goal-governance"; const fixture = productionScaleCoordinationFixture(goal, native ? "native" : "legacy"); const projection = structuredClone(fixture.projection); - const records = projection.todos as Record[]; const seeded = await store.commitAuthority({operation_id: "governance-fixture", expected_provider_revision: null, events: [], receipts: [], next_projection: projection}); assert.equal(seeded.status, "applied"); diff --git a/tests/control_plane_ts/checkpoint_commit_probe.ts b/tests/control_plane_ts/checkpoint_commit_probe.ts index 6c033f669f..679d52293b 100644 --- a/tests/control_plane_ts/checkpoint_commit_probe.ts +++ b/tests/control_plane_ts/checkpoint_commit_probe.ts @@ -1,6 +1,6 @@ /** Isolated process barriers around the production persistence methods. No * runtime test flag or alternate store implementation enters product code. */ -import {existsSync, readFileSync, writeFileSync} from "node:fs"; +import {existsSync, writeFileSync} from "node:fs"; import {join} from "node:path"; import {FileAuthorityStore} from "../../loopx/control_plane/coordination/file_authority_store.ts"; import {SqliteAuthorityStore} from "../../loopx/control_plane/coordination/sqlite_authority_store.ts"; diff --git a/tests/control_plane_ts/coordination_runtime_shadow.test.ts b/tests/control_plane_ts/coordination_runtime_shadow.test.ts index 2050a0a27e..91dcaa96d6 100644 --- a/tests/control_plane_ts/coordination_runtime_shadow.test.ts +++ b/tests/control_plane_ts/coordination_runtime_shadow.test.ts @@ -266,7 +266,7 @@ test("rollback can archive invalid cursor and pending entries without reading or }); test("archiving a Todo drops its retained lease from the candidate head", async (t) => { - const f = await fixture(t); + await fixture(t); const lease = { schema_version: "task_lease_v0", goal_id: "goal-a", todo_id: "todo_one", owner: "agent-a", idempotency_key: "k1", version: 1, lease_epoch: 1, status: "released", updated_at: "2026-09-06T00:00:00Z" }; const base = { ...projection([todo("todo_one")]), leases: [lease] }; diff --git a/tests/control_plane_ts/local_authority_provider.test.ts b/tests/control_plane_ts/local_authority_provider.test.ts index adf37fc982..3705b2fe87 100644 --- a/tests/control_plane_ts/local_authority_provider.test.ts +++ b/tests/control_plane_ts/local_authority_provider.test.ts @@ -23,7 +23,6 @@ import { legacyCoordinationWriterFencePath, } from "../../loopx/control_plane/coordination/legacy_writer_fence.ts"; import {acknowledgeLocalCoordinationTodoArchive, archiveLocalCoordinationTodos} from "../../loopx/control_plane/coordination/local_authority_runtime.ts"; -import {listLocalCoordinationTodos} from "../../loopx/control_plane/coordination/local_authority_read.ts"; for (const [fault, source, reason] of [ ["database_missing", "sqlite_v0", "local_authority_provider_missing"], diff --git a/tests/control_plane_ts/local_authority_runtime.test.ts b/tests/control_plane_ts/local_authority_runtime.test.ts index 4370c0ada3..a9110392e2 100644 --- a/tests/control_plane_ts/local_authority_runtime.test.ts +++ b/tests/control_plane_ts/local_authority_runtime.test.ts @@ -50,10 +50,8 @@ import {computeContinuationTodoFacts} from "../../loopx/control_plane/coordinati import { checkLegacyCoordinationWriteAllowed, engageLegacyCoordinationWriterFence, - legacyCoordinationWriterFencePath, loadLegacyCoordinationWriterFence, LEGACY_COORDINATION_WRITER_FENCE_ENGAGE_REQUEST_SCHEMA, - LEGACY_COORDINATION_WRITER_FENCE_SCHEMA, LEGACY_COORDINATION_WRITE_CHECK_REQUEST_SCHEMA, } from "../../loopx/control_plane/coordination/legacy_writer_fence.ts"; import { @@ -68,7 +66,6 @@ import { TASK_LEASE_LIFECYCLE_REQUEST_SCHEMA_VERSION, executeTaskLeaseLifecycle, } from "../../loopx/control_plane/work_items/task_lease_lifecycle.ts"; -import {atomicWriteJson} from "../../loopx/control_plane/effect_runtime_io.ts"; function sha256(value: unknown): string { return createHash("sha256").update(canonicalAuthorityBytes(value)).digest("hex"); diff --git a/tests/control_plane_ts/quota_monitor_poll_commit.test.ts b/tests/control_plane_ts/quota_monitor_poll_commit.test.ts index 60cbb2a530..cfa824f04c 100644 --- a/tests/control_plane_ts/quota_monitor_poll_commit.test.ts +++ b/tests/control_plane_ts/quota_monitor_poll_commit.test.ts @@ -1036,7 +1036,7 @@ test("durable replay rejects receipt path escape and lost pre-existing index his params.expected_index_digest = `sha256:${createHash("sha256") .update(await readFile(indexPath)) .digest("hex")}`; - const written = await evaluateQuotaMonitorPollCommit(params); + await evaluateQuotaMonitorPollCommit(params); await unlink(indexPath); await assert.rejects( () => evaluateQuotaMonitorPollCommit(params), diff --git a/tests/control_plane_ts/quota_settlement_readback.test.ts b/tests/control_plane_ts/quota_settlement_readback.test.ts index 9a50f9f0dc..d4a111e087 100644 --- a/tests/control_plane_ts/quota_settlement_readback.test.ts +++ b/tests/control_plane_ts/quota_settlement_readback.test.ts @@ -1554,7 +1554,7 @@ test("still reports a receipt bound to another work item as a mismatch", async ( assert.equal(failure.details, undefined); }); -test("rejects non-ENOENT settlement readback I/O failures", async (t) => { +test("rejects non-ENOENT settlement readback I/O failures", async () => { const runtimeRoot = await fixture(); const indexPath = join(runtimeRoot, "goals", goalId, "runs", "index.jsonl"); await rm(indexPath); @@ -1588,7 +1588,7 @@ test("recovers legacy quota commit rows by exact effect ref", async () => { assert.equal((result.spend as any).result.failure.kind, "receipt_missing"); }); -test("rejects a writeback run persisted under another goal", async (t) => { +test("rejects a writeback run persisted under another goal", async () => { const runtimeRoot = await fixture(); await appendFile( join(runtimeRoot, "goals", goalId, "runs", "index.jsonl"), diff --git a/tests/control_plane_ts/shadow_file_fixture.ts b/tests/control_plane_ts/shadow_file_fixture.ts index 14cf070733..e71370d68b 100644 --- a/tests/control_plane_ts/shadow_file_fixture.ts +++ b/tests/control_plane_ts/shadow_file_fixture.ts @@ -4,7 +4,7 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import type { TestContext } from "node:test"; import type { JsonObject } from "../../loopx/control_plane/effect_program.ts"; -import { canonicalAuthorityBytes, canonicalAuthoritySha256 } from "../../loopx/control_plane/coordination/authority_store_codec.ts"; +import { canonicalAuthoritySha256 } from "../../loopx/control_plane/coordination/authority_store_codec.ts"; import { TODO_CANONICAL_READ_RECORD_FIELDS } from "../../loopx/control_plane/coordination/coordination_projection.ts"; import * as schemas from "../../loopx/control_plane/coordination/coordination_state_contract.generated.ts"; import { FileAuthorityStore } from "../../loopx/control_plane/coordination/file_authority_store.ts"; diff --git a/tests/control_plane_ts/sqlite_authority_v1_fixture.ts b/tests/control_plane_ts/sqlite_authority_v1_fixture.ts index af46858282..25b96862d7 100644 --- a/tests/control_plane_ts/sqlite_authority_v1_fixture.ts +++ b/tests/control_plane_ts/sqlite_authority_v1_fixture.ts @@ -138,7 +138,7 @@ export function createSqliteAuthorityStoreV1( } /** Bytes of one V1 database, used to prove a migration left it untouched. */ -export function sqliteAuthorityV1Digest(path: string, goalId: string): string { +export function sqliteAuthorityV1Digest(path: string, _goalId: string): string { const {driver: sqlite} = sqliteAuthorityRuntime(); const db = new sqlite.DatabaseSync(path, {readOnly: true}); try {