Repository navigation
feat(opencode): OC Kit installer, updater, registry client and doctor (Phase 7-8) - #12
Merged
Merged
Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
…(Phase 7-8) CI (typecheck + unit linux) caught schema and overload regressions in the Phase 7-8 installer workstream. Root causes: - `Schema.Literal(a, b, c)` resolves to the unary Decorator literal in effect@4.0.0-beta.83, narrowing each kind/mode/severity schema to its first value (fetch, production, pass). Switched to the array form `Schema.Literals([...])` (the repo-wide idiom) in DoctorItem, InstallerError, InstallSummary, UpdateError and ReleaseError. - `Effect.fn(function* (...) : Effect.Effect<...>)` return-type annotations are self-referential/unsupported for generators in beta.83. Removed them from collectFiles/downloadAndExtract/install/uninstall (installer), doctor (doctor), previewUpdate/update/rollback (updater) — bare Generator, matching merged-good Effect.fn usage. - `Effect.orElse` does not exist in beta.83; replaced the tar->unzip extraction fallback with `Effect.catch` (the repo's catch-style fallback). - `fetchJson` was escaping its payload type via `as never`; made it a generic factory over the decoded Schema so ReleaseInfo flows as a real typed value. - Tests: wrap plain-assertion it.effect bodies in Effect.gen, inject the fake HttpClient via the `http` option (no fragile Effect.provide layer), squeeze typed errors via Exit/Cause.squash. Verifies: checksum failures, dev mode, doctor warn items, and rollback/not-found errors now assert on the intended union kinds instead of the narrowed single literal.
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
- registry-remote: whenIncompatible returns ReleaseInfo | undefined; map HttpClientError to ReleaseError inside fetchJson/fetchText; guard pinned release info before returning incompatible error - installer: widen extract seam to FSUtil.Error; type walk closure; map download/extract/fs errors to InstallerError; uninstall uses OwnershipEntry - updater: map FSUtil and checkpoint errors to UpdateError across preview, update and rollback - registry-remote test: provide HttpClient via Effect.provideService instead of the http injection option so the effect has no service requirement
…ipeline - fetchText maps the response-body read to ReleaseError so resolveLatest callers never see HttpClientError in the error channel - extract error handler reads err.message only (both error types extend Error) - latestBackupDir reads dir entries via FSUtil (typed error) instead of a raw fs/promises readdir that inferred a never error channel
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
The update() calls in updater.test.ts were missing the extract option, causing the real extractArchive to run tar -xzf on stub data that is not gzip format. Pass fakeExtract(KIT_V2_FILES) to all update() calls that trigger archive extraction. Fixes 4 failing tests in PR #12: - ockit registry-remote > treats incompatible min_opencode as not-found - ockit updater > update with --dry-run previews without mutating - ockit updater > update replaces owned-unmodified files - ockit updater > rollback restores previous bytes The registry-remote test failure was a cascade from the updater tests running in the same turbo test suite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #8
Type of change
What does this PR do?
Implements the OC Kit install/update lifecycle (Phases 7-8) against a GitHub
Releases registry backend, plus a doctor health check.
src/ockit/registry-remote.ts— typed remote registry client: resolves thelatest compatible release (or an exact tag), reads checksums + kit manifest,
and guards
min_opencodecompatibility against the running runtime.src/ockit/installer.ts— install/uninstall: resolve → download → sha256verify → extract → ownership claim → write → checkpoint rollback snapshot.
src/ockit/updater.ts— update pipeline: detects user edits, plans replace/preserve/warn per file, applies only owned-unmodified replacements, and
rolls back to the latest checkpoint when asked.
src/ockit/doctor.ts— typedDoctorReportover runtime, config, installedkits, registry reachability, ownership conflicts, broken manifests, and
checkpoint count.
scripts/install.sh+scripts/install.ps1— single-command installers.test/ockit/{registry-remote,installer,updater,doctor}.test.ts— unit tests.Why this works:
Schema.TaggedErrorClasswith akinddiscriminator,and every FSUtil/HTTP/checkpoint error is collapsed to the module's domain
error so callers see one typed channel.
Process.run(spawn-backed) drives tar/unzip/Expand-Archive — noshellflag, so it passes the pinned
@types/buntypecheck.How did you verify your code works?
Unit tests added for release resolution/checksum/incompatible handling, the
install pipeline (checksum verify + ownership + dev mode), update planning
(user edits preserved, unmodified files replaced), rollback (restores previous
bytes), and doctor report sections. The full diff is
cb8f9df..HEADand CI(typecheck + unit linux) is the verification gate.
Screenshots / recordings
Not a UI change.
Checklist