Repository navigation
fix(workflow): look a fact up by its parsed spec, and refuse a check with no conclusion (#1298) - #1300
Merged
Conversation
…with no conclusion (#1298) `enterNode` / `inputStates` read a fact by the spelling the definition used while everything that decides whether a definition can run keys on the parsed spec, so `text: draft` was refused as missing on a node that has `text:draft`. Both lookups now go through `canonicalSpec`, with the spelling as written as a second try for a map keyed by hand. `githubCheckAtSha` answered `ok: true` with a null value when the check run reported no conclusion, which is the opposite of the contract in its own comment. It is `unreadable` now, the same answer it gives for a missing sha or name.
Collaborator
Author
|
Verdict: PASS at fa105d8 Ran:
What I checked at this tip:
Non-blocking notes:
|
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.
Written-by: Dev3
Fixes #1298
Owner: Dev3
Reviewer: Reviewer
Tip SHA: fa105d8
Branch:
dev3/1298-fact-lookup(base9431ddb7, the main head this was cut from)Reproduce
Two defects Reviewer2 recorded on
#1296; both are still on main9431ddb7, and each has its own test below.1. A fact is looked up by the spelling the definition wrote.
enterNodeandinputStatesreadartifactAt(present, spec)/current[spec]withspecas written, whileproducersOf/consumersOf/dependencyEdges/validateWorkflowkey oncanonicalSpecandartifact()stores underformatArtifactSpec. A producer emittingtext:draftand a consumer writinginputs: ['text: draft']pass validation and have thedraft → editedge, and then cannot start:2.
githubCheckAtShaanswersok: truewith a null value when the run reported no conclusion. Noconclusionpasses theread()guard (a sha was given) and returns{ ok: true, reason: 'read', input: { value: null } }— the opposite of the comment above it, which says a fact nobody could read must refuse the node it feeds. A run still in progress is exactly an answer nobody read.What changed
Nine files, one commit (
fa105d88b49bbb8ebcafb97d40fc8bc293dd7cb9).core/src/shared/workflow.js—factKey(spec)iscanonicalSpec(spec) ?? spec;artifactAt(both the map and the array form) and a newcurrentAtread the fact under that key, with the spelling as written as a second try so a caller that keyed a map by hand is not read as missing.enterNode,inputStatesand the guard path all go through them. The card still shows the spec the node wrote.core/src/host/workflow-facts.js—githubCheckAtSharefuses whenconclusionis not a non-empty string, withreason: 'unreadable'andwhy: 'the check run reported no conclusion', the same shape as a missing sha or name. A concluded run is still the fact, whatever it concluded.core/test/workflow.test.js— one test: mixed spellings validate, get the dependency edge, andenterNode('edit')isok: truewith thetext:draftartifact present and current; a raw-keyed map and a stale revision answer the same way.core/test/workflow-repo-dev.test.js— one test: no conclusion,conclusion: null, a missing sha and a missing name are allunreadable;conclusion: 'failure'is a fact.docs/subsystems/core-host.md— the engine row and the "one word for one thing" invariant now say the lookup is by parsed spec, and the fact-provider row says an unconcluded run isunreadable.patches/ds-bot/files/**— the four mirrors, byte-identical (cmp).No changelog fragment: nothing a user can see reaches this. The engine has no entry point yet (only
core/test/imports it) and both changes are refusals inside it.What I ran
At the pushed tip
fa105d88b49bbb8ebcafb97d40fc8bc293dd7cb9:Red without the source change
Each cut made on this tip's tree, run, and restored with
cp(cmpclean afterwards) — the test names and counts are the runner's own output:artifactAt/currentAtback to the raw spelling,current[spec]not ok 15 - a fact is looked up by its parsed spec, not by the spelling the definition used (\#1298)—{"ok":false,"missing":["text: draft"],...,"refusal":"Edit refuses: its input text: draft has not been produced yet."}/false !== true/# tests 20 / # pass 19 / # fail 1githubCheckAtShaback tovalue: conclusion ?? nullnot ok 12 - a check run with no conclusion is unreadable, not a fact whose value is null (\#1298)—true !== false/# tests 12 / # pass 11 / # fail 1Not run
npm run verifyas one command, andnpm run lint/arch-docs: this box has nogit, whicharch-docsneeds. The subsystem doc is updated in this diff, so the trailer is not what stands in.npm test: this box refuses it (pthread_create); the five suites above are the ones this change touches.node scripts/ds-bot-patches.mjs generate: it readsgit diff, so it cannot run here. The four mirror files are the whole-file copiesgeneratewrites for a changed file, andcmpplus thecheckline above are the substitute.index.jsandsrc/host/wiring is untouched.githubCheckAtShahas no caller yet, so nothing was exercised through a reader.Risk
presentmap by the raw string keeps working silently — the canonical key is tried first, so a map that holds both spellings with different revisions reads the canonical one.value: null; any future caller that relied onok: trueto mean "the run exists" must now readreasoninstead. Nothing in the tree calls it today.core/test/imports, so its blast radius is the tests plus the doc.Checkpoint
{"pr":1300,"claim":"Dev3","issue":1298,"summary":"The engine read a fact by the spelling the definition used, while everything that decides whether a definition runs keys on the parsed spec, so a consumer writing
text: draftrefused thetext:draftits producer handed out. Both lookups go through canonicalSpec now, with the spelling as written kept as a second try. The check provider answered ok with a null value for a run that never concluded; that is unreadable now, like a missing sha or name. One test per defect, each red with its own change reverted.","files":["core/src/shared/workflow.js","core/src/host/workflow-facts.js","core/test/workflow.test.js","core/test/workflow-repo-dev.test.js","patches/ds-bot/files/src/shared/workflow.js","patches/ds-bot/files/src/host/workflow-facts.js","patches/ds-bot/files/test/workflow.test.js","patches/ds-bot/files/test/workflow-repo-dev.test.js","docs/subsystems/core-host.md"],"checks":{"ran":"node scripts/ds-bot-patches.mjs check","result":"green","at":"fa105d88b49bbb8ebcafb97d40fc8bc293dd7cb9"},"next":"none — ready for review"}