Files
Dario LipicarandClaude Opus 4.7 c2e8513d32 Multi-repo IPC surface + resolveDependencies preview (#5)
* wip: remove legacy releaseTag methods (uncommitted snapshot)

Local-only commit so nix path: overrides can pick up the changes.

* fix: attribute resolver-fence failures to the requested package(s)

When resolveDependenciesJson throws before emitting any per-entry
output (e.g. a type_error from an older index), the exception fence
produced a nameless { "error" } row. The UI keys install/Failed
badges by package name, so a nameless row silently no-ops the model
update and the row reverts to "Not Installed" with no error shown.

Parse the requested top-level names up front and emit one error row
per requested package; also attribute an unattributed in-loop error
row to the sole requested package when there is exactly one.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ipc: expose resolveDependencies(deps, installed) — preview, no download

New SLOT that runs the lib's resolveDependenciesJson and returns the
resolved entries WITHOUT triggering downloads. Pair to
downloadResolvedDependencies for callers that want to preview the
dep impact first (the new package_manager_ui per-row dep-confirm
flow: "you clicked Install on wallet_module — that also brings in
foo@1.2.0 and bar@0.5.0, OK?").

`installedPackagesJson` (same shape as
package_manager.getInstalledPackages) lets the resolver short-circuit
transitive deps already satisfied on disk so the preview only
surfaces actual changes. Pass empty to get every transitive resolved
from the catalog.

The declaration is on ONE line — the codegen's --from-header parser
scans line-by-line and silently drops wrapped declarations. The
single-line constraint is documented in impl.h itself; I just
re-learned it the hard way.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* review: address PR #5 feedback

- onContextReady(): allocate the replacement PackageDownloaderLib
  BEFORE deleting the old one, so a throwing constructor (e.g.
  bad_alloc) can't leave m_lib dangling for the destructor to
  double-free.
- defaultConfigPath(): the no-XDG/no-HOME fallback produced
  `<tmp>/logos/logos/package-downloader/…` (double `logos`); the temp
  branch already includes a `logos` segment, so return directly
  without appending another. Now consistent with the XDG/HOME branches.
- Add `#include <utility>` for std::move (was relying on a transitive
  include).
- Comment cleanup flagged in review: file header no longer claims the
  removed legacy single-repo/release-tag API; the pinnedDownload helper
  comment points at its real callers (downloadPinned /
  downloadResolvedDependencies); the constructor comment says
  onContextReady() not onInit(); the exception-fence comment describes
  the fence in place rather than referencing the removed
  downloadPackages.

Verified: `ws build logos-package-downloader-module` green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs: README to the multi-repo IPC surface

Replace the removed legacy API table (releaseTag-based getPackages /
getCategories / getReleases / downloadPackages) with the current
methods: repository management (add/remove/setEnabled/list/refresh),
getCatalog / getCatalogForRepo, resolveDependencies (preview),
downloadResolvedDependencies, and downloadPinned. Usage example updated
to the add-repo → resolve → download flow. Links the catalog-format
spec.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* bump flake.lock

* test: unit tests for PackageDownloaderImpl (link-time-mocked lib)

Mirror the logos-package-manager-module test setup, using
logos-test-framework. The real network/disk-backed
lgpd::PackageDownloaderLib is replaced at link time by
tests/mocks/mock_package_downloader_lib.cpp; tests/stubs/package_downloader_lib.h
declares the subset of the lib surface the impl uses, so the bridge
compiles without the real library. Each mocked method returns a JSON
string configured per-test via LogosCMockStore, so no struct
registries are needed (every lib method the impl calls returns JSON).

17 tests cover the bridge's own logic:
  - repo management (add/remove/setEnabled) success + error shaping
  - listRepositories / getCatalog / getCatalogForRepo JSON parse
  - refreshCatalog success + error
  - resolveDependencies pass-through + "no download" guarantee
  - resolveDependencies malformed-output → per-request error attribution
  - downloadPinned success (path) + failure (empty path → error row)
  - downloadResolvedDependencies: per-entry download, unnamed-resolver-
    error attribution to the single requested package, and the
    exception-fence per-request error rows

Wiring: tests/CMakeLists.txt uses logos_test() (MOCK_C_SOURCES +
EXTRA_INCLUDES stubs); flake.nix gains a `tests` block
(dir + mockCLibs = ["package_downloader"]). Exposed as
checks.<system>.unit-tests.

Verified: 17/17 pass via the unit-tests check (built against the
bumped logos-cpp-sdk that ships logos_module_context.h).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ci: build module + run unit tests

Add a CI workflow mirroring logos-package-manager-module: on PRs and
pushes to master/main, build the module (`nix build -L`) and run the
unit-test suite (`nix build .#unit-tests -L`) on ubuntu + macos, with
the logos-co Cachix cache. Surfaces the new PackageDownloaderImpl tests
in CI.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-02 16:33:40 -03:00
..