Skip to content

fix: preserve generated types without Matrix context - #6

Merged
oevery merged 2 commits into
mainfrom
fix/matrix-typegen-context-guard
Oct 13, 2026
Merged

oevery merged 2 commits into
mainfrom
fix/matrix-typegen-context-guard

Conversation

@oevery

@oevery oevery commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Skip automatic declaration writes without Matrix-injected environment metadata, preserving existing files and warning once per plugin instance. Capture context before Vite replaces the environment; the production guard adds 10 lines.
  • Preserve explicit types: true / object overrides, types: false, Vitest defaults, valid empty schemas, and prepare collection.
  • Cover real Vite/Rollup/CLI behavior, replace redundant option combinations with named cases, and remove unnecessary Vite fixture cwd changes that caused Windows cleanup failures.
  • Shorten English and Chinese docs while keeping defaults, overrides, and the runtime caveat explicit.

Validation

Final head: e7405881846a3484e573c4c493a17606b26e7d0e.

  • CI passed on Node 22.18.0 and 24.x: Linux/macOS each ran 647 tests; Windows each passed 640 with seven intentional POSIX-only skips. Package compatibility (Linux 24 full, Linux 22 daily, macOS/Windows platform), lint, types, build, and example checks passed; Windows package smoke intentionally skips POSIX shutdown.
  • Real Electron/Web acceptance passed on all three CI platforms. Documentation checks also passed.
  • Cloud Linux validation additionally passed the full 102-consumer compatibility profile plus CLI smoke on both Node versions, pnpm check, and docs typecheck/build.
  • All six core regressions fail against the unchanged base. Independent focused tests pass with deliberately polluted ambient environment variables.
  • The earlier Windows EBUSY fixture failures are resolved on both Node versions in the final run. Local Electron launch was blocked by cloud display/socket restrictions; actual launch coverage comes from the passing CI jobs above.

Base: a5026ea52cc55f3311f48ba722c35da54bf014ee.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The safeguard is narrowly scoped, preserves documented overrides, and has comprehensive regression coverage with passing CI.

0 open findings

What changed in this PR

Prevents incomplete builds from overwriting generated declarations when Matrix context is unavailable.

Changes:

  • Guards automatic type generation and warns once per plugin instance.
  • Preserves explicit overrides, Vitest behavior, and valid empty schemas.
  • Adds host/CLI regressions and synchronizes English and Chinese documentation.
File Description
src/​unplugin/​index.ts Adds the missing-context safeguard.
src/​unplugin/​options.ts Clarifies types behavior.
test/​unplugin/​index.test.ts Covers Vite, Rollup, CLI, and override behavior.
test/​README.md Documents safeguard coverage.
docs/​site/​en/​reference/​plugins.md Documents new defaults and overrides.
docs/​site/​en/​guides/​integrations.md Links build-time behavior to plugin options.
docs/​site/​zh-CN/​reference/​plugins.md Synchronizes Chinese reference documentation.
docs/​site/​zh-CN/​guides/​integrations.md Synchronizes Chinese integration guidance.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@oevery
oevery marked this pull request as ready for review October 13, 2026 04:09
@oevery
oevery merged commit 073395f into main Oct 13, 2026
13 checks passed
@oevery
oevery deleted the fix/matrix-typegen-context-guard branch October 13, 2026 04:11
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.

2 participants