refactor(downgrader): reuse aliasEnd, skip the second pass for path item fields, fix oracle drift - #48
refactor(downgrader): reuse aliasEnd, skip the second pass for path item fields, fix oracle drift#48dinwwwh wants to merge 3 commits into
Conversation
…tem fields, fix oracle drift - convertContentEntry follows a media type alias chain with ctx.aliasEnd instead of a hand-rolled walk; skipAliases is no longer exported. - A reference into a field every Path Item conversion drops (query, additionalOperations) is now known to dangle from the input, so it no longer costs a second pass over the whole document. Path Items that are copied rather than converted (extensions of paths, callbacks that are Reference Objects) are excluded, and links and mappings still go by the removed prefixes alone, so outputs are unchanged. - The test oracle keeps its own pointer resolver on purpose, now without resolving array properties such as `length` or plain-name fragments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GZa6QbyudtUSAeHt5W2B8A
… field Classifying every distinct reference parsed and walked its pointer, even for 3.1 → 3.0 where no Path Item field is dropped, which cost about 40% on a document with thousands of references. A reference whose text names none of the dropped fields now skips the parse. Also un-export the Removed type and trim repeated comments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GZa6QbyudtUSAeHt5W2B8A
|
your Pullfrog Router balance is empty, and this repo has no provider key to fall back on, so the agent never ran. To fix, any one of: add a payment method or top up your Router balance · add a provider API key (GitHub Actions secret or Pullfrog secret) · switch this repo to a free model. Top up Router → · Model settings → · Setup docs → · Ask in Discord → |
|
The To get a Pullfrog review, a maintainer needs to top up the balance or add a provider key in the Pullfrog console. The check says it gates nothing unless branch protection requires it. Generated by Claude Code |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The `paths` extension check moves into the walk, where the token is always defined, so the unreachable `?? ''` fallback goes. The look-alike test also covers a component and a file merely named `query`, which reach the walk's two remaining `return false` paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GZa6QbyudtUSAeHt5W2B8A
|
your Pullfrog Router balance is empty, and this repo has no provider key to fall back on, so the agent never ran. To fix, any one of: add a payment method or top up your Router balance · add a provider API key (GitHub Actions secret or Pullfrog secret) · switch this repo to a free model. Top up Router → · Model settings → · Setup docs → · Ask in Discord → |

Three small cleanups in
packages/downgrader. Converter outputs do not change.Changes
1. Reuse
ctx.aliasEndinconvertContentEntry(src/v3.2-to-v3.1.ts)A media type
$refused to be followed withskipAliases(ref, ctx, () => true), which re-walks the alias chain. It now calls the memoisedctx.aliasEnd. A chain that loops still comes out asDROP.skipAliasesis no longer exported, since onlyinlineSchemaandrefOruse it.2. One pass for references into dropped Path Item fields (
src/shared.ts)removedPrefixesonly listed document and components prefixes. So a$reforoperationRefinto a path item'squeryoradditionalOperationswas only found dangling after a whole pass, and the entire document was converted again.removedPartsreplacesremovedPrefixes. It also reports which fields ofPATH_ITEM_FIELDSareDROP.New
isInDroppedPathItemFieldrecognises a Path Item pointer (viaisPathItemPointer) followed by one of those fields. It walks the input to skip Path Items the converter copies rather than converts:paths;A plain
isPathItemPointercheck would wrongly inline references into those.The check only seeds
danglesin the first pass.ctx.isRemovedPart, which decides which links and discriminator mappings are removed, stays prefix-only. Folding the check in there would start removing links and mappings whose target is missing or can't be inlined, such as anoperationRefto aquerythat doesn't exist.Only a reference whose text names one of the dropped fields is parsed and walked. A document with thousands of references therefore pays nothing extra, and neither does 3.1 → 3.0, where no Path Item field is dropped.
3. Test oracle drift (
tests/validate.ts)resolvePointerstays independent ofparsePointer/childon purpose: the conversion uses those to decide what dangles, so an oracle built on them would share their bugs. A comment now says so, and its drift is fixed:#/a/lengthno longer resolves on an array;#petis not a pointer. It used to resolve toroot.et.Tests
removed-parts.test.ts, "handles references into query and additionalOperations in a single pass": counts reads of another path item. The count is 2 before this change and 1 after.removed-parts.test.ts, "leaves references to a query that the conversion keeps as written":pathsextension, a Callback Object that is a Reference Object, a component namedqueryand a file namedquery.yaml;isPathItemPointercheck;tests/validate.test.tscovers the oracle's pointer handling.Verification
pnpm lintandpnpm type:checkare clean;pnpm vitest run packages/downgraderpasses (678 tests).main, on the test suite: I ran every input the suite passes to the downgrader through both this branch andmain. All 829 outputs were identical, including key order.main, on generated documents: 3000 fuzzed 3.2 documents gave identical outputs from 3.2 → 3.1 and from 3.1 → 3.0. They are dense in references intoqueryandadditionalOperationsand into documents that only look like Path Items. The same fuzzer flags 85% of documents when only the plainisPathItemPointercheck is used, so it does detect differences.querygoes from 84.0 ms to 36.0 ms. Without such a link it stays at 32.2 ms. On a document with 4000 distinct references the timings are unchanged, within noise.References into fields that are dropped further down, such as a media type's
itemSchema, still cost a second pass. They are out of scope here.🤖 Generated with Claude Code
https://claude.ai/code/session_01GZa6QbyudtUSAeHt5W2B8A