Skip to content

feat(ir): carry path parameter clientDefault into dynamic IR NamedParameter#16665

Open
devin-ai-integration[bot] wants to merge 7 commits into
mainfrom
devin/1782191427-ir-dynamic-client-default
Open

feat(ir): carry path parameter clientDefault into dynamic IR NamedParameter#16665
devin-ai-integration[bot] wants to merge 7 commits into
mainfrom
devin/1782191427-ir-dynamic-client-default

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Description

Additive dynamic-IR change so dynamic-snippet generators can distinguish an optional (client-default) path parameter from a required one.

This is step 1 of 2 toward fixing the php-sdk api-wide-base-path-with-default seed allowedFailures entry. Today an api-wide base-path parameter with x-fern-default (e.g. apiVersion: v1beta) carries a clientDefault in the full IR, which makes the generated SDK treat it as optional and order it after the request body:

create(Widget $request, string $apiVersion = 'v1beta', ?array $options = null)

But the dynamic snippet emits it as a required positional arg before the body (create('v1beta', new Widget([...]))), producing a phpstan type mismatch. The root cause is that the dynamic IR's NamedParameter carried variable but dropped clientDefault, so the snippet generator had no signal that the param is optional/reorderable.

The generator-side reordering fix is a separate follow-up PR that can only land after this IR change publishes (@fern-fern/ir-sdk / @fern-api/dynamic-ir-sdk), since generators consume the published IR SDK — they cannot read a field that doesn't yet exist in the published type. This PR therefore does not touch seed/php-sdk/seed.yml or remove the allowedFailures entry.

Changes Made

  • Add optional clientDefault: optional<LiteralType> to the dynamic IR's NamedParameter in packages/ir-sdk/fern/apis/ir-types-latest/definition/dynamic/types.yml; regenerate the IR SDK (pnpm ir:generate).
  • Populate it in DynamicSnippetsConverter.convertPathParameters (reusing the existing convertLiteral helper):
    clientDefault: pathParameter.clientDefault != null
        ? this.convertLiteral(pathParameter.clientDefault)
        : undefined
    This converter is called with this.ir.pathParameters (api-wide root params), so the base-path apiVersion param now carries its clientDefault into the dynamic IR. The IR SDK is generated with noOptionalProperties, so all other NamedParameter construction sites in the converter were updated to set clientDefault: undefined.
  • Bump packages/ir-sdk/fern/apis/ir-types-latest/VERSION to 67.7.0 (minor for an additive optional field) and add an IR CHANGELOG.md entry. 67.6.0 shipped independently on main for specVersion, so this change resolves the merge by taking the next minor.
  • Add a CLI changelog entry under packages/cli/cli/changes/unreleased/.
  • Regenerate the @fern-api/ir-generator-tests dynamic-IR / full-IR snapshot fixtures (additive clientDefault only) and update the file-dependencies IR-length ete snapshot (22979792298004) to account for both specVersion (from main) and clientDefault.
  • Updated README.md generator (if applicable) — n/a

Testing

  • pnpm compile (160/160 packages) and pnpm run check (biome) pass with the new field.
  • @fern-api/ir-generator-tests suite passes. The regenerated dynamic-IR snapshot for the target fixture now carries the field on the base-path param:
         "propertyAccess": null,
    -    "variable": null
    +    "variable": null,
    +    "clientDefault": {
    +        "type": "string",
    +        "value": "v1beta"
    +    }
    All other params correctly serialize "clientDefault": null.
  • Full CI green (206 passed) on the merge-resolved branch, including test-ete and all seed suites.
  • Unit tests added/updated — n/a (additive, covered by regenerated snapshots)

Follow-up (after this publishes): bump the php dynamic-snippets generator's IR deps, order root path params by clientDefault != null to match the SDK signature, regenerate the fixture, and remove api-wide-base-path-with-default from seed/php-sdk/seed.yml.

Link to Devin session: https://app.devin.ai/sessions/f75b71a1feab408dbe95a9e698500465

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Docs Generation Benchmark Results

Comparing PR branch against median of 5 nightly run(s) on main (latest: 2026-06-25T05:19:47Z).

Fixture main PR Delta
docs 220.4s (n=5) 237.2s (35 versions) +16.8s (+7.6%)

Docs generation runs fern generate --docs --preview end-to-end against the benchmark fixture with 35 API versions (each version: markdown processing + OpenAPI-to-IR + FDR upload).
Delta is computed against the nightly baseline on main.
Baseline from nightly run(s) on main (latest: 2026-06-25T05:19:47Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-06-25 09:05 UTC

@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

SDK Generation Benchmark Results

Comparing PR branch against median of 5 nightly run(s) on main (latest: 2026-06-25T05:19:47Z).

Full benchmark table (click to expand)
Generator Spec main (generator) main (E2E) PR (generator) Delta
csharp-sdk square 71s (n=5) 109s (n=5) 62s -9s (-12.7%)
go-sdk square 134s (n=5) 284s (n=5) 130s -4s (-3.0%)
java-sdk square 213s (n=5) 282s (n=5) 191s -22s (-10.3%)
php-sdk square 59s (n=5) 84s (n=5) 53s -6s (-10.2%)
python-sdk square 136s (n=5) 241s (n=5) 127s -9s (-6.6%)
ruby-sdk-v2 square 91s (n=5) 129s (n=5) 85s -6s (-6.6%)
rust-sdk square 183s (n=5) 173s (n=5) 155s -28s (-15.3%)
swift-sdk square 57s (n=5) 431s (n=5) 49s -8s (-14.0%)
ts-sdk square 236s (n=5) 239s (n=5) 235s -1s (-0.4%)

main (generator): generator-only time via --skip-scripts (includes Docker image build, container startup, IR parsing, and code generation — this is the same Docker-based flow customers use via fern generate). main (E2E): full customer-observable time including build/test scripts (nightly baseline, informational). Delta is computed against generator-only baseline.
⚠️ = generation exited with a non-zero exit code (timing may not reflect a successful run).
Baseline from nightly runs on main (latest: 2026-06-25T05:19:47Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-06-25 09:08 UTC

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