-
Notifications
You must be signed in to change notification settings - Fork 4.8k
fix(tasks): keep tests and docs inside each task group #1955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@fission-ai/openspec": patch | ||
| --- | ||
|
|
||
| Task guidance now requires each task group to land its own tests and documentation updates instead of deferring them to a trailing group. The onboarding walkthrough teaches the same rule, and the published schema reference no longer quotes stale instruction text. |
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
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
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
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
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
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
63 changes: 63 additions & 0 deletions
63
test/core/templates/schema-docs-instruction-parity.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| import * as fs from 'node:fs'; | ||
| import * as path from 'node:path'; | ||
| import { describe, expect, it } from 'vitest'; | ||
|
|
||
| import { parseSchema } from '../../../src/core/artifact-graph/schema.js'; | ||
|
|
||
| // The published schema reference quotes every `spec-driven` instruction | ||
| // verbatim ("The instruction sent to the agent when it drafts this | ||
| // artifact"), so a reader can see exactly what their agent is told. Nothing | ||
| // regenerated that page, and it drifted: the `specs` block predated the | ||
| // store-aware main-spec paths (#1703) and the `tasks` block still taught the | ||
| // pre-#1660 rules, so the site contradicted the shipped instruction. This | ||
| // keeps the quoted blocks byte-identical to schema.yaml. | ||
| const REPO_ROOT = path.join(__dirname, '..', '..', '..'); | ||
| const SCHEMA_DIR = path.join(REPO_ROOT, 'schemas', 'spec-driven'); | ||
| const DOC_PATH = path.join( | ||
| REPO_ROOT, | ||
| 'docs-lab', | ||
| 'reference', | ||
| 'schemas', | ||
| 'spec-driven', | ||
| 'index.md' | ||
| ); | ||
|
|
||
| const normalize = (value: string): string => value.replace(/\r\n?/g, '\n').trim(); | ||
|
|
||
| // The fence length varies per block because an instruction may contain its own | ||
| // ``` example, so the outer fence has to be longer. | ||
| const QUOTED_INSTRUCTION = | ||
| /### Instructions\n\n[^\n]*\n\n(`{3,})md\n([\s\S]*?)\n\1\n/g; | ||
|
|
||
| describe('published schema reference', () => { | ||
| it('quotes every spec-driven instruction verbatim (#1952)', () => { | ||
| const schema = parseSchema( | ||
| fs.readFileSync(path.join(SCHEMA_DIR, 'schema.yaml'), 'utf-8') | ||
| ); | ||
| const doc = fs.readFileSync(DOC_PATH, 'utf-8').replace(/\r\n?/g, '\n'); | ||
|
|
||
| const quoted = [...doc.matchAll(QUOTED_INSTRUCTION)].map(match => match[2]); | ||
| const expected: Array<[string, string]> = [ | ||
| ...schema.artifacts.map( | ||
| (artifact): [string, string] => [artifact.id, artifact.instruction ?? ''] | ||
| ), | ||
| ['apply', schema.apply?.instruction ?? ''], | ||
| ]; | ||
|
|
||
| expect(quoted).toHaveLength(expected.length); | ||
| expected.forEach(([id, instruction], index) => { | ||
| expect(instruction, `${id} has no instruction to quote`).not.toBe(''); | ||
| expect(normalize(quoted[index]), `${id} instruction is stale in ${path.basename(DOC_PATH)}`).toBe( | ||
| normalize(instruction) | ||
| ); | ||
| }); | ||
| }); | ||
|
|
||
| it('keeps the tasks guidance on the published page (#1952)', () => { | ||
| const doc = fs.readFileSync(DOC_PATH, 'utf-8').replace(/\r\n?/g, '\n'); | ||
| expect(doc).toContain( | ||
| 'Each task group MUST land the tests and documentation its own work' | ||
| ); | ||
| expect(doc).toContain('Each task MUST state how to verify completion'); | ||
| }); | ||
| }); |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Make the worked example satisfy the per-group requirement.
Group 1 has no test or documentation task. Group 2 has a documentation task but no task that adds or updates tests. An agent can copy this example and violate the guidance above it.
Add explicit test and documentation tasks to each implementation group. Keep the final group limited to integration checks.
🤖 Prompt for AI Agents