Repo cleanup: restore sponsio refresh, edge-runtime SDK, docs/config sync#82
Closed
donalddellapietra wants to merge 10 commits into
Closed
Repo cleanup: restore sponsio refresh, edge-runtime SDK, docs/config sync#82donalddellapietra wants to merge 10 commits into
sponsio refresh, edge-runtime SDK, docs/config sync#82donalddellapietra wants to merge 10 commits into
Conversation
The ts/ workspace has a single package (@sponsio/sdk); the second 'AST static scanner CLI' line described the same package as if it were a separate one. Merge into one accurate entry. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Remove the 'sponsio refresh' section: no such command exists; the refresh workflow is driven via 'sponsio prompt refresh' (already documented) and the described --since/--apply flags were never real. - Document 'sponsio onboard' (one-shot init+scan+doctor wire-up). - Document 'sponsio serve' (placeholder stub in this distribution). - Document the 'sponsio daemon' group (run/ping/status). - Document the 'sponsio cursor' group (install-hooks/guard). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pin line-length, target-version, and the lint rule selection that CI's pinned ruff relies on, instead of inheriting version-dependent defaults. Codifies current behaviour (88-col, default E/F set) so the existing tree stays clean; broadening the rule set is left to a follow-up. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sponsio/scoring/ was removed in bd9a80a (sto/scoring cleanup) but the repo map still listed it. No such package exists. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add [tool.mypy] + mypy/types-PyYAML dev deps so contributors get a single reproducible 'mypy -p sponsio' invocation with framework import noise silenced. Intentionally not wired into CI yet — the tree has ~180 type errors — and documents the module-by-module ratchet path to a gate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add "sideEffects": false so bundlers can drop the yaml/config-loading modules entirely for consumers that only use the deterministic engine (e.g. inline-contract usage on Cloudflare Workers). Complements the createRequire deferral landed in #78: that stops the eager createRequire(undefined) throw, this lets the Node-only yaml path be tree-shaken out of edge bundles rather than merely deferred. No top-level side effects exist in the published source, so this is safe. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
CodeAnalyzer.extract_trace_contracts imported TraceMiner unguarded, before the try/except that fails open on trace-loading errors. In builds that don't bundle the trace_mining extension (it's an optional extension point — see discovery/extractors/__init__.py, which already guards the same import), this raised ModuleNotFoundError and crashed 'sponsio scan --trace' / 'sponsio refresh' instead of degrading. Guard the import with try/except ImportError and emit a skip line, matching the established pattern at the package's other two call sites. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
refresh re-mines source:trace contracts from recent session logs and surgically merges them into sponsio.yaml (companion to 'sponsio scan'). The backing logic (sponsio/refresh.py: compute_refresh / apply_refresh / render_report) and all its docs (README, QUICKSTART, SKILL.md, prompts/refresh.md) shipped, but the @cli.command registration was dropped at some point, so 'sponsio refresh' errored as an unknown command despite being documented everywhere. - Re-add the command (recovered from 505dd50, verified against the current CodeAnalyzer.generate_yaml / parse_since APIs, which are unchanged): -c/--config, -a/--agent, -t/--trace, --since, --mode, --apply, dry-run by default, .sponsio.bak backup on apply. - Restore tests/test_refresh.py (E:->G: fixtures updated for the rename) — 23 tests covering identity/dedup, the diff buckets, add-only vs replace-trace apply, and the CLI surface. - Restore the 'sponsio refresh' section in docs/reference/cli.md (this reverts its removal earlier in the branch, now that the command is real again) and note the trace-mining-extension caveat. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Add test_cli_refresh_mines_and_merges: stubs CodeAnalyzer.generate_yaml with a real-schema mining result so the full mine→diff→apply pipeline is exercised (add/drift/stale + user-rule preservation + backup). The existing CLI tests only used empty traces, so the generate_yaml↔ _normalize_contract_entry schema contract was never validated. - Replace the unused _make_native_trace helper with that test. - Fix a trivially-true backup assertion (dead 'or True') to actually assert the backup retains the original. - Narrow SDK 'sideEffects' to ['./dist/cli/**']: the CLI entry runs main() at module scope, so a blanket 'false' was inaccurate (the library exports remain side-effect-free and tree-shakeable). - Fix a stale 'E:'→'G:' comment in code_analysis YAML emission. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Hey Donald, nice survey. We're going to pass on restoring I've adopted the surrounding cleanup separately with attribution in #83: the CLAUDE.md repo-map fixes, the cli.md sync for onboard/serve/daemon/cursor, the ruff config, the trace_mining fail-open guard, and the sdk sideEffects fix (narrowed to the CLI entry per your follow-up). Skipped the mypy config for now, and no need to worry about DCO, it's not enabled on this repo. Will fill you in on the rest offline. Thanks! |
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
A batch of well-scoped cleanups found while surveying the repo. The headline is restoring the
sponsio refreshCLI command — its full logic (sponsio/refresh.py) and all its docs (README, QUICKSTART, SKILL.md,prompts/refresh.md) shipped, but the@cli.commandregistration had been dropped, so the documented command errored as unknown. The rest are doc/config accuracy and an edge-runtime/SDK fix.Type of change
sponsio refreshcommand@sponsio/sdkedge-runtime tree-shakingDesign notes
refreshwas recovered from its original commit (505dd50) and verified against the currentCodeAnalyzer.generate_yaml/parse_sinceAPIs (unchanged). Tests restored astests/test_refresh.pywith fixtures updated for theE:→G:rename (23 tests).CodeAnalyzerimportedTraceMinerunguarded, before the try/except that fails open on trace-loading errors — so in builds without the optionaltrace_miningextension it crashedscan --trace/refreshinstead of degrading. Now guarded, matching the package's two other call sites.sideEffects: falsecomplements thecreateRequiredeferral that landed in#78/0.2.0a3: that stops the eager throw; this lets bundlers tree-shake the Node-only YAML path out of edge bundles entirely.--emit-traces/ the prompt-driven refresh flow (the restored command matches the documented--since/--apply/--modeinterface); broadening ruff rules (e.g. import sorting); type-error cleanup.Test plan
Checklist
pytest -vpasses locally.ruff check/ruff format --checkclean.CHANGELOG.md[Unreleased]updated.sponsio/core (mypy/types-PyYAML are dev-only).🤖 Generated with Claude Code