Repository navigation
Price Mistral aliases from the listing name when the group disagrees #785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,9 @@ | |
| * models overview pairs each API id with the page slug, including | ||
| * deprecated rows the index-slug rules miss | ||
| * (`mistral-medium-3-5` → `mistral-medium-3-5-26-04`). | ||
| * A listing alias the page does not name takes that page's card when | ||
| * the listing `name` is an id the page does name. A mutual alias with | ||
| * its own different card keeps that card (`magistral-medium-latest`). | ||
| * | ||
| * `releasedAt` is the catalog record's `releasedAt` (#708). The markdown | ||
| * twin's `Release date:` line is the older statement. The listing's | ||
|
|
@@ -1894,11 +1897,15 @@ const ALIAS_FACTS = [ | |
|
|
||
| /** | ||
| * Copy a fact onto mutual listing aliases when every member that has it | ||
| * agrees. A conflict copies nothing. The copy keeps the donor's docs URL. | ||
| * agrees. When they do not, an id whose listing `name` is another member | ||
| * of the group still takes that member's fact, and a member that already | ||
| * has its own fact keeps it. A `name` that is not a listed id copies | ||
| * nothing. The copy keeps the donor's docs URL. | ||
| */ | ||
| export function copyMistralAliasFacts( | ||
| models: Array<ModelInfo>, | ||
| aliases: ReadonlyMap<string, ReadonlyArray<string>>, | ||
| namedAs: ReadonlyMap<string, string> = new Map(), | ||
| ): void { | ||
| const byId = new Map(models.map((model) => [model.rawId, model])) | ||
| const parent = new Map<string, string>() | ||
|
|
@@ -1943,14 +1950,19 @@ export function copyMistralAliasFacts( | |
| const first = donors[0] | ||
| if (!first) continue | ||
| const serialized = JSON.stringify(first[fact]) | ||
| if (donors.some((donor) => JSON.stringify(donor[fact]) !== serialized)) { | ||
| continue | ||
| } | ||
| const agreed = donors.every( | ||
| (donor) => JSON.stringify(donor[fact]) === serialized, | ||
| ) | ||
| for (const id of group) { | ||
| const target = byId.get(id) | ||
| if (!target || target[fact] != null) continue | ||
| Object.assign(target, { [fact]: first[fact] }) | ||
| const source = first.factSources?.[fact] | ||
| const named = namedAs.get(id) | ||
| const namedDonor = | ||
| named && group.includes(named) ? byId.get(named) : undefined | ||
| const donor = agreed ? first : namedDonor | ||
| if (!donor || donor[fact] == null) continue | ||
| Object.assign(target, { [fact]: donor[fact] }) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clear the copied fact's absence marker when the copier writes a donor card. A target whose markdown twin was unreadable can carry Suggested fix
|
||
| const source = donor.factSources?.[fact] | ||
| if (!source) continue | ||
| target.factSources = { ...target.factSources, [fact]: source } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skip display-name targets before the consensus copy.
When every priced group member agrees, the copy gives the consensus fact to every unpriced member. The consensus path never checks the listing name. An unpriced member whose listing name is a display string, such as
"Mistral Medium", therefore receives the consensus card. The PR requires that a name that is not a listed group ID copies nothing. The existingcopies the listing name when the alias group disagreestest covers only the disagreement path, so this case has no test.Check the listing name before choosing a donor. Skip any target whose name is not a group member. Keep the consensus copy for targets with no name entry, and keep the named-donor copy for targets whose name is a group member. Add a test where donors agree and the unpriced target's name is a display string. The test must expect no copy.
Suggested fix