lore-forge/.ai/designs/forge-features.md

132 lines
6.4 KiB
Markdown

# Forge features
Status: the repository browser (phase 2) is built; locks and the rest are design only. Last
updated 2026-11-25.
These are phases 2 to 5 and are designed in less detail than identity. Each section says what
Lore provides for it; see [lore-integration.md](lore-integration.md) for what was verified.
## Repository browser (phase 2)
Built, with the desktop explorer's three tabs (`crates/forge-web/src/pages/browse.rs`):
- **Repository list** per owner, and a dashboard of the repositories a user can reach.
- **FILES:** directory listings at a branch tip or any revision, each entry with the revision
that last changed it; file views with line numbers. Text up to 512 KiB is shown; binary
files are named as such.
- **GRAPH:** the revision DAG across branches (the newest 50 revisions of up to 12 branches),
drawn with the desktop's lane layout as one SVG per row. Branch heads are tagged; merges are
hollow. Revisions are ordered so a child always precedes its parents, newest first.
- **TREE:** branches, the open branch's newest 50 revisions, and the open revision's changes.
What is open is in the URL, so it needs no script.
- **One revision:** message, author, parents, the changed files, and unified diffs of up to
30 text files of up to 256 KiB each.
Not built yet: paging further back than the newest revisions, diffs between two arbitrary
revisions, downloads, and entries inside linked repositories (shown, not opened).
**How it reads Lore.** Each page view gets a token from `Issuer::browse_token`: scoped to the
repository, carrying only `read`, valid one minute, refused if the viewer cannot read. With
it, lore-forge calls `loreserver`'s `RepositoryService.RepositoryGet` (default branch),
`RevisionService.BranchList` and `RevisionList`, `ThinClientService.RevisionInfo`,
`RevisionTree` and `RevisionDiff`, and fetches file content from loreserver's HTTP endpoint.
`ContentDiff` is unimplemented in Lore, so lore-forge diffs file content itself (`similar`).
`RevisionList` gives no messages or parents, so each listed revision costs one `RevisionInfo`
call, 16 at a time. See [lore-integration.md](lore-integration.md) for what was verified.
The endpoints are set with `LORE_FORGE_LORE_GRPC_URL` (default `http://127.0.0.1:41337`) and
`LORE_FORGE_LORE_HTTP_URL` (default `http://127.0.0.1:41339`). A deployment can point them at
a second, read-only `loreserver` to keep browsing load off the main server; that is untested.
## Locks (phase 2, extended in phase 5)
Locking is central to binary-asset workflows: two people should not edit the same asset.
- **Lock dashboard** per repository: who holds what, since when.
- **Release** a lock you hold; admins can release others'.
- **Live updates** from Lore's lock and unlock events.
Backed by `LockService`. Note that Lore's roadmap describes current locking as informing
rather than enforcing, with enforcement planned.
## Change requests (phase 3)
Lore has no forks yet, so change requests are **branch-based**: a change request proposes
landing one branch of a repository onto another branch of the same repository.
- **Open** a change request from a pushed branch.
- **Review:** comments on the change and on lines of a diff, approvals, requests for changes.
- **Updates:** pushing more revisions to the source branch updates the change request.
- **Checks:** external systems report status against the head revision (phase 4).
## Landing
Each branch is in one of two modes. This is a per-branch setting because branch protection in
Lore is per branch.
### Review required
- lore-forge protects the branch in Lore.
- lore-forge's own landing identity is the only holder of `push-protected` on the repository,
apart from service accounts explicitly given it.
- When a change request meets its requirements, lore-forge lands it with one call to Lore:
a branch push naming the source branch's head revision, with `fast_forward_merge` set so the
server attempts the merge if the target has moved.
- No hook or modified server is involved; the gate is enforced by who holds the permission.
If the server cannot merge, the author brings their branch up to date locally and pushes
again. How Lore reports that case is unverified.
### Direct push
- The branch stays unprotected; anyone with Writer access pushes to it.
- Each push appears in the activity feed.
- People can comment on a pushed revision after the fact.
This suits repositories of binary assets where work is trunk-based and coordinated by locks.
### Requirements for landing (to be designed)
Number of approvals, who may approve, required checks, and whether the author may land their
own change. Not yet decided.
## Activity and integrations (phases 2 and 4)
lore-forge subscribes to Lore's notification stream. Events available: branch created, branch
pushed, branch deleted, resource locked, resource unlocked, obliterate.
- **Activity feed** per repository, per owner and per user (phase 2).
- **Live page updates** through server-sent events (phase 2).
- **Webhooks:** outbound HTTP calls on events, configured per repository or organisation
(phase 4).
- **Discord notifications:** post events to a channel (phase 4).
- **CI:** webhooks trigger builds; a status API lets CI report results against a revision,
which change requests can require (phase 4).
Whether an external subscriber can use the notification stream in Lore's default configuration
is unverified.
## Game-development specifics (phase 5)
- **Asset previews:** images and textures first; thumbnails for `.uasset` files; 3D previews
later.
- **Image comparison** in diffs: side by side, swipe, onion skin.
- **Lock management** at scale: filters, bulk release for admins, stale-lock reports.
Untrusted content rules in [web-ui.md](web-ui.md) apply to every preview.
## Relationship to Epic's planned web client
Lore's roadmap commits to an open-source web client with code review tools in 2027. If it
ships with a review model of its own, lore-forge should prefer interoperating with it over
maintaining a parallel one. Until its shape is known, the change request design here stays
simple and close to what Lore's protocol already offers.
## Open questions
- Requirements for landing (approvals, checks, self-landing).
- Whether change requests need a "merge commit" style as well as fast-forward landing.
- How after-the-fact review on direct-push branches is surfaced: per revision, or grouped per
push.
- Search across repositories, change requests and comments.