Repository navigation
feat(tools/fossil, tools/vcs): add Fossil forge bridge and VCS backend - #736
Conversation
potiuk
left a comment
There was a problem hiding this comment.
Thanks for the Fossil bridge — the security posture is solid (every fossil call is a list argv, no shell=True; all SQL uses bound ? parameters; clean-env applied) and it fits the existing tools/vcs backend contract cleanly.
Heads-up: a maintainer (me) rebased this onto current main and force-pushed — it was behind the ~20 commits that landed today — and approved the workflow run, so CI is now green (36/36). No content changes from the rebase; just a replay onto the new base.
A few things to address before it can merge:
Please add unit tests for the FossilBackend output parsers. tests/test_vcs.py only covers detect for Fossil; the fossil timeline / fossil changes parsers in tools/vcs/src/magpie_vcs/__init__.py (the " [" / "] " split heuristic, the (user: stripping, the ADDED/DELETED → A/D mapping) are the most error-prone code in the PR and have no coverage. A handful of unit tests over captured fossil output samples would lock the behaviour in.
Smaller points:
tools/fossil/src/magpie_fossil/forum.py:88and:132, andticket.py:52— bareexcept Exception: passsilently drops a failedfossil artifactread (a corrupt artifact yields a silently short list). Narrow the catch or surface a warning.tools/fossil/src/magpie_fossil/ticket.py— user-supplied--field NAMEvalues are spliced positionally into thefossilargv, so a name beginning with-would be parsed as an option. Not shell injection (args are a list), but a--separator before the field pairs would harden it.tools/fossil/src/magpie_fossil/client.py:70and:85— the SQLiteconn.close()isn't in awith/finally, so a mid-query exception leaks the handle.contextlib.closing(sqlite3.connect(...))fixes it.
None of these are security or contract blockers — the bones are good. Happy to re-review once the parser tests land.
Summary
tools/fossil/bridge for Fossil SCM — the distributed VCS with an integrated issue tracker, wiki, and forum in a single SQLite-backed file. Fossil collapses the forge + tracker + VCS split the rest of our bridges assume, so this single adapter covers whattools/github/+ a VCS shim cover separately.tools/vcs/withFossilBackendand a newcatsubcommand (file-at-version retrieval, implemented across Git, Mercurial, and Fossil).Type of change
.claude/skills/<name>/) — eval fixtures updated belowtools/<system>/*.md)tools/*/withpyproject.toml)docs/,README.md,CONTRIBUTING.md)projects/_template/)prek, workflows, validators)Test plan
prek run --all-filespassesuv run pytest/ruff check/mypypassesuv run --directory tools/fossil pytest— 15 passeduv run --directory tools/fossil ruff check— All checks passeduv run --directory tools/fossil mypy— Success: no issues found in 7 source filesuv run --directory tools/vcs pytest— 21 passed, 4 skipped (Mercurial skipped due to missinghg)uv run --directory tools/vcs ruff check— All checks passeduv run --directory tools/vcs mypy— Success: no issues found in 2 source filesuv run --directory tools/vendor-neutrality-score pytest— 27 passeduv run --directory tools/skill-and-tool-validator pytest -k test_real_repo_passes— 2 passedRFC-AI-0004 compliance
<PROJECT>,<tracker>,<upstream>,<security-list>) used in all skill / tool prose (thecheck-placeholdersprek hook is the mechanical gate)Linked issues
Closes #604
Notes for reviewers (optional)
sqlite3queries against the Fossil repository database (fast, offline, no network), but delegates write operations and artifact decompression to thefossilCLI binary. This avoids reimplementing Fossil's artifact format and hash verification while keeping reads instant.catsubcommand addition: Thecatcommand was added to the abstractVCSBackendinterface and implemented for all shipping backends (Git viagit show, Mercurial viahg cat, Fossil viafossil cat).Ufor user,Dfor date,Wfor subject,Ifor in-reply-to,Zas payload separator). The parser inforum.pyreconstructs thread hierarchies from these cards.