Skip to content

perf(config): retain one snapshot for unchanged validation results - #206465

Merged
vincentkoc merged 1 commit into
mainfrom
perf/share-validation-cache-input
Nov 27, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
perf/share-validation-cache-input

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

On a cache miss, plugin and channel settings validation retained two private copies of the same configuration whenever validation returned its input unchanged. These copies could stay live across config revisions, for up to 512 entries per registry.

User Impact

Configurations with many plugin or channel settings can use less memory between validations. Operators can keep their existing configuration.

Why This Change Was Made

The cache already owns a snapshot taken before validation. A successful result that returns that exact input can reuse the snapshot. A cache hit still gives its caller a fresh copy. Defaulted values and validation errors keep their independent snapshots.

Evidence

  • A native Node.js 26.7 ARM64 comparison used the original and changed cache owners with the same validator and TypeBox 1.4.3. With 64 and 128 synthetic nested plugin and channel settings, reachable objects under cached inputs and result values fell from 1,024 to 512 and from 2,048 to 1,024. In two measurements per revision, average retained heap per populated cache fell from 203–206 kB to 131–132 kB at 64 entries and from 407 kB to 261 kB at 128.
  • The bundled OpenAI plugin's empty settings exercised a schema with defaults. Both versions retained two objects under input and result, with the same 455-byte V8 serialization of the complete cache entry array.
  • Original and changed implementations preserved the miss result identity, isolated edits to input and returned hits, retained hydrated defaults, and isolated returned error details. The committed regression checks that an unchanged success stores a single private input graph. Device performance was not measured.
  • All 18 tests passed across the prepared validation cache, public asynchronous config validation, and plugin-config catalog tests. Running the new regression against the original cache owner reproduced the two retained objects. Both changed files passed pinned formatting and type-aware lint. Local ClawSweeper reviewed the signed range with no findings.

@vincentkoc vincentkoc self-assigned this Nov 27, 2026
@clawsweeper

clawsweeper Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added the P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. label Nov 27, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review November 27, 2026 07:09
@vincentkoc
vincentkoc merged commit 0095665 into main Nov 27, 2026
195 checks passed
@vincentkoc
vincentkoc deleted the perf/share-validation-cache-input branch November 27, 2026 07:23
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Nov 27, 2026
…restoration-ci-189390-20261127

* commit '6feeb50a3f14fbf0aa5167d342f186dc4d67fc18': (9846 commits)
  fix: stop 2026-11-17 main Git checkouts from half-switching on a schema update (#206341)
  refactor(codex): centralize native completion delivery (#206447)
  fix(subagents): finish claimed stops after session rotation (#206405)
  fix: let owners fork a chat with exec after a subagent or exec completion (#206483)
  test(cli): gate agent --local cold-start processes and workers (#206466)
  perf(ci): skip baseline inventory when line-cap debt is empty (#189909)
  refactor(test): share core process-result fixtures (#174149)
  refactor(ci): reuse canonical budget flag parsing (#189480)
  fix: recover Codex chats after oversized requests (#206475)
  fix(agents): skip the bootstrap ritual in one-shot runs (#206477)
  fix(test): preserve stack coordinates in redacted failure reports (#152384)
  fix(gateway): return consistent unavailable response guidance (#191933)
  fix: preserve emphasis in Markdown table row labels (#205349)
  fix(nextcloud-talk): keep webhook spool helpers private (#206470)
  perf(plugins): overlay native receipts once per visible root (#206464)
  fix: keep GitHub comment approvals alive and skip repeat approval on the session PR (#206129)
  perf(config): retain one snapshot for unchanged validation results (#206465)
  refactor(test): reuse canonical secret fixture cleanup (#189492)
  refactor(subagents): own descendant Stop cancellation (#206444)
  refactor(subagents): keep announce cleanup action type private (#206407)
  ...
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. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant