Fix top-sellers-in-category: rank against real sales, and stop reading buy-box position as idle stock - #35
Draft
fiharet34 wants to merge 1 commit into
Conversation
…g buy-box position as idle stock Checks each estimate against the seller's real completed sales before placing a row: shops with no real trading history move out of the ranking into a labelled group, while a real business whose estimate runs high stays in with a caveat. Groups shops sharing a name stem and says whether that changes the leader, without asserting common ownership. Reframes the registered-versus-with-sales comparison as sellers only. On a catalog product only the buy-box holder shows sales, so the product gap measures buy-box position rather than idle inventory - and since the panel now renders every run, an unlabelled version of that chart would mislead every time. Also: medal as a column so the saved baseline can reproduce its own panel, the growth column named for the metric it carries, full money precision in a ranking, a missing-value rule, a width fallback that drops columns rather than the table, retry after a pause, and an empty result separated from an outage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix
top-sellers-in-category: rank against real sales, and stop reading buy-box position as idle stockSummary
Five defects, each reproduced against production data before the file was touched and
re-verified afterwards. Two of them are visible in the skill's own live output rather
than inferred from reading it, and one of those is about to get worse: since #33 made
the visual panel mandatory, a misreading that used to surface occasionally in prose now
has a chart reserved for it on every run.
Rebased onto
421426d.9,421 → 14,826 bytes, 8 hunks. Description is 978 characters,inside the 1024 limit.
The defects
1. The panel charts a misreading. Visualization asks for "a small 'registered
versus with sales' comparison for sellers and for products, to show how much of the
supply actually converts." On a catalog product only the seller holding the buy-box
shows sales — every other seller of that product reads zero. So the product half of
that comparison is mostly measuring buy-box position, not dead inventory.
A live run put it in the third line of the answer, unprompted:
Two thirds of that gap is attribution. Before #33 this appeared when the model happened
to reach for it; now the panel renders every time, so an unlabelled version of the chart
would mislead on every run instead of occasionally.
2. Nothing checks the estimate against real sales before ranking. The ranking metric
is an estimate; completed sales over the last year are real, and the two can diverge by
orders of magnitude.
RAIZENTECH(ranked 5th)LINDOPETS(ranked 36th)RMAQUINASKRAIZENTECH's estimate implies roughly 72.000 sales a year against 352 actuallycompleted.
LINDOPETSis a single listing with no sales at all, in a pets-named shopinside a tools category. Beleza produced seven rows of the same shape.
The skill sometimes flagged them in a closing note — and ranked them anyway. That is not
enough: the positions are finite. Excluding them surfaced
HOME HOUSE_,GALANTELEDS,RITEC FERRAMENTASandLOJAOFICIALCASASBAHIA, all real businesses that the artifactshad been displacing.
3. Shops sharing a brand are never grouped, and it changes who leads. In Ferramentas:
THE_BLACK_TOOLS_+THE_BLACK_TOOLS= R$ 15.278.505ISMAFER(Vila Guilherme + 06 + MG) = R$ 11.477.497CABE_FERRAMENTAS= R$ 10.724.187Either grouping displaces the leader, and the skill's "no one dominates" framing holds
only at shop level. Across three pre-fix runs this observation appeared in one.
Common ownership is not verifiable from this data — those shops' registration dates
span 2009 to 2023 with unrelated identifiers, which argues against a single operator as
often as for one. So the fix requires flagging the shared name stem and showing the
combined figure as an alternative reading, and explicitly forbids asserting ownership.
4. No missing-value rule. Four runs, four renderings of the same condition:
sem dados,0,00%,n/d, and once simply absent. The0,00%case is the harmful one — acancellation rate of zero on a seller with no completed sales reads as a perfect record
when nothing was measured at all.
5. No fallback when the table does not fit. Twelve columns across fifty rows exceeds
a terminal, and one run abandoned the table for a vertical record-per-seller list. That
breaks the skill's own premise: the user is told to save the table and send it back next
period for a comparison, and a per-seller list cannot be diffed row against row.
Related, from the same run: revenue rounded to
R$ 0,7x mi, which flattened rows 48–50into indistinguishable values in a table whose only purpose is ordering.
What changed
out of the ranking, into a labelled group showing the estimate, the real completed
sales and the listing count together. A real business with an inflated estimate →
kept, with a note that its position may be too generous.
and an explicit prohibition on claiming common ownership.
product split is forbidden, and describing the gap as idle stock or failed conversion
is called out by name with the buy-box reason given.
Medalhapromoted to a column. The downloadable file is the baseline the sellerbrings back, so it has to carry every field the report and its panel use — a file that
cannot reproduce the panel is not a baseline.
Sales trendrenamed toCrescimento mensaland pinned to month-over-monthgrowth, so it cannot drift onto an older run-rate measure that is empty for most
sellers.
(drop columns from the right and say which; never abandon the table), retry after a
pause, and empty-result-is-not-an-outage.
sales, revenue, brands and product counts are category-scoped; completed sales,
cancellation rate, growth and listing types are store-wide.
Cancel rate | Sales trend | Classicrow.
Validation
Three pre-fix runs and three regression runs, across two categories and both languages,
with output figures spot-checked against independent queries.
0,00%cancellation on a seller with noneThe panel was verified in the rendered artifact, not inferred from prose. Its
seller-split section is titled "Quantos vendedores realmente vendem" and charts only
Ativos 180.238againstCom vendas 92.763 · 51,5%. There is no product split anywherein the panel.
Two corrections made during validation
Worth recording, because both were wrong in the same way — right in direction, wrong at
the boundary — and only a run exposed them.
The exclusion test over-reached. Its first version cut 23 of 90 shops in Beleza,
including
PACHECO_IMPORTS RP— 31.888 completed sales, 240 listings, 3,81%cancellation, Platinum, and third in every prior run. That is a real business whose
estimate is inflated, not an artifact. The rule had no floor on the real side. It now
has two branches, and the distinction is the real figure rather than the ratio.
A blanket ban on showing a local file path was too wide. In a terminal, telling the
user where the file landed is the useful thing. Narrowed to internal working paths: a
temporary or scratch directory is not a save location.
Known limitations
that carried the nulls, so it may rarely fire. Kept because the condition still exists;
not claimed as verified.
and may group unrelated shops that happen to share a stem — which is why the rule
reports it as an alternative reading rather than restating the ranking.
nothing here says whether the same prompt twice gives the same answer.
Notes for maintainers
#33 means this skill now publishes an artifact on every run, containing a named
competitive leaderboard of fifty real sellers. Artifacts are private by default, so this
is not a disclosure problem — but it is a change in what the skill does with the data,
and it arrived through a library-wide visualization change rather than a decision about
this skill. Flagging it because this PR is the first to land on top of it.
A fix we had prepared is already upstream. The disclaimer here was pt-BR only at the
base we started from; the English half is now present, so that change was dropped.
This PR does not touch
CHANGELOG.md. The newest entry is 0.2.0 and the commitsafter it are not recorded there, which reads like a release-time convention rather than a
per-PR one. Happy to add an entry if that is wrong.
Three of these rules are not skill-specific — empty-result-is-not-an-outage, retry
after a pause, and never presenting partial coverage as complete. They apply to most of
the library, and restating them per skill is why this file grew. They would sit better in
a shared style document, which the repo does not currently have.
Checklist
main(421426d)