Skip to content

test(codascon): close all open test gaps (§17 multi-hook, §18 strategy lifetime, §_CSS3 callable proof)#64

Open
scorpevans wants to merge 4 commits intomainfrom
test/20260304-1910-codascon-multi-hook-runtime
Open

test(codascon): close all open test gaps (§17 multi-hook, §18 strategy lifetime, §_CSS3 callable proof)#64
scorpevans wants to merge 4 commits intomainfrom
test/20260304-1910-codascon-multi-hook-runtime

Conversation

@scorpevans
Copy link
Owner

@scorpevans scorpevans commented Mar 4, 2026

Addresses all open gaps in the codascon test suite identified in the test analysis.

Summary

  • §17 — Multi-hook H tuple at runtime: adds two it blocks for RichFeedCommand extends Command<..., [LogCommand, GroomCommand]>. Both hooks are invoked inside execute; the result depends on both hook return values, so the assertion only passes when both hooks fire. A second it verifies hooks are re-invoked (not cached) on each run() call.

  • §18 — Strategy statefulness (cached vs fresh): adds two it blocks contrasting CachingCommand (holds a CountingStrategy instance as a field — state accumulates across run() calls) vs FreshCommand (creates a new CountingStrategy on every resolveDog call — state resets). Confirms the framework is neutral about strategy lifetime.

  • _CSS3CommandSubjectStrategies callable proof: adds a callable proof to constraints.test.ts. cmd.run(dog, { time: "x" }) compiling proves that a correctly implemented FeedCommand satisfies its own this & CommandSubjectStrategies<...> constraint. If any visit method were missing or had the wrong signature, tsc would reject the call site.

    Limitation (documented in typescript-gotchas.md): CommandSubjectStrategies is an internal (non-exported) type used as the this constraint on run(). It cannot be exported with @internalstripInternal: true would strip the declaration while leaving the reference in run()'s signature, producing a dangling name in the published .d.ts. Shape assertions (_CSS1/_CSS2) were attempted and reverted for this reason. _CSS3 + the @ts-expect-error blocks in §14 together close the gap.

Test plan

  • pnpm --filter codascon test — 46 tests pass (36 runtime + 10 compile-time)
  • pnpm --filter codascon build — tsc succeeds; CommandSubjectStrategies stays as private declaration in .d.ts, no dangling reference

🤖 Generated with Claude Code

…(§17)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@scorpevans
Copy link
Owner Author

Reviewed. §17 adds two it blocks. First: food === 'morning' requires groomResult.groomed (GroomCommand invoked) AND logEntry.action (LogCommand invoked) — neither hook can be dropped without breaking the assertion. Second: running with different time values shows hooks are called fresh on each run(), not memoised. CommandHooks<[LogCommand, GroomCommand]> structural requirement (log + groom properties) is enforced at compile time by tsc. No existing tests touched. 44/44 pass.

Evans Akai Bekoe and others added 2 commits March 4, 2026 19:21
…e (§18)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…CSS3)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@scorpevans scorpevans changed the title test(codascon): exercise H=[HookA,HookB] multi-hook tuple at runtime (§17) test(codascon): close all open test gaps (§17 multi-hook, §18 strategy lifetime, _CSS type assertions) Mar 4, 2026
@scorpevans
Copy link
Owner Author

Reviewed. Verified: §17 both-hooks invoked and result depends on both (groomResult.groomed selects branch, logEntry.action provides value); §18 cached vs fresh strategy instances behave as expected; _CSS1/_CSS2 correctly use the base class form to work around the circular-inference limitation (documented); _CSS3 callable proof compiles; all 46 tests pass and build clean.

…ngling reference

@internal + stripInternal strips the type declaration but leaves the reference in
run()'s this constraint, breaking consumer type-checks. Reverted to non-exported.
_CSS1/_CSS2 removed; _CSS3 (callable proof) + §14 (@ts-expect-error) cover the gap.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@scorpevans scorpevans changed the title test(codascon): close all open test gaps (§17 multi-hook, §18 strategy lifetime, _CSS type assertions) test(codascon): close all open test gaps (§17 multi-hook, §18 strategy lifetime, §_CSS3 callable proof) Mar 4, 2026
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