Artifact 52df539b99e0219d692ba7021aed56fb0caaac90d886b7295d6a9c184dd6e52e:
- File
CHANGELOG.md
— part of check-in
[7572f7d420]
at
2026-07-19 18:31:37
on branch trunk
— cli: add repo serve command wiring the xfer HTTP server (#72)
* cli: add repo serve command wiring the xfer HTTP server
Repo.ServeHTTP has always been public, but nothing in the CLI called it, so a repo created or cloned with this tool could only ever be a clone leaf. Add `libfossil repo serve` as a thin adapter: open the repo, build the bind address, translate process interrupt into the context cancellation ServeHTTP already honors, and call it. No new server or shutdown logic.
Binds to 127.0.0.1:8080 by default; --addr overrides host and/or port. Verified against a stock fossil client (canonical binary, not just this library's own transport) cloning over an actual TCP round trip.
* cli: address review nits on serve interop test
Document why TestRepoServeCmdRun and TestRepoServeCmdCanonicalFossilClone are allowed to send a real SIGINT to the test process (no t.Parallel(), no competing signal handlers in package cli_test), so a future test in this package doesn't silently break that assumption.
Also log the canonical fossil binary path and version the interop test actually exercised. A skip and a pass read identically in a non-verbose CI log; if the apt install step that puts fossil on PATH is ever removed or reordered, this line is what would tell us the test stopped proving anything instead of just staying green. (user: [email protected], size: 6817) [annotate] [blame] [check-ins using]
# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ### Added - `libfossil repo serve` CLI command wires the already-public `Repo.ServeHTTP` xfer HTTP server into the command surface. A repository created or cloned with this tool can now be served to a peer -- including a stock `fossil clone` -- without writing Go. Binds to `127.0.0.1:8080` by default; override with `--addr host:port`. Process interrupt (Ctrl-C/SIGTERM) cancels the same context `ServeHTTP` already shuts down on; no new shutdown mechanism was introduced. ### Changed - **Breaking:** `CloneOpts.ProjectCode` and `CloneOpts.ServerCode` have been removed. Neither was ever wired to anything — `Clone` accepted both fields but never forwarded them to the internal clone path, so setting either had no effect and gave no error. The internal clone options struct has no matching fields at all, so wiring them would mean designing semantics first (is a caller-supplied code a validation assertion or an identity override?) and no caller has asked for that. `CloneResult.ProjectCode` and `CloneResult.ServerCode` are unrelated and unaffected — they continue to report both, populated from the remote via the clone protocol negotiation, which is the only place they meaningfully originate. - **Breaking:** `UpdateOpts.Force` has been removed. It was never wired to anything — `Checkout.Update` accepted the field but never forwarded it to the internal update path, so setting it had no effect and gave no error. Deleting it is honest about what the API actually does; real forcing semantics for `Update` can be designed and added later as a new, deliberately-wired field if a caller needs them. `ExtractOpts.Force` is unrelated and unaffected — it is fully wired and unchanged. - **Breaking:** `Checkout.Update` now returns `(UpdateResult, error)` instead of a bare `error`. The internal 3-way merge already tracked which files were written, removed, and left with conflict markers; the old signature discarded all of it, so a caller could not tell a clean update from one that silently wrote `<<<<<<<` conflict markers into working-tree files. `UpdateResult.Conflicted` lists the paths that were merged but not cleanly — this is a successful update (`err == nil`), not an error; a genuine failure still returns a non-nil `error` with a zero-value `UpdateResult`. `Checkout.Extract` is unchanged. - **Breaking:** `Repo.Timeline` now enumerates the repository's `event` table newest-first (every event kind by default, or a single kind via `TimelineOpts.Type`), matching canonical `fossil timeline`. The previous behavior — a first-parent walk from a required start rid — is preserved under a new, honestly-named method, `Repo.Ancestry(LogOpts)`. The old `Repo.Timeline(LogOpts)` was actually an ancestry walk masquerading as an enumeration: it never visited a second parent or a sibling branch head, so it silently omitted any check-in that wasn't a first-parent ancestor of the given start rid. There is no deprecated shim; callers of the old `Timeline` should switch to `Ancestry` if they want the walk, or adopt the new `Timeline(TimelineOpts)` if they want a full enumeration. - `LogEntry` gains a `Kind` field (`EventKind`) identifying which of `event.type`'s six kinds (`ci`, `e`, `f`, `g`, `t`, `w`) an entry is. `Parents` is only populated for `Kind == EventKindCheckin`. - **Breaking:** `Repo.Timeline` orders by `(mtime DESC, rid DESC)`, a total order with rid as a true tie-break at exact mtime equality — a deliberate improvement over canonical fossil's bare `mtime DESC` with no tie-break, which can repeat or skip rows at a page boundary. Pagination uses a new opaque `Cursor` type: take one from a returned `LogEntry.Cursor` and pass it back as `TimelineOpts.After` to resume immediately after that entry. **`TimelineOpts.Before time.Time` and `TimelineOpts.After FslID` are deleted, not deprecated** — callers constructing either field will fail to compile. `Cursor`'s representation is intentionally hidden — it can only be obtained from a `LogEntry`, never built from a timestamp and a rid by hand, because a hand-built cursor derived from a rounded `time.Time` is not guaranteed to match its row exactly, which is what reintroduces skipped or duplicated rows at a page boundary in the first place. - **Breaking:** `LogEntry` no longer has a `Cursor` field, and `Repo.Timeline` now returns `[]TimelineEntry` instead of `[]LogEntry`. `LogEntry` is `Repo.Ancestry`'s result type; its cursor was always the zero value, which is structurally identical to a legitimate Timeline first-page call — so feeding an `Ancestry` entry's cursor into `TimelineOpts.After` silently paginated from page one forever with no error, and documenting the field as invalid on `Ancestry` entries did nothing to stop it. `TimelineEntry` (which embeds `LogEntry` and adds `Cursor Cursor`) is now `Repo.Timeline`'s result type, so the cursor lives only on the type that has one to give. Callers that read `entry.Cursor`, `entry.UUID`, `entry.User`, etc. off a `Repo.Timeline` result need no source change — those fields are still reachable through `TimelineEntry`'s embedded `LogEntry`. Callers that stored a `Repo.Timeline` result as `[]LogEntry` (rather than letting `:=` infer the type, or using `[]TimelineEntry`) will fail to compile. ## [0.1.0] - 2026-04-20 Initial open-source release of `libfossil`, a pure-Go implementation of the Fossil SCM that reads and writes the same `.fossil` SQLite repository format. ### Added - Repository lifecycle: create new repos and clone from existing ones. - Working-tree operations: checkout and checkin. - Timeline traversal over commits and events. - Merge and rebase primitives. - Diff and annotate (blame) over tracked content. - Manifest parsing and content-addressed blob storage. - Sync protocol client/server for pulling and pushing between repos. - Observer interfaces for sync and checkout, allowing external hooks into both network sync events and working-tree state transitions. - SQLite driver abstraction with support for both `modernc.org/sqlite` (pure Go) and `ncruces/go-sqlite3` (cgo-free, wasm-based) backends. - Deterministic simulation test harness with BUGGIFY-style fault injection for exercising concurrency and failure paths. - OpenTelemetry observer provided as a separate submodule to keep the core dependency footprint small. - `wasip1/wasm` build target for running `libfossil` under WASI runtimes.