Fix API signature drift in user-guide skill + README (closes #11)#14
Merged
Fix API signature drift in user-guide skill + README (closes #11)#14
Conversation
…e tests The user-guide-skill-revamp PR (#13) and the long-standing README both shipped code examples that drifted from the package's actual public API. Issue #11 named the README cases; this commit closes that issue and fixes the same class of bug everywhere it appears in the bundled skill. Concrete corrections (all verified against python/src/adctoolbox/<...>): - analyze_spectrum: takes (data, fs, ...); does NOT take Fin or n_bits. Plot kw is create_plot, not show_plot. Returns dict with lowercase _dbc keys (sndr_dbc, sfdr_dbc, enob, snr_dbc, thd_dbc, ...) — not the uppercase SNDR/SFDR/ENOB previously shown. - find_coherent_frequency: positional (fs, fin_target, n_fft); not the fs=, n=, fin_target= form previously documented. - calibrate_weight_sine: first arg is `bits` (N×B {0,1} matrix), not integer codes. No n_bits param. Returns a dict (weight, offset, calibrated_signal, ideal, error, refined_frequency) — not just a weights array. - calibrate_weight_sine_lite: positional (bits, freq); returns ndarray. - analyze_overflow: takes (raw_code, weight, ...) and returns a 4-tuple (range_min, range_max, ovf_pct_zero, ovf_pct_one). - analyze_bit_activity / analyze_enob_sweep: take `bits` (matrix), no n_bits kw; analyze_enob_sweep needs normalized freq. - analyze_phase_plane / analyze_error_phase_plane: do not take Fin. - generate_aout_dashboard: freq is in Hz; output_path (not savepath). - generate_dout_dashboard: freq is normalized Fin/Fs; output_path. - fit_static_nonlin(sig_distorted, order): returns (k2, k3, fitted_sine, fitted_transfer); input is a distorted signal, not INL/DNL data. - convert_cap_to_weight: takes three same-length arrays (caps_bit, caps_bridge, caps_parasitic), not one. Also tightens api-quickref.md's Key Conventions section, adds decompose_harmonic_error to the advanced-tier submodule import list, and clarifies the bits / aout naming convention up front in SKILL.md section 2. To prevent recurrence: adds python/tests/integration/ test_user_guide_skill_examples.py, which actually imports each named API and runs the documented call pattern with a small synthetic fixture. Any future drift between the skill and the package will fail this test rather than silently shipping. The eval workflow used for PR #13 was text-similarity only (no execution) — that's how the bugs escaped. Closes #11. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Arcadia-1
added a commit
to Arcadia-1/analog-agents
that referenced
this pull request
Apr 28, 2026
…xes) PR Arcadia-1/ADCToolbox#14 merged: aligns the bundled adctoolbox-user-guide skill and the README with the actual public API (closes ADCToolbox issue #11). Adds an executable smoke test that imports + calls each documented API so future drift fails CI rather than silently shipping. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
PR #13 (the user-guide-skill-revamp) and the long-standing README both shipped Python code examples that don't match the actual package API. The eval used in PR #13 was text-similarity only — subagents simulated responses but never imported or ran the code, so drift went undetected. Issue #11 named the README cases. This PR fixes the same class of bug everywhere it appears in the bundled skill, fixes the README per the issue, and adds an executable smoke test so this can't silently regress again.
Concrete corrections
All verified against
python/src/adctoolbox/:analyze_spectrumtakes(data, fs, ...)— does not takeFinorn_bits. Plot kwarg iscreate_plot=, notshow_plot=. Returns a dict with lowercase_dbckeys (sndr_dbc,sfdr_dbc,enob,snr_dbc,thd_dbc, …) — not the uppercaseSNDR/SFDR/ENOBpreviously shown. (Issue README API examples use wrong parameter names #11 case 1.)find_coherent_frequencyis positional:(fs, fin_target, n_fft). The oldfs=, n=, fin_target=form passes wrong values.calibrate_weight_sinefirst arg isbits(N×B{0,1}matrix), not integer codes. Non_bits=kw. Returns a dict withweight, offset, calibrated_signal, ideal, error, refined_frequency— not just a weights array.calibrate_weight_sine_lite(bits, freq)is positional and returns an ndarray.analyze_overflow(bits, weight)needs a calibrated weights array as its 2nd arg and returns a 4-tuple(range_min, range_max, ovf_pct_zero, ovf_pct_one).analyze_bit_activity/analyze_enob_sweeptakebits(matrix), non_bits=;analyze_enob_sweeprequires normalizedfreq=Fin/Fs.analyze_phase_plane/analyze_error_phase_planedo not takeFin(they self-fit the fundamental).generate_aout_dashboardtakesfreqin Hz and writes tooutput_path=(notsavepath=).generate_dout_dashboardtakesfreqnormalized (Fin/Fs).fit_static_nonlin(sig_distorted, order)returns(k2, k3, fitted_sine, fitted_transfer). Input is a distorted signal — not INL/DNL data — so the previous example was wrong on both signature and intent.convert_cap_to_weighttakes three same-length arrays(caps_bit, caps_bridge, caps_parasitic), not one.api-quickref.md's Key Conventions section is rewritten to capture all of the above.decompose_harmonic_erroris added to the advanced-tier submodule import list (it lives inadctoolbox.aout, not flat).SKILL.md§2 now leads with thebitsvsaoutnaming convention.Why this kept happening
PR #13's eval workflow scored text similarity from subagents — they could mention
analyze_spectrumand reference real-sounding return keys without ever executing the code, so signatures drifted unchecked. The README has the same root cause: hand-written examples never wired to a runnable test.How this prevents recurrence
python/tests/integration/test_user_guide_skill_examples.pyactually imports each named API and runs the documented call pattern with a small synthetic fixture (ADC_Signal_Generator+ a coherent capture). 9 tests, one per SKILL.md / advanced-debug.md / api-quickref.md section. If a future edit drifts again, the test fails before merge.Test plan
pytest tests/integration/test_user_guide_skill_examples.py -v→ 9 passedshow_plot,Fin=, uppercase metric keys,n_bits=N)in skill files + README → 0 hitsCloses #11.
🤖 Generated with Claude Code