fix(frontend): serve correct DAR package details from mock server - #294
Merged
Conversation
The DAR Manager package details panel (DARPackageTree) fetches /api/instances/:name/dar/:mainID/inspect, which the mock server serves from dar-inspect.json. That fixture used a stale schema that no longer matched DARInspectResponse, so the package tree rendered empty against the frontend mock server. Rewrite the fixture to the current shape (main/sha256/packages with package_id, lf_version, size_bytes, is_main and contents.modules with templates, interfaces and data_types) and fix the inspect handler to override 'main' instead of the removed 'dar_id' field.
Clicking a package opens the inspect drawer, which renders VettingPanel. It reads data.participants from the vetting endpoint, but the mock dar-vetting.json fixture used a stale schema (dar_id + roles) instead of DARVettingResponse (instance/main/participants), so state.rows was undefined and .map threw a render TypeError. Rewrite the fixture to the participants shape with all three roles, and align the vetting GET/POST handlers to override 'main' and return the DARVettingToggleResponse shape instead of the removed 'dar_id' field.
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.
Summary
The DAR Manager "package details" panel (
DARPackageTree) fetches/api/instances/:name/dar/:mainID/inspect, which the Vite mock server serves fromfrontend/mock/fixtures/dar-inspect.json. That fixture used a stale schema that no longer matchedDARInspectResponse(frontend/src/api.ts), so the package tree rendered empty/broken when running against the frontend mock server.Changes
frontend/mock/fixtures/dar-inspect.json: Rewrite to the currentDARInspectResponseshape — top-levelmain/name/version/sha256, andpackages[]withpackage_id,lf_version,size_bytes,is_main, andcontents.modules[](templates with choices, interfaces with choices/methods, and data_types). Includes one main package plus two dependency packages so the tree, chips, andNT · NI · NDcounts render meaningfully.frontend/mock/router.ts: The/dar/:id/inspecthandler overrode the removeddar_idfield; now it overridesmainto match the requested id.Verification
vitest run mock/router.test.ts mock/seed.test.ts src/screens/DARScreen.test.tsx→ 15 passed.