Skip to content

fix(appkit): make typegen --no-cache actually bypass the cache [F5]#425

Draft
atilafassina wants to merge 1 commit into
mainfrom
typegen-fix/no-cache
Draft

fix(appkit): make typegen --no-cache actually bypass the cache [F5]#425
atilafassina wants to merge 1 commit into
mainfrom
typegen-fix/no-cache

Conversation

@atilafassina

Copy link
Copy Markdown
Contributor

PR3 of the typegen review-fix stack. Independent of PR1/PR2 (branches off main).
Scope: make the documented generate-types --no-cache flag actually work (F5).

The bug

--no-cache was a silent no-op. The value was read from options.noCache, but
commander stores the --no-cache boolean negation under options.cache (true
by default, false when the flag is passed). So noCache was always false.

Changes (generate-types.ts)

  • Read the flag as options.cache === false and thread noCache into both
    generateFromEntryPoint and generateServingTypes.
  • Forward --no-cache to the detached background worker when set, so the refresh
    bypasses the cache too — while still carrying ...process.execArgv and
    --wait (dropping either silently breaks a tsx-run worker).
  • Interface field renamed noCache?cache? to match what commander populates.

Acceptance criteria (asserted)

  • --no-cache propagates noCache: true into generateFromEntryPoint and
    generateServingTypes.
  • The spawned worker's argv includes --no-cache when set, omits it otherwise,
    and always retains ...process.execArgv + --wait.

Checks

pnpm test (shared CLI), pnpm -r typecheck, pnpm check,
pnpm --filter shared build:package all green. Tests reset commander's
singleton option state per test to avoid cross-test flag leakage.

Note

Touches generate-types.ts, which PR4 (lock-token) also edits. Branched
independently off main, so the two will textually conflict at merge — expected
and resolved at merge time.

This pull request and its description were written by Isaac.

The documented `generate-types --no-cache` flag was a silent no-op: the
value was read from `options.noCache`, but commander stores the `--no-cache`
boolean negation under `options.cache` (true by default, false when passed).

- Read the flag as `options.cache === false` and thread the resulting
  noCache into both generateFromEntryPoint and generateServingTypes.
- Forward `--no-cache` to the detached background worker when set, so the
  refresh bypasses the cache too — while still carrying `...process.execArgv`
  and `--wait` (dropping either silently breaks the tsx-run worker).

Tests: foreground bypass (noCache:true into both generators), default keeps
caching (noCache:false), worker argv includes/omits --no-cache and retains
execArgv + --wait. Resets commander's singleton option state per test to
avoid cross-test flag leakage.

Co-authored-by: Isaac
Signed-off-by: Atila Fassina <atila@fassina.eu>
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