Commit Graph
2 Commits
Author SHA1 Message Date
CatoandClaude Opus 5.5 de317a1120 Package updates arrive on their own, and you choose how (#1184)
* feat(packages): each project's update setting, applied to its Dependabot PRs

Package updates reach a project automatically by default, gated by its own
tests, with asking as an option. Loki is the policy layer only: Dependabot
proposes the pull requests and the fleet auto-merge sweep merges them.

- user_projects.package_updates: "auto" (default) | "ask" | "pinned". Values,
  labels and the one-line consequence of each are SSOT in
  src/config/package-updates.ts; an unknown stored value reads as "ask".
  No CHECK constraint, as for entities.auto_inject_mode_override (0023).
- package_update_requests: open Dependabot PRs that bump a fleet package —
  PR, head, packages (from -> to, breaking, fleet), checks state, state,
  whether Loki holds it, and the person's decision. project_packages.dep_name
  records the key package.json lists a package under, so an npm alias or a
  git dependency named by its key is matched back to the catalogue.
- Pure Dependabot parsing (single, grouped, `in /dir`, backticked shas, `v`
  tags) and breaking detection identical to the sweep's: a major, or a minor
  under 1.0; a version that is not semver counts as breaking.
- Enforcement as a pure decision table: hold when the setting is ask or
  pinned or the bump is breaking; lift only a hold Loki added; a hold a
  person added stays and blocks Loki's own merge; a hold someone takes off
  on GitHub is not put back and that PR is never merged by Loki.
- Decisions: Update (lift the hold; merge a breaking one once its checks are
  green, else on the next read), Not now (hidden 7 days), Stay on this
  version (@dependabot ignore this <part> version, per dependency in a
  group, close for a sha).
- The Phase 1 sync applies the setting after each good read, with the same
  token rules; the PR listing is a conditional request (304s are free).
- Cron sync-package-updates every 15 minutes, so a hold lands before the
  sweep merges a green PR. PATCH /api/projects/[id]/package-updates (owner
  only, applies at once when GitHub answers in time) and POST
  /api/packages/updates/[id] for a decision.
- Migration 0099 is additive: one new table, two new columns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf

* feat(packages): update setting, open updates and Approvals cards

- Project "Built from": the update setting as three choices (Automatic /
  Ask me / Stay on these versions) with what each will do written under it,
  and the rule none overrides (a breaking update always waits). A change
  says whether it reached the open updates already or will within 15
  minutes. Each package with an open update shows it under its row: the
  version it goes to, breaking, held for you / waiting on tests / ready,
  and the pull request.
- /packages/[slug]: the same line under each dependent project.
- /approvals: a Package updates card for every held update that needs the
  person — every update on "Ask me", breaking ones on "Automatic", none on
  "Stay on these versions". Project, packages from -> to, breaking, checks,
  why it is asking, link to the PR; Update / Not now / Stay on this
  version. A refusal stays on the card with the buttons; "no write access"
  comes with Connect GitHub. They name no private data, so they show behind
  the PIN too, and the "nothing waiting" empty state steps aside for them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf

* docs(packages): changelog entry and update settings in the Views table

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf

* fix(packages): read every repository once more to record dependency keys

Rows read before dep_name existed match update pull requests by catalogue
name only, and the sync skips a repository whose head and catalogue have
not moved — so for most projects they would have stayed that way. Folding
an observation version into the catalogue key invalidates that skip once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-14 03:05:48 -07:00
CatoandClaude Opus 5.5 064586c63b Packages: see what every project is built from (#1180)
* feat(packages): read what each project is built from

The fleet's shared-package catalogue is read from the fleet brief's one fetch
of bitbaum/fleet registers/packages.json (no second fetch; the snapshot now
carries the catalogue too). A new sync reads each project's package.json and
lockfile at its default-branch head through the existing GitHub token rules,
keeps the dependencies that are fleet packages (npm ranges, npm aliases, git
tags and shas, monorepo paths) and stores them as observations:

- project_packages: one row per (project, package) — spec, resolved version,
  source, commit, observed time
- project_package_scans: one row per project — last read, head sha,
  catalogue fingerprint, outcome — so an unchanged repo costs one request and
  a repo that could not be read keeps its rows and says why

POST /api/packages/sync reads all of the caller's projects (or one), four at
a time, never failing all for one. Latest versions come from npm or the
package repo's highest semver tag, cached, with a page deadline and the
register's version as a labelled fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf

* feat(packages): Packages pages and "Built from" on every project

- /packages (under Fleet): every fleet package with its latest version, how
  many of your projects use it and how many are behind; searchable
- /packages/[slug]: what it is, install command, repository, and your
  projects on it with version and status, behind first; an unlisted slug
  explains itself instead of 404ing
- Project Story tab: "Built from" lists the project's fleet packages with a
  behind badge linking to the package page
- Pages read the repositories again on arrival when the data is over six
  hours old; Refresh does it on demand; failed reads are named with a reason

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf

* docs(packages): changelog entry and the Packages view in CLAUDE.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M6u11m24oVkG98wAVbN7nf

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-14 01:57:07 -07:00