Skip to content

feat(tools/fossil, tools/vcs): add Fossil forge bridge and VCS backend - #736

Merged
potiuk merged 6 commits into
apache:mainfrom
onlyarnav:fossil-scm
Jul 5, 2026
Merged

potiuk merged 6 commits into
apache:mainfrom
onlyarnav:fossil-scm

Conversation

@onlyarnav

Copy link
Copy Markdown
Member

Summary

  • Add 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 what tools/github/ + a VCS shim cover separately.
  • Extend tools/vcs/ with FossilBackend and a new cat subcommand (file-at-version retrieval, implemented across Git, Mercurial, and Fossil).
  • Motivation: Fossil is the home of SQLite, Tcl/Tk, and Fossil itself — projects that deliberately chose an all-in-one self-hosted tool over a forge. This closes the tracked extension point feat(tools/fossil): Fossil VCS + integrated-tracker bridge (SQLite, Tcl/Tk) #604 and moves Fossil from "tracked" to "shipping" in the adapter registry.

Type of change

  • Skill change (.claude/skills/<name>/) — eval fixtures updated below
  • Tool / bridge contract (tools/<system>/*.md)
  • Python package (tools/*/ with pyproject.toml)
  • Groovy reference impl
  • Cross-cutting (RFC, AGENTS.md, sandbox, privacy-LLM)
  • Documentation (docs/, README.md, CONTRIBUTING.md)
  • Project template (projects/_template/)
  • CI / dev loop (prek, workflows, validators)
  • Other:

Test plan

  • prek run --all-files passes
  • For Python packages touched: uv run pytest / ruff check / mypy passes
    • uv run --directory tools/fossil pytest — 15 passed
    • uv run --directory tools/fossil ruff check — All checks passed
    • uv run --directory tools/fossil mypy — Success: no issues found in 7 source files
    • uv run --directory tools/vcs pytest — 21 passed, 4 skipped (Mercurial skipped due to missing hg)
    • uv run --directory tools/vcs ruff check — All checks passed
    • uv run --directory tools/vcs mypy — Success: no issues found in 2 source files
    • uv run --directory tools/vendor-neutrality-score pytest — 27 passed
    • uv run --directory tools/skill-and-tool-validator pytest -k test_real_repo_passes — 2 passed
  • For Groovy bridges touched: command-line invocation tested end-to-end
  • For skill changes: eval suite passes for the affected skill
  • For skill behaviour changes: a new or updated eval fixture is included in this PR

RFC-AI-0004 compliance

  • HITL — any new mutation is gated on explicit user confirmation
  • Sandbox — no new unrestricted host access; network reach declared in the adapter
  • Vendor neutrality — placeholders (<PROJECT>, <tracker>, <upstream>, <security-list>) used in all skill / tool prose (the check-placeholders prek hook is the mechanical gate)
  • Conversational + correctable — agentic-override path documented if behaviour is adopter-tunable
  • Write-access discipline — no autonomous outbound messages; drafts only, sent on confirmation
  • Privacy LLM — private content does not reach a non-approved LLM; redactor invoked where needed

Linked issues

Closes #604

Notes for reviewers (optional)

  • Architecture choice: The bridge reads ticket metadata and forum posts via direct sqlite3 queries against the Fossil repository database (fast, offline, no network), but delegates write operations and artifact decompression to the fossil CLI binary. This avoids reimplementing Fossil's artifact format and hash verification while keeping reads instant.
  • cat subcommand addition: The cat command was added to the abstract VCSBackend interface and implemented for all shipping backends (Git via git show, Mercurial via hg cat, Fossil via fossil cat).
  • Forum artifact parsing: Fossil forum posts are stored as manifests with single-letter card prefixes (U for user, D for date, W for subject, I for in-reply-to, Z as payload separator). The parser in forum.py reconstructs thread hierarchies from these cards.

Comment thread tools/fossil/src/magpie_fossil/client.py Dismissed
Comment thread tools/fossil/src/magpie_fossil/forum.py Dismissed
Comment thread tools/fossil/src/magpie_fossil/forum.py Dismissed

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:88 and :132, and ticket.py:52 — bare except Exception: pass silently drops a failed fossil artifact read (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 NAME values are spliced positionally into the fossil argv, 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:70 and :85 — the SQLite conn.close() isn't in a with / 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.

@potiuk
potiuk merged commit b60382f into apache:main Jul 5, 2026
37 checks passed
@potiuk potiuk added contract:source-control Tool capability: branch / commit / diff / push (VCS) contract:tracker Tool capability: issue / board / label backend labels Sep 25, 2026
@potiuk potiuk added family:ci .github workflows, prek, validators family:docs Docs, MISSION.md, READMEs family:tools tools/* labels Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contract:source-control Tool capability: branch / commit / diff / push (VCS) contract:tracker Tool capability: issue / board / label backend family:ci .github workflows, prek, validators family:docs Docs, MISSION.md, READMEs family:tools tools/*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(tools/fossil): Fossil VCS + integrated-tracker bridge (SQLite, Tcl/Tk)

3 participants