Skip to content

Fix archive guidance for greenfield spec sync#1233

Open
hutiefang76 wants to merge 1 commit into
Fission-AI:mainfrom
hutiefang76:codex/fix-archive-greenfield-spec-sync
Open

Fix archive guidance for greenfield spec sync#1233
hutiefang76 wants to merge 1 commit into
Fission-AI:mainfrom
hutiefang76:codex/fix-archive-greenfield-spec-sync

Conversation

@hutiefang76

@hutiefang76 hutiefang76 commented Jun 21, 2026

Copy link
Copy Markdown

Summary

  • Clarify archive workflow instructions so missing main specs are treated as unsynced greenfield capabilities
  • Tell archive skill and /opsx:archive command to create a new main spec from ADDED requirements during sync
  • Add template coverage to prevent regressions

Fixes #1222.

Tests

  • pnpm vitest run test/core/templates/skill-templates-parity.test.ts test/core/archive.test.ts
  • pnpm run build
  • pnpm run lint
  • pnpm test

Summary by CodeRabbit

  • Bug Fixes

    • Archive workflows now correctly handle missing main specification files by treating them as greenfield capabilities and creating new specifications during sync operations, rather than skipping or marking as already synced.
  • Tests

    • Added and updated test cases to verify proper handling of missing specification files in archive workflows.

@hutiefang76 hutiefang76 requested a review from TabishB as a code owner June 21, 2026 19:11
@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 09cd8d36-24d7-46fb-bdb1-fed90b1f962a

📥 Commits

Reviewing files that changed from the base of the PR and between 1b06fdd and 4cc6fe6.

📒 Files selected for processing (2)
  • src/core/templates/workflows/archive-change.ts
  • test/core/templates/skill-templates-parity.test.ts

📝 Walkthrough

Walkthrough

Instruction text in getArchiveChangeSkillTemplate and getOpsxArchiveCommandTemplate is updated to handle the case where openspec/specs/<capability>/spec.md is missing during delta-spec sync: the delta is now treated as an unsynced greenfield capability and a new main spec is created from ADDED requirements. Corresponding parity hashes and a new behavioral test are updated.

Changes

Greenfield main spec handling in archive workflow

Layer / File(s) Summary
Archive template greenfield instructions
src/core/templates/workflows/archive-change.ts
Adds four lines (two per template function) to the "Assess delta spec sync state" section of getArchiveChangeSkillTemplate and getOpsxArchiveCommandTemplate, directing that a missing openspec/specs/<capability>/spec.md must be treated as an unsynced greenfield and trigger new main spec creation rather than being skipped or considered already synced.
Parity hash updates and greenfield assertion test
test/core/templates/skill-templates-parity.test.ts
Updates expected SHA-256 hashes for getArchiveChangeSkillTemplate, getOpsxArchiveCommandTemplate, and the openspec-archive-change generated skill; adds a new it block that asserts both templates include missing-main-spec creation guidance and do not mark missing main specs as already synced.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Possibly related issues

  • #1222: Main spec is never created for the first change in a greenfield project — The template instruction changes directly address the reported behavior where archiving the first change in a new project never created the expected entry under /specs, by explicitly treating a missing main spec as an unsynced greenfield that should be created.

Possibly related PRs

  • Fission-AI/OpenSpec#450: Shares the same archive-change template and greenfield main spec creation path via openspec/specs/<capability>/spec.md.
  • Fission-AI/OpenSpec#452: Directly overlaps — adds "smart sync check" logic for /opsx:archive that treats a missing main spec as unsynced greenfield, the same behavior this PR encodes in the instruction text.
  • Fission-AI/OpenSpec#514: Both PRs modify the "Assess delta spec sync state" instructions in the opsx archive-related templates, addressing how missing main specs are described and handled.

Suggested reviewers

  • TabishB

🐰 A brand-new spec, nowhere in sight,
No folder, no file — but that's alright!
I'll treat it as greenfield, fresh as dew,
And build a main spec, shiny and new.
No skipping allowed when there's work to be done! 🌱

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix archive guidance for greenfield spec sync' directly describes the main change: updating archive guidance to properly handle greenfield projects with missing main specs.
Linked Issues check ✅ Passed The PR modifications address issue #1222's requirement to automatically create main specs during archive operations in greenfield projects instead of archiving to /changes/archive.
Out of Scope Changes check ✅ Passed All changes are directly scoped to updating archive template guidance and adding corresponding test coverage for greenfield spec sync behavior; no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Main spec is never created for the first change in a greenfield project

1 participant