Skip to content

fix(workflow-engine): tsc lint errors — unused vars + type-narrowing (autonomous-loop unblocks #5774-#5778)#5779

Merged
AceHack merged 1 commit into
mainfrom
otto-cli/tsc-fixes-workflow-engine-unused-vars-and-type-narrowing-2026-05-28
May 28, 2026
Merged

fix(workflow-engine): tsc lint errors — unused vars + type-narrowing (autonomous-loop unblocks #5774-#5778)#5779
AceHack merged 1 commit into
mainfrom
otto-cli/tsc-fixes-workflow-engine-unused-vars-and-type-narrowing-2026-05-28

Conversation

@AceHack
Copy link
Copy Markdown
Member

@AceHack AceHack commented May 28, 2026

Autonomous-loop tick caught BLOCKED gate on in-flight PRs (#5774-#5778). 6 tsc errors across 4 files in workflow-engine/. Fixed; tsc clean; 45 tests pass.

Fixes

  • composed-lifetime.test.ts (TS6133 ×2): added expect() on type-check bindings
  • consensus.test.ts (TS18046 ×2): explicit type-param + typed callback
  • consensus.ts (TS6133 ×1): AgreementMetrics _typeHint type-anchor field
  • closed-loop.test.ts (TS2339/TS2345 ×5): direct LoopFeedback import (Awaited<ReturnType<>> evaluated to never)

Verification

bunx tsc --noEmit -p tsconfig.json  # clean
bun test (3 affected files)         # 45 pass / 0 fail

B-0913 dup-ID lint failure is SEPARATE (pre-existing on origin/main).

🤖 Generated with Claude Code

…in test files (autonomous-loop tick caught BLOCKED gate on PRs #5774-#5778); tsc clean + 45 tests pass

Per autonomous-loop tick during Aaron-away window: in-flight PRs
#5774-#5778 all BLOCKED on `lint (tsc tools)` gate failure. CI log showed
6 errors across 4 files in workflow-engine/. Root cause: 5 of them are
TS6133 (unused vars/params from strict tsconfig); 1 is type-narrowing
issue where Awaited<ReturnType<typeof runCycle<T>>> evaluated to never.

Fixes:

1. composed-lifetime.test.ts (TS6133 ×2):
   _check1/_check2 type-level compile checks — added expect() assertions
   to satisfy noUnusedLocals while preserving the compile-time check.

2. consensus.test.ts (TS18046 ×2):
   verdictKey callback had unknown-typed arg from generic inference.
   Added explicit <Hypothesis> type-param to runConsensus + typed the
   callback arg.

3. consensus.ts (TS6133 ×1):
   AgreementMetrics<T> had unused type parameter. Added _typeHint?: T
   field (never set at runtime; type-anchor only) + reserved-for-future
   docstring + eslint-disable to preserve API shape.

4. closed-loop.test.ts (TS2339/TS2345 ×5):
   `Awaited<ReturnType<typeof runCycle<SubstrateT>>>` evaluated to never
   so feedback-extraction chain produced never. Replaced with direct
   import of `LoopFeedback` from closed-loop.ts.

Composes with substrate:
- PR #5774 / #5775 / #5776 / #5777 / #5778 — all unblocked once this merges
- B-0913 dup-ID lint failure is SEPARATE (pre-existing on origin/main)
- .claude/rules/blocked-green-ci-investigate-threads.md — investigated +
  fixed during autonomous-loop tick
- .claude/rules/refresh-world-model-poll-pr-gate.md — Normal tier (4928 GraphQL)

Verification:
- bunx tsc --noEmit -p tsconfig.json — clean
- bun test on all 3 affected test files — 45 pass / 0 fail

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 28, 2026 11:48
@AceHack AceHack enabled auto-merge (squash) May 28, 2026 11:48
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

AceHack pushed a commit that referenced this pull request May 28, 2026
Drop unused composeKey import surfaced by tsc gate on PR #5774. composeKey
is still exported from world.ts; this test file just doesn't reference it
directly (uses dispatchInWorld + matrix helpers instead).

Composes with PR #5779 tsc-fixes (sibling fixes for composed-lifetime +
consensus + closed-loop test files; those land via main rebase, this one
lives on #5774's branch since world.test.ts is in this PR).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@AceHack AceHack merged commit 8ee9256 into main May 28, 2026
31 of 33 checks passed
@AceHack AceHack deleted the otto-cli/tsc-fixes-workflow-engine-unused-vars-and-type-narrowing-2026-05-28 branch May 28, 2026 11:51
@AceHack AceHack review requested due to automatic review settings May 28, 2026 12:09
AceHack added a commit that referenced this pull request May 28, 2026
…(Aaron 2026-05-28 naming substrate + 'do you have to write custom code everytime' answer); 14 tests pass (#5774)

* feat(world): world substrate + reusable lifetime-composition helpers (Aaron 2026-05-28 naming substrate + reusability substrate-engineering questions); 14 tests pass

Per Aaron 2026-05-28 two substantive substrate-engineering substrate
questions:
1. 'do you have to write custom code everytime you compose two lifetimes'
   → NO; dispatch substrate is reusable; only matrix per-pair; recurring
   patterns factored via defaultAdvanceMatrix + terminalMatrix +
   predicateMatrix helpers
2. '(do we still call the shared git flow a lifetime or world or shared
   space?)' → WORLD (shared substrate where multiple lifetimes interact;
   different scope from per-substrate-entity lifetime; world contains
   lifetimes)

Naming canon established:
- LIFETIME = editable per-substrate-entity DU (Aaron's prior framing)
- WORLD = shared substrate where multiple lifetimes interact
- GIT FLOW = operational form of the world

What this adds:
- World interface (registry of lifetime-pair matrices keyed by pair name)
- EMPTY_WORLD constant
- StandardVerdict discriminated union (advance | block | complete | no-op
  | escalate-to-operator) — factors out recurring vocabulary so per-pair
  matrices reuse it instead of inventing parallel verdict types
- registerLifetimePair (immutable world update; returns new world)
- lookupLifetimePair (registry lookup)
- defaultAdvanceMatrix (every-cell defaults to advance; caller overrides
  specific cells)
- terminalMatrix (single-cell complete; other cells from terminal A block)
- predicateMatrix (most general; caller predicate per cell)
- dispatchInWorld (world-level lookup + dispatch; UnregisteredPair feedback)

Re-exports from composed-lifetime.ts (PR #5771) so callers compose with
world.ts for both naming + helpers.

Tests (14; all pass):
- EMPTY_WORLD zero pairs
- registerLifetimePair immutable + adds pair
- lookupLifetimePair found/undefined cases
- defaultAdvanceMatrix every-cell-advance + overrides applied
- terminalMatrix terminal+block cells
- predicateMatrix caller-supplied dispatch
- dispatchInWorld lookup + dispatch + UnregisteredPair feedback
- StandardVerdict exhaustive switch (5 variants)
- Reusability test: full 9-transition world built with helpers
  (no per-cell custom code)
- Multiple lifetime pairs registered in single world (workflow-review +
  workflow-encryption)

Composes with substrate:
- composed-lifetime.ts PR #5771 (base dispatch substrate)
- B-0832 civ-sim substrate (game-world; Pauli-exclusion-for-agenda)
- B-0867 workflow engine (workflow world)
- 13th-ferry §33.7 multi-AI cascade (each AI inhabits the world)
- additive-not-zero-sum + honor-those-that-came-before + monad-propagation
  + asymmetric-authorship rules

Substrate-engineering answer to Q1 directly demonstrated:
- 'workflow-review world built with helpers (no per-cell custom code)'
  test exercises predicateMatrix to build full 9-transition matrix in
  ~5 lines of predicate code; no per-cell hand-rolled matrix entries

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(world.test): remove unused composeKey import (tsc lint TS6133)

Drop unused composeKey import surfaced by tsc gate on PR #5774. composeKey
is still exported from world.ts; this test file just doesn't reference it
directly (uses dispatchInWorld + matrix helpers instead).

Composes with PR #5779 tsc-fixes (sibling fixes for composed-lifetime +
consensus + closed-loop test files; those land via main rebase, this one
lives on #5774's branch since world.test.ts is in this PR).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(PR #5774): role-refs + B-0422 xref + generic registerLifetimePair + WorldTransitionFeedback union + registry type-safety docblock (Copilot threads)

Seven threads on tools/workflow-engine/world.ts addressed:

1+4. Persona/first-name attributions in code-surface header (6 sites):
   "Per Aaron 2026-05-28" → "Per the human maintainer (2026-05-28)";
   "Aaron-acknowledged" / "Naming canon (Aaron 2026-05-28)" /
   "per Aaron's earlier" all updated to role-ref form. Citation
   provenance preserved as parenthetical date.

2+5. Wrong B-row xref: B-0832 (installer nmtui WiFi rescan) → B-0422
   (Clifford-algebraic narrative engine for Pauli-symmetry-breaking-
   from-agenda-conservation) — matches docblock's
   "Pauli-exclusion-for-agenda" framing. (Same fix as PR #5775.)

3+6. World.registry type-safety scope-disclosure: added explicit
   docblock to `World` interface naming the `unknown`-erasure limitation
   on lookupLifetimePair/dispatchInWorld, the consequence (caller can
   register one verdict type + lookup with a different T without compile
   error), AND the substrate-engineering target (typed `PairToken<A,B,T>`
   + definePair/registerPair/lookupPair surface; existing string-keyed
   surface stays as escape-hatch). PoC-scope deferral documented honestly
   so future-substrate-engineering reading the code sees the gap + the
   path forward without re-deriving it.

   Additionally: generalized `registerLifetimePair` signature to
   `<W extends World>` so callers passing specialized subclasses
   (GitWorld / GitHubWorld / etc., introduced in downstream PRs)
   receive the SAME specialized type back with subclass fields
   preserved via spread. Returning bare `World` here previously
   dropped subclass fields silently under structural typing. Added
   regression test using inline SpecializedWorld extension.

7. Exported `WorldTransitionFeedback` + `WorldTransitionResult<T>`
   union types: `dispatchInWorld` previously returned an inline-extended
   `TransitionResult<T> | { ok: false; feedback: {...UnregisteredPair...} }`
   shape — callers had to do ad-hoc narrowing; downstream exhaustive
   switches couldn't name the complete world-dispatch feedback type.
   Now: `WorldTransitionFeedback = TransitionFeedback | { kind:
   "UnregisteredPair"; pairName: string }` (composes base
   composed-lifetime feedback variants + the world-scope addition);
   `WorldTransitionResult<T>` is the result-shape; dispatchInWorld
   returns the named type. Added regression test exercising exhaustive
   switch over all four WorldTransitionFeedback variants. Re-exported
   `TransitionFeedback` from world.ts so downstream callers compose
   with the full feedback substrate from one module.

Tests: 16 pass (14 existing + 2 new: subclass-preservation regression
+ WorldTransitionResult exhaustive-switch regression).

Autonomous-loop tick 2026-05-28T12:53Z resolution of PR #5774 BLOCKED
gate (7 unresolved Copilot threads; required checks all green).

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Lior <lior@zeta.dev>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant