Skip to content

fix(ci): dependency checks fail on diagnostic test reset exports - #176285

Merged
obviyus merged 1 commit into
mainfrom
fix/diagnostic-reset-knip
Oct 18, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/diagnostic-reset-knip

Conversation

@obviyus

@obviyus obviyus commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

Requested by Ayaan

What Problem This Solves

Fixes: check-dependencies fails on main because Knip reports 7 unused reset*ForTest exports in src/logging/diagnostic-*.ts. #175223 moved the aggregate reset into diagnostic.test-support.ts, which Knip's production scan ignores, so the per-module resets lost their only production consumer.

User Impact

No user-visible change. The dependency and export deadcode scans pass again.

Why This Change Was Made

These resets are test-support hooks by design. Each export now carries /** @internal */, the pattern main already uses for test helpers (for example src/infra/container-environment.ts). The production scan skips them, and the full-tree scan still checks them against their test-support caller. No logic changes.

Evidence

  • Before: hourly CI runs 39136213920 and 39140721112 fail deadcode:dependencies and deadcode:exports with these 7 entries. They first appear in run 39010956087, the first run after refactor(logging): move diagnostic aggregate test resets into fixtures #175223.
  • After: pnpm run deadcode:dependencies and pnpm run deadcode:exports pass with 0 entries.
  • pnpm exec vitest run src/logging/diagnostic.test.ts src/logging/diagnostic-memory.test.ts src/logging/diagnostic-stability.test.ts src/logging/diagnostic.incognito.test.ts: 94 passed. oxfmt and oxlint are clean.

#175223 moved the aggregate diagnostic reset into
diagnostic.test-support.ts, which removed the only production consumer
of seven per-module reset hooks. Knip production mode then reported
them as unused exports. Tag them @internal, as container-environment.ts
does, so the production scan skips them while the full-tree scan still
audits their test-support consumer.
@obviyus obviyus self-assigned this Oct 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR marks seven diagnostic test-reset exports as internal so Knip excludes them from production-only scans.

Example: Knip scans resetDiagnosticMemoryForTest after its caller moves into diagnostic.test-support.ts.

  • Before: The production scan reports the export as unused because test-support files are excluded.
  • After: The production scan skips this test hook, while the full-tree scan still checks its consumers.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-verified repair with successful exact-head CI and no correctness, security, or scope findings.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored annotation-only repair is outside the ordinary contributor proof gate; the body reports successful dead-code commands and 94 diagnostic tests, with exact-head CI independently verified.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Repository dependency and export checks reject valid diagnostic test hooks after their caller moves into fixtures.
Reason: The maintainer-authored direction repairs a concrete tooling failure with precise annotations and preserves the original fixture ownership.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR narrowly corrects diagnostic export classification, preserves full-tree auditing, and introduces no actionable defect.

Priority: P3
Reviewed head: 6f069b133986fcdb395b392f191e99acbb6e2896

Before merge

None.

Findings

None.

Agent review details

How this fits together

Diagnostic modules own in-memory observations and lifecycle state; test fixtures call their reset hooks, and Knip audits production and test-aware import graphs separately.

flowchart TD
  A[Diagnostic modules] --> B[Seven reset exports]
  C[Test fixtures] --> B
  A --> D[Production Knip scan]
  C --> E[Full-tree Knip scan]
  B --> E
  D --> F[Dead-code checks]
  E --> F
Loading

Technical review

Best possible solution:

Keep the symbol-level annotations so production scans exclude only the seven test hooks while full-tree scans retain their coverage.

Do we have a high-confidence way to reproduce the issue?

Source inspection establishes the failure path: the merged refactor moved all seven callers into production-excluded test support, leaving their exports reportable by production Knip; no local reproduction was run.

Is this the best way to solve the issue?

The annotations match Knip 6.40.0's intended test-hook contract and are more precise than file-wide exceptions, without restoring test sequencing to production.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 621f574e6639.

Provenance checked

Testing

Proof path: none.

Security

None.

Evidence

What I checked:

PR surface

Source +7. Total +7 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 7 7 0 +7
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 7 0 +7

Labels

Label changes:

  • add P3: This is a narrowly scoped static-analysis repair with no runtime behavior or user-data change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a narrowly scoped static-analysis repair with no runtime behavior or user-data change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 18, 2026, 12:47 PM ET / 16:47 UTC.

@obviyus
obviyus merged commit fab581e into main Oct 18, 2026
139 checks passed
@obviyus
obviyus deleted the fix/diagnostic-reset-knip branch October 18, 2026 16:49
@obviyus

obviyus commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as fab581e. Bug: after #175223 moved the aggregate diagnostic reset into test-support, Knip's production scan reported 7 per-module reset*ForTest exports as unused, so check-dependencies failed on main. Fix: mark them @internal, the existing pattern for test helpers. Proof: both deadcode scans pass with 0 entries, the logging tests pass (94), and PR CI was green.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 19, 2026
…nclaw#176285)

## What Problem This Solves

Fixes: `check-dependencies` fails on main because Knip reports 7 unused `reset*ForTest` exports in `src/logging/diagnostic-*.ts`. openclaw#175223 moved the aggregate reset into `diagnostic.test-support.ts`, which Knip's production scan ignores, so the per-module resets lost their only production consumer.

## User Impact

No user-visible change. The dependency and export deadcode scans pass again.

## Why This Change Was Made

These resets are test-support hooks by design. Each export now carries `/** @internal */`, the pattern main already uses for test helpers (for example `src/infra/container-environment.ts`). The production scan skips them, and the full-tree scan still checks them against their test-support caller. No logic changes.

## Evidence

- Before: hourly CI runs 39136213920 and 39140721112 fail `deadcode:dependencies` and `deadcode:exports` with these 7 entries. They first appear in run 39010956087, the first run after openclaw#175223.
- After: `pnpm run deadcode:dependencies` and `pnpm run deadcode:exports` pass with 0 entries.
- `pnpm exec vitest run src/logging/diagnostic.test.ts src/logging/diagnostic-memory.test.ts src/logging/diagnostic-stability.test.ts src/logging/diagnostic.incognito.test.ts`: 94 passed. `oxfmt` and `oxlint` are clean.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant