Repository navigation
Fix /today 500: tolerate string-shaped progressedSinceLastRun - #989
Merged
Merged
Conversation
The orchestrator publishes each goal's progressedSinceLastRun as a single string, but todayFromSection passed it straight into ProjectMomentum.accomplished (string[]) and renderToday called .map on it, crashing the /today HTML render (the JSON twin was fine). - derive.ts: normalize at the boundary via asStringList() — array stays a list, a non-empty string becomes [string], anything else []. - render.ts: renderToday defensively coerces a non-array accomplished (entries via String()) so rendering can never crash on this shape again. - test/slice2.test.ts: regression tests for both the derive boundary (string-shaped section renders) and the render guard.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Caution Review failedThe pull request is closed. Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Oct 27, 2026
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.
Problem
/todayreturned HTTP 500 while/api/today.jsonworked. The orchestrator publishesorchestration.jsonwith each goal'sprogressedSinceLastRunas a single string, but the aggregator declared/consumed it asstring[]:todayFromSection(src/derive.ts) passed it straight intoProjectMomentum.accomplishedrenderToday(src/render.ts) called(m.accomplished ?? []).map(...)on the string → TypeError → the HTML render path crashedFix (aggregator side only; the publisher side is handled separately)
src/derive.ts— boundary normalization intodayFromSectionvia a newasStringList()helper: an array stays a list (entries viaString()), a non-empty string becomes[string], anything else becomes[]. This is the only placeprogressedSinceLastRunis consumed (verified by grep — the only otheraccomplishedproducer,deriveToday's board path, already builds a realstring[]), so downstream consumers can trust the shape.src/render.ts—renderTodaydefensively coerces a non-arrayaccomplished(wraps it, entries viaString()) so aTodayViewbuilt outside the derive boundary can never crash rendering again.Tests
test/slice2.test.ts: two regression tests in the existing today-view suite —progressedSinceLastRunas a string produces aTodayViewwithaccomplished == [that string]andrenderTodayrenders it under "Recently accomplished";renderTodaygiven aTodayViewwith a bare-stringaccomplishedrenders instead of throwing.bun test test/slice2.test.ts test/orchestration.test.ts— 23 pass, 0 fail.bun run typecheck(tsc --noEmit) — clean.Note for local runs: the fixtures import
pm-stack/grist/seed/roadmap.json, so the sparse checkout needspm-stack/gristalongsidepm-stack/aggregatorfor the slice2 tests to load.Need help on this PR? Tag
@codesmith-botwith what you need.