Repository navigation
chore(ts): check stable names on a small fixture of their own - #459
Conversation
Quest-Claim: 910a69f3f4a3c085
stable_names translated all of lang a second time. The names fixture keeps each case lang's fmt::added reached: another instance of a generic method, a closure, an impl of another trait, a merged std function, and an impl over a deeper &mut, each sorting first, beside a trait object's module named as an imported type's. lang drops fmt::added and refs::deeper, and translates on its own again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ches more Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
Unstable names churn snapshots and conflict merges, which the checks epic exists to cut. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes quest/m0/checks/stable-names.md.
Problem
stable_namestranslated all oflanga second time, withfmt::addedas an extra root, to check that reaching more instances renames nothing. Since #419 it reuseslang's base translation, but the second translation still costs about onelangtranslation (130 to 155 CPU-s).Approach
A new
namesfixture (5 small modules) keeps every casefmt::addedexercised inlang.runreaches one instance of each item.addedreaches another instance that sorts beforerun's:Wrap::newandinto_inneratu8)Wrap::mapoveradded's closure)DebugbesideDisplay, forPairand forWrap<Pair>)run's (Option<Ordering>::map_or)&mut(Tally for &mut T)dyns.Shape, named as theshapes.Shapetype thatlib.tsimportsstable_namessnapshots and type-checksnames, then translates it withroots = ["added", "run"]and checks that every base line stays, in order.langdropsfmt::addedandrefs::deeper(only the doc line offmt.Padded.tsin its snapshot changes) and no longer shares its translation through aOnceLock.The fixture has
runalready call intoPair's module fromwrap.Wrap.ts. Otherwise a type-onlyimport type * as Pairbecomes a value import onceaddedreachesDebug. That is an import-kind change, not a rename, so I keptkeptstrict rather than normalizing it.Each rule is caught
I reintroduced each instability in the translator and ran
stable_nameswithUPDATE_EXPECT=1, so the snapshot can't fail and only the stability check can. Each one fails at the line its case targets:stable_namesreports changedlib.ts:Wrap.fmt(part, f)lib.ts:Wrap.new({ _0: first, _1: 1 })lib.ts:Wrap.map$wrap_Pair_u8_closure0(...)core/option.ts:mapOr$Option_cmp_Ordering_u8_run_closure0lib.ts:import * as Shape from "./shapes.Shape.ts"wrap.Wrap.ts:intoInner$u8tally.ts:tally$tally_Tally_u32$2CPU
Warm, user plus system CPU-seconds of
cargo test --test fixtures -- --exact <tests>on this host:origin/main)stable_namesalonelangalonelang stable_namestogetherAlone, the test drops by about 300 CPU-s. Inside the suite it drops by one
langtranslation, about 130 to 155 CPU-s (half the two-translation run alone). Thetogetherrows are as noisy as that saving, since another build overlapped one of them. Cold matches warm here: the driver always recompiles the fixture, and neither fixture has dependencies.Impact
Alternatives
langas the base and translate only part of it for the added root. The base must match the added run's roots, so it would still cost a second translation of most oflang.import typeinlines()instead of shaping the fixture around it. That would also hide a real type-to-value change in the future.Follow-ups
Okparts is named for the first function in source order among those reached, so reaching an earlier one renamesreadOuttoleadOut. I reproduced this on a scratch crate;lang's version of the test never covered it either.Review
a8432b53e1162e99e79155b5191941a9cf512874: the only change since round 2 is quest-only.ts-stable-slots.mdmoved from m3 toquest/m0/checks/and is listed in that epic's README.just checkpassed at that head.gpt-6.1-sol, medium effort, round 2 at7a6c19dc559329a7328a4614af395360e7bdcec6(after mergingorigin/main): no findings. Round 1 ata8e1fb47had none either.just cipassed at7a6c19dc: lint, quest,tscheck, andtstest (12 of 12 fixture tests, 7 of 7 unit tests).🤖 Generated with Claude Code