Skip to content

refactor: Inline single-use helpers in actor_run_response#898

Merged
jirispilka merged 6 commits into
masterfrom
claude/relaxed-goldberg-OdGgV
May 26, 2026
Merged

refactor: Inline single-use helpers in actor_run_response#898
jirispilka merged 6 commits into
masterfrom
claude/relaxed-goldberg-OdGgV

Conversation

@jirispilka
Copy link
Copy Markdown
Collaborator

@jirispilka jirispilka commented May 21, 2026

Closes #861 — review follow-ups from #823 / #853.

Changes

  • Inline slashToDot — single call site in buildRunDataset
  • Inline sleep — single call site in resolveItemCountWithLagFallback
  • Unify nullish cleaners — drop local omitNullish, reuse cleanEmptyProperties. removeEmptyArrays renamed to cleanEmptyArrays for consistent naming; kept as a separate helper because it deliberately preserves null / '' so schema inference still sees those fields. Cross-link comment added to both functions.
  • Collapse 6-level spread chain in buildEnrichedDirectActorOutputSchema — replaced with structuredClone + leaf assignment.

Behavior

Functionally equivalent. cleanEmptyProperties is stricter than omitNullish in two edge cases (empty fields: [], empty-string name / title) — output schema permits both forms; consumers handle them identically.

Verification

  • pnpm run type-check — clean
  • pnpm run lint — clean (only pre-existing warnings)
  • pnpm run test:unit — 748 tests pass

@github-actions github-actions Bot added t-ai Issues owned by the AI team. tested Temporary label used only programatically for some analytics. labels May 21, 2026
@jirispilka jirispilka requested a review from Copilot May 26, 2026 08:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR applies follow-up refactors to reduce single-use helpers and unify “empty/nullish” cleaning behavior across the Actor run response and schema generation utilities, while simplifying schema enrichment logic for direct Actor tools.

Changes:

  • Renames removeEmptyArrayscleanEmptyArrays and updates schema generation + unit tests accordingly.
  • Reuses cleanEmptyProperties for Actor run response shaping (inlining prior single-use helpers).
  • Simplifies buildEnrichedDirectActorOutputSchema by cloning the base schema via structuredClone and assigning the itemsSchema leaf.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/unit/schema_generation.test.ts Updates unit tests to use cleanEmptyArrays name.
src/utils/schema_generation.ts Renames helper and updates schema-generation cleaning path + docs.
src/tools/structured_output_schemas.ts Refactors enriched schema construction using structuredClone and leaf assignment.
src/tools/core/actor_run_response.ts Inlines single-use helpers and switches to cleanEmptyProperties for cleaning.
src/tools/common/get_actor_output.ts Adds cross-link doc comment referencing cleanEmptyArrays.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tools/core/actor_run_response.ts
claude and others added 5 commits May 26, 2026 14:43
Address review nits from #823:
- Inline slashToDot (used once)
- Inline sleep (used once)
- Replace omitNullish with the existing cleanEmptyProperties helper
…blings

Behaviour differs (cleanEmptyArrays keeps null/'' to preserve fields for
schema inference; cleanEmptyProperties strips everything), so the two
helpers stay separate. Align naming under the clean* prefix and add a
sibling reference in each docstring.
Use structuredClone + leaf assignment instead of a 6-level nested spread.
@jirispilka jirispilka force-pushed the claude/relaxed-goldberg-OdGgV branch from 9ff607d to 087b160 Compare May 26, 2026 12:44
@jirispilka jirispilka marked this pull request as ready for review May 26, 2026 12:45
@jirispilka jirispilka requested a review from MQ37 May 26, 2026 12:45
@jirispilka jirispilka merged commit 4d44543 into master May 26, 2026
15 checks passed
@jirispilka jirispilka deleted the claude/relaxed-goldberg-OdGgV branch May 26, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-ai Issues owned by the AI team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: v4 stack review follow-ups (inline helpers, unify nullish cleaners)

5 participants