Repository navigation
notes: probe and note a parameter change once across function/method twins - #11
wufangyong973 wants to merge 1 commit into
Conversation
MohammadHijjawi97
left a comment
There was a problem hiding this comment.
Thanks for picking up #5! The tests are clear and the idea is right, but the key is broader than the issue intends.
Dropping the owner for every parameter change also merges methods that only share a name and a parameter. Two examples from real diffs:
- anthropic:
Messages.create(temperature=...)andCompletions.create(temperature=...)are different APIs that would now be probed once, andrender_blockwould then drop one of their notes. - openai: many resources have
create(stream=...)orlist(limit=...); they would all collapse into one concept.
The case in #5 is narrower: a module-level function and a class method that mirrors it (hf_hub_download and HfApi.hf_hub_download). A way to keep exactly that:
- in
selection.select(and wherever elseconcept_keyis used to dedupe), first collect the(name, parameter)pairs of parameter changes on module-level functions (owner is None) in that package; - give a method's parameter change the owner-free key only when its
(name, parameter)is in that set; - do the same check in
render_block, instead of keying on(package, kind, name, parameter)alone.
A test with Messages.create(temperature) next to Completions.create(temperature) (both kept) plus the hf_hub_download twins (merged) would cover both sides.
Also, I just pushed 0.2.0 (2bd28fc), which changed apidiff.py, selection.py and notes.py a lot, so this will need a rebase onto main. Happy to do that part for you if you prefer; just say.
I've approved the CI run for this PR.
|
Hi @wufangyong973, thanks for your patience here. A lot changed upstream since 0.1.0, so here's where this stands. 0.4.0 rebuilt the notes: |
|
Hi @wufangyong973, just checking in on this one too. Are you still planning to rework it for the narrower case (a module-level function and the class method that mirrors it) on top of the 0.4 notes code? If you're busy, that's completely fine: I can finish it on top of your commits and keep you as co-author. Just let me know which you prefer. If I don't hear back by October 11, I'll go ahead and do that. |
924516a to
a167228
Compare
…twins When a parameter is removed from both a module function and the class method that mirrors it (e.g. huggingface_hub.hf_hub_download vs HfApi.hf_hub_download in the Opus example), the previous run produced one bullet per owner even though the underlying concept is one. APIChange.concept_key now drops the owner for the four param_* kinds so the pair collapses to a single probe. Removed/moved objects keep their owner: a module object and its class method are still two different concepts. The notes.py change from the original attempt was dropped — the upstream render_block structure has since changed enough that the hunk no longer applies cleanly; the concept_key change is the one that drives the probe-once behaviour and is self-contained.
a167228 to
dbc20b8
Compare
Fixes #5
When a parameter is removed from both a module function and the class method that mirrors it (
hf_hub_downloadandHfApi.hf_hub_downloadin the Claude Opus 4.6 example), the run emitted one bullet per owner even though it is one concept.The two small changes suggested in the issue:
APIChange.concept_keynow ignores the owner forparam_*kinds, soselectionprobes the function/method pair oncerender_blockmerges bullets whose change has the same package, kind, name and parameterRemoved/moved objects keep their owner in the key — the module object and the method are still different concepts. The README example does not contain the affected huggingface-hub output, so no re-run is needed.
tests/test_units.pyruff check/ruff formatandmypystrict clean