Repository navigation
fix(dashboard): render a packet whose links object omits some arrays - #163
Merged
Merged
Conversation
`buildDashboardModel` fell back to a default `links` only when the whole object was absent. A packet whose `links` is present but omits `sessionRefs` or `artifactRefs` therefore reached `links.artifactRefs.length` and threw, taking down the entire Dashboard render instead of a single panel. The shape is reachable: `validateTaskEvidencePacket` builds its `links` key list without a `required` set and discards what `normalizeLinks` returns, so a partial `links` object passes validation. Default each array and let any supplied value win, which keeps an optional `projectRef` flowing through as before. Validated with the harness-ui typecheck and its full 58-test suite; the new test reports the TypeError before the change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change is small, targeted to the reported crash, and includes a regression test that exercises the previously failing input shape.
Pull request overview
This PR hardens the Dashboard projection against task-evidence packets whose links object is present but omits one or more of the expected reference arrays, preventing a runtime TypeError during model construction and keeping the Dashboard render resilient.
Changes:
- Default
sessionRefs,commitRefs, andartifactRefsindividually when building the Dashboard model, while preserving any providedlinksvalues. - Add a regression test ensuring a stored packet with a partial
linksobject projects successfully and yields empty arrays for missing link fields.
File summaries
| File | Description |
|---|---|
| packages/harness-ui/lib/dashboard-model.ts | Makes links.*Refs safe to dereference by defaulting missing arrays when projecting evidence deliveries. |
| packages/harness-ui/test/dashboard-model.test.mjs | Adds a regression test covering the partial-links packet shape and asserting the projected links arrays are always present. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
What
buildDashboardModelfell back to a defaultlinksonly when the whole object was absent. A packet whoselinksis present but omitssessionRefsorartifactRefstherefore reachedlinks.artifactRefs.lengthand threw:The throw happens while building the model, so one such packet takes down the entire Dashboard render rather than degrading a single panel.
Why the shape is reachable
validateTaskEvidencePacketadmits it. Atscripts/task-evidence-upload/contract.mjs:492-495the packet validator callsnormalizeLinks, butnormalizeLinksbuilds its key list with{ optional: [...] }and norequired, so alinksobject containing only some of the arrays passes validation. The call's result is discarded, so nothing materializes the missing arrays either.createTaskEvidencePacketalways writes all three, but the read path does not require them.The regression test asserts that acceptance explicitly, so the precondition is pinned rather than assumed.
The change
Default each array and let any supplied value win, which also keeps an optional
projectRefflowing through as before. One production file.Validation
a stored packet with a partial links object does not break the Dashboard projection— reports theTypeErrorabove before the change.packages/harness-ui:tsc --noEmitexit 0; full vitest suite 58/58 passed, exit 0.