Skip to content

perf(boot): defer schema and isogit construction until first use - #1537

Merged
TheGreatAxios merged 7 commits into
mainfrom
cl-10809-defer-module-scope-arktype-schema-and-isogit-store
Oct 20, 2026
Merged

TheGreatAxios merged 7 commits into
mainfrom
cl-10809-defer-module-scope-arktype-schema-and-isogit-store

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • Config, profile, task, and run-state arktype schemas are built on first read instead of at import, so a malformed file still fails at the read that used to fail and not merely because the module loaded.
  • The session store dynamically imports the node isogit entry when a session is opened. vendor/ is unchanged.
  • boot and first-paint spans start at boot and end when the TUI host mounts, so that interval can be told apart from import-time work.

Test plan

  • bun test src/config/settings-lazy.test.ts src/session/isogit-boot.test.ts src/perf/boot-spans.test.ts src/config/settings.test.ts src/agent/tasks.test.ts src/plugins/data-only-agent.test.ts (80 pass)
  • tsc --noEmit via the pre-commit hook

@linear-code

linear-code Bot commented Oct 20, 2026

Copy link
Copy Markdown

CL-10809

@corbits-triage

corbits-triage Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Triage: Fail

@TheGreatAxios, please address the following:

  • required checks are failing: static-analysis

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review · Request changes

Schemas and the isogit store wait until first use. A bad settings file still fails at the read. vendor/ is untouched. exec and onboarding never close the boot spans, and a few comments restate the ticket.

Findings

  • src/index.ts:40 — boot and first-paint start here and only end in mountRunnerHost. exec and onboarding never mount that host, then flushPerfToOtel exports the open spans with no end time. Close them before that flush on every path that does not mount the TUI.

  • src/session/isogit-node.ts:10 — isogitNodeLoadStarted has no callers. Delete it.

  • src/schema/lazy.ts:1, src/perf/boot-spans.ts:3, src/session/isogit-node.ts:1 — these comments restate the ticket. The note that lazyCallable must not be passed into type() should stay.

  • src/config/settings-lazy.test.ts:16 — the test pins /Invalid settings schema/. Assert that a bad settings file fails at read, not the sentence.

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review · Comment

The prior findings are gone. exec closes the boot spans before the perf flush, the dead export and ticket comments are gone, and the settings test no longer pins the error sentence. The deferral still holds.

Findings

No code findings on 2420b766. CI is red: oxfmt wants src/config/settings.ts formatted, and src/session/isogit-boot.test.ts leaves a throw installed (session open reached isogit) that fails later tests in the same process. Restore the real module with withMockedModule.

@TheGreatAxios
TheGreatAxios force-pushed the cl-10809-defer-module-scope-arktype-schema-and-isogit-store branch from ac2700f to 5415ac5 Compare October 20, 2026 02:47
@TheGreatAxios TheGreatAxios changed the title Defer module-scope schemas and the isogit store until they are used perf(boot): defer schema and isogit construction until first use Oct 20, 2026
@TheGreatAxios
TheGreatAxios force-pushed the cl-10809-defer-module-scope-arktype-schema-and-isogit-store branch from 5415ac5 to 29d99f8 Compare October 20, 2026 02:48

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review · Approve

Schemas and the isogit store wait until first use. exec closes the boot spans before the perf flush. The dead export, ticket comments, and pinned error sentence are gone. oxlint, oxfmt, dead exports, and the test shards passed on 37078219.

Findings

No findings.

@TheGreatAxios
TheGreatAxios merged commit 2b42830 into main Oct 20, 2026
14 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-10809-defer-module-scope-arktype-schema-and-isogit-store branch October 20, 2026 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant