Repository navigation
fix(research-workflow): scaffold() validates the --outline JSON shape (#6862) - #7015
Merged
Merged
Conversation
…#6862) load_outline() rejects a non-object top level, a non-JSON body, non-string title/introduction, non-object concept entries, and non-string concept slug/summary via fail() naming the outline file and field, before any package directory is created. Seven regression tests pin each wrong shape and assert no partial writes; a valid outline is unchanged (suite: 66 tests OK on the laptop).
developing-today
Bot
requested review from
a team and
dezren39
as code owners
November 8, 2026 00:55
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
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.
Fixes #6862. Queue task 11095.
Problem
scripts/research_workflow.pyscaffold()read theinit --outlinefile with a barejson.loadsand used its fields raw: a non-object top level and non-object concept entries raisedAttributeError, non-string title/slug raisedTypeErrorfrom therefunctions, a non-string summary raised a concatenationTypeError, and a non-JSON outline raised aJSONDecodeErrornaming no file — none of them the tool'sfail()diagnostic naming the file and field.Change
load_outline(path)helper, used byscaffold()for the--outlinefile: wrapsjson.loads(non-JSON →fail()naming the file), then validates shape before any package directory is created:title/introduction, when present, must be strings;slug/summary, when present, must be strings.Every rejection is
fail("Outline <file> ... field '<name>' must be a string")-shaped — the file and the field/expectation are always named.scripts/tests/test_research_workflow.py(one per wrong shape, incl. the non-JSON body written raw) assert the cleanerror:diagnostic contains the outline file name and the expectation, and that the tree snapshot is unchanged (no partial package).Out of scope per the packet: profile/state/trigger shapes (#6854), items manifest shapes (#6856), note/resolution shapes (#6857),
dependencies()edge shapes.Tests
python3 -m unittest scripts.tests.test_research_workflowon the laptop: 66 tests OK (59 existing + 7 new). A valid outline flows through the same code paths as before (validation only adds rejections of shapes that previously crashed), and the existing suite covering valid outlines stays green.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.