feat(ui-core): useProjectReadiness — one answer to the journey's where-am-I (#288) - #294
Merged
Conversation
useProjectReadiness composes the three queries the project header already runs — active schema, project stats, batches — so it costs zero requests on the project screen, and it is the single spelling of "has a schema" from here on: the schema-less 404 is an answer, any other failure means the hook answers null rather than guessing. currentStep walks labels -> images -> annotate -> export; "done" is declared and waits on hasReleases and an ingest-in-flight signal, both recorded as out of v1.
This was referenced Aug 4, 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.
Closes #288.
First of the five journey-navigation PRs (#288–#292). Queries only — no UI consumes the hook yet.
What
useProjectReadiness(projectId)infrontend/ui-core/src/screens/queries.ts, exported fromindex.ts, composing the three queries the project header already runs:hasSchemaviauseActiveSchema, readingSCHEMA_NOT_FOUNDoff the error the wayProjectScreen'sSchemaSectiondoes — that 404 is an answer (hasSchema: false), any other failure means the hook answersnull. This is now the single spelling of "has a schema"; the three existing sites are deliberately untouched (new code uses the hook, old sites migrate as touched).hasAssets/hasAnnotations/annotatedPctfromuseProjectStats.hasBatchInAnnotationfromuseBatches, the header's own filter.currentStep:labels→images→annotate(nothing annotated or any batch not yetcompleted) →export."done"is declared but not yet derivable — a TODO records thathasReleases(two-hop dataset → releases) and ingest-in-flight (no project-scoped ingest-jobs hook on the wire client) are deliberately out of v1.The hook returns
nulluntil every source has answered — a checklist drawn from half an answer says something false with confidence.What it costs
Zero requests on the project screen: all three queries share their keys with the header's. Asserted, not claimed — the new test renders a header stand-in beside the hook and counts exactly three requests, none of them
/schema/versions(the history tab's fetch-on-open pin inscreens.test.tsxholds).Tests
New
frontend/ui-core/src/screens/readiness.test.tsx(7): one per step transition, theSCHEMA_NOT_FOUNDbranch, the real-failure-answers-null branch, and the request-count assertion. No existing test touched.bash scripts/check.sh frontend: All checks passed (ui-core 381 tests / 26 files, annotator + scripts suites included).