Skip to content

Propose extending config injection to apply and archive.#1062

Open
showms wants to merge 9 commits into
Fission-AI:mainfrom
showms:feat/extend-config-injection-to-apply-archive
Open

Propose extending config injection to apply and archive.#1062
showms wants to merge 9 commits into
Fission-AI:mainfrom
showms:feat/extend-config-injection-to-apply-archive

Conversation

@showms
Copy link
Copy Markdown

@showms showms commented May 7, 2026

Problem

openspec/config.yaml supports context and rules, but rules are only applied when generating artifact instructions. They are not surfaced in apply / archive flows, so project-level guidance becomes inconsistent across the workflow.

Why this matters

Users expect project constraints defined in config to apply throughout the workflow, not only while generating artifacts. This is especially important for:

  • implementation constraints during apply
  • safety and process constraints during archive

In practice, this would make the workflow much more flexible. For example:

  • during apply, projects could specify execution guidance such as whether sub-agents are allowed, how much parallelization is appropriate, or what implementation constraints must still be followed
  • during archive, projects could specify post-archive follow-up steps such as documentation cleanup, knowledge base updates, release note preparation, or other housekeeping actions

Proposed change

Allow reserved rules targets for workflow phases:

  • rules.apply
  • rules.archive

Keep existing artifact keys unchanged.

Scope

This proposal would:

  • extend config validation to allow workflow phase targets
  • inject rules.apply into apply instructions
  • inject rules.archive into archive workflow instructions
  • update tests and config help text

It does not redesign the config format.

In this PR

This PR only adds the OpenSpec proposal scaffolding for discussion before implementation:

  • openspec/changes/extend-config-injection-to-apply-archive/.openspec.yaml
  • openspec/changes/extend-config-injection-to-apply-archive/proposal.md

Test plan

  • Created the change scaffold with the default spec-driven schema
  • Reviewed the proposal scope and backward-compatibility expectations
  • Confirmed this PR contains proposal files only
  • No runtime code changes in this PR, so no tests were run

Summary by CodeRabbit

  • New Features
    • Apply and Archive instruction outputs can include project-level context and workflow rules; added an Archive instructions command with JSON output (template, optional context, optional rules).
  • Documentation
    • Docs and config examples updated to show workflow rule keys (apply/archive) and how context/rules are injected and consumed.
  • Tests
    • Added unit and integration tests for instruction generation, rendering, validation, CLI JSON behavior, and warning deduplication.
  • Behavior
    • Workflow rule targets (apply/archive) accepted without artifact-ID warnings; unknown keys emit single-session warnings.

Keep the existing context and rules model, but make it available on the apply and archive instruction surfaces for proposal-first upstream discussion.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@showms showms requested a review from TabishB as a code owner May 7, 2026 03:36
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Extends project-level context and rules injection to apply/archive instruction outputs, adds openspec instructions archive and archive instruction generation/printing, recognizes rules.apply/rules.archive as workflow targets, updates templates/CLI/types, and adds tests/specs/docs.

Changes

Config Injection Extension

Layer / File(s) Summary
Proposal metadata
openspec/changes/extend-config-injection-to-apply-archive/.openspec.yaml
OpenSpec metadata file registers the proposal with schema: spec-driven and creation date.
Proposal & design docs
openspec/changes/extend-config-injection-to-apply-archive/proposal.md, design.md
Defines goals, scope, validation changes, WORKFLOW_RULE_TARGETS, instruction-generation contract, and implementation touchpoints.
Specs & docs
openspec/changes/.../specs/*, docs/opsx.md
Adds CLI archive-instructions spec, context/rules injection specs, opsx archive/bulk-archive requirements, and docs describing <project_context>/<rules> injection and workflow-phase keys.
Config & prompts
src/core/project-config.ts, src/core/config-prompts.ts, openspec/config.yaml
Adds WORKFLOW_RULE_TARGETS, updates serializeConfig prompts/examples, and sample config.yaml entries for rules.apply and rules.archive.
Instruction types & generation
src/commands/workflow/shared.ts, src/commands/workflow/instructions.ts
ApplyInstructions gains context? and rules?; adds ArchiveInstructions types, generateArchiveInstructions, archiveInstructionsCommand, and injects context/rules.apply into apply generation.
CLI routing & exports
src/cli/index.ts, src/commands/workflow/index.ts
Routes instructions archive to archiveInstructionsCommand and re-exports archiveInstructionsCommand and ArchiveInstructionsOptions.
Validation & loader
src/core/artifact-graph/instruction-loader.ts, src/core/project-config.ts
Centralizes config rule validation into emitConfigRuleWarnings(), accepts workflow targets as valid keys, and delegates warning dedupe to a session cache.
Templates & workflows
src/core/templates/workflows/*
Apply/archive/bulk-archive templates updated to fetch openspec instructions archive --json, apply returned context/rules as behavioral constraints (not copied), and renumber steps.
Tests & parity
test/**/*
Adds tests for generate/print apply/archive instructions, warning dedupe, CLI JSON output; updates template parity hashes.
Tasks / Rollout
openspec/changes/.../tasks.md
Checklist for validation, unit/integration tests, CLI wiring, template regeneration, and docs/examples updates.

Sequence Diagram(s)

sequenceDiagram
  participant CLI as CLI
  participant InstrMod as InstructionsModule
  participant ProjectCfg as ProjectConfig
  participant Validator as ConfigValidator
  CLI->>InstrMod: request apply/archive instructions (--json)
  InstrMod->>ProjectCfg: read config (context, rules)
  InstrMod->>Validator: emitConfigRuleWarnings(rules, validArtifactIds, schema)
  InstrMod->>InstrMod: build template + attach optional context/rules
  InstrMod->>CLI: return { template, context?, rules? }
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • TabishB
  • alfred-openspec

Poem

🐰 I hop through configs, tidy and bright,

I tuck context in instructions at night,
Apply and archive now hear rules I convey,
I whisper guidance, then bound on my way.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.10% 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 clearly and concisely summarizes the main change: extending config injection (context and rules) to apply and archive workflows. It directly relates to the primary purpose of the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
openspec/changes/extend-config-injection-to-apply-archive/proposal.md (3)

9-10: ⚡ Quick win

Document the config structure for workflow-specific rules.

The proposal mentions extending rules to provide workflow-specific guidance, but doesn't specify how users will structure their config. The PR description mentions rules.apply and rules.archive as reserved targets, but this detail should be documented in the proposal itself for implementation clarity.

📋 Suggested addition

Consider adding a subsection under "What Changes" that shows the config structure:

### Config Structure

Users will specify workflow-specific rules using reserved targets:
- `rules.apply`: guidance applied during `/opsx:apply` instruction generation
- `rules.archive`: guidance applied during `/opsx:archive` instruction generation
- Artifact keys (e.g., `rules.api`, `rules.workflow`) remain unchanged for backward compatibility
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openspec/changes/extend-config-injection-to-apply-archive/proposal.md` around
lines 9 - 10, Add a short "Config Structure" subsection under "What Changes"
that documents how to specify workflow-specific rules and context: explain that
`rules.apply` and `rules.archive` are reserved targets for guidance applied
during `/opsx:apply` and `/opsx:archive` instruction generation, that `context`
injection will make the existing project context available to `apply` and
`archive` workflows as well as artifact instructions, and note that existing
artifact keys like `rules.api` and `rules.workflow` remain supported for
backward compatibility.

7-14: 💤 Low value

Consider documenting validation and error handling expectations.

The proposal doesn't discuss how the system should handle invalid or conflicting rules (e.g., malformed rules.apply, conflicts between artifact and workflow rules). While not essential for initial proposal review, documenting these expectations would help guide implementation and testing.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openspec/changes/extend-config-injection-to-apply-archive/proposal.md` around
lines 7 - 14, Add a short section to the proposal describing validation and
error-handling expectations for the extended injection: specify schema/format
checks for rules (e.g., rules.apply), how to detect and report malformed rules,
precedence rules when workflow-level rules conflict with artifact-level rules,
and the expected runtime behavior (reject/ignore/merge) and error messages for
apply and archive instruction processing; reference the injected symbols
`context`, the `rules` object and `rules.apply`/`rules.archive` and state that
implementations must surface validation errors to callers and include
unit/integration test coverage for these cases.

26-31: ⚡ Quick win

Consider adding user-facing documentation to the impact list.

The impact section identifies implementation areas (config parsing, instruction generation, templates, tests) but doesn't mention user-facing documentation, examples, or migration guidance. Adding these would help users understand how to adopt the new workflow-specific rules.

📚 Suggested addition

Consider adding to the impact list:

- User documentation will need examples showing how to configure `rules.apply` 
  and `rules.archive` alongside existing artifact rules.
- Consider providing migration examples for teams currently restating guidance 
  across artifact instructions and manual apply/archive steps.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openspec/changes/extend-config-injection-to-apply-archive/proposal.md` around
lines 26 - 31, Add user-facing documentation and migration guidance to the
Impact list: update the Impact section to explicitly include user documentation,
examples, and migration notes showing how to configure rules.apply and
rules.archive alongside artifact rules, and where to find/update docs
(referencing changes in src/core/project-config.ts,
src/commands/workflow/instructions.ts, archive templates, and
src/core/config-prompts.ts); include example snippets and a short migration
guide for teams converting artifact-based guidance to workflow-specific rules so
docs, prompts, and tests reflect the new instruction surfaces.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@openspec/changes/extend-config-injection-to-apply-archive/proposal.md`:
- Around line 9-10: Add a short "Config Structure" subsection under "What
Changes" that documents how to specify workflow-specific rules and context:
explain that `rules.apply` and `rules.archive` are reserved targets for guidance
applied during `/opsx:apply` and `/opsx:archive` instruction generation, that
`context` injection will make the existing project context available to `apply`
and `archive` workflows as well as artifact instructions, and note that existing
artifact keys like `rules.api` and `rules.workflow` remain supported for
backward compatibility.
- Around line 7-14: Add a short section to the proposal describing validation
and error-handling expectations for the extended injection: specify
schema/format checks for rules (e.g., rules.apply), how to detect and report
malformed rules, precedence rules when workflow-level rules conflict with
artifact-level rules, and the expected runtime behavior (reject/ignore/merge)
and error messages for apply and archive instruction processing; reference the
injected symbols `context`, the `rules` object and `rules.apply`/`rules.archive`
and state that implementations must surface validation errors to callers and
include unit/integration test coverage for these cases.
- Around line 26-31: Add user-facing documentation and migration guidance to the
Impact list: update the Impact section to explicitly include user documentation,
examples, and migration notes showing how to configure rules.apply and
rules.archive alongside artifact rules, and where to find/update docs
(referencing changes in src/core/project-config.ts,
src/commands/workflow/instructions.ts, archive templates, and
src/core/config-prompts.ts); include example snippets and a short migration
guide for teams converting artifact-based guidance to workflow-specific rules so
docs, prompts, and tests reflect the new instruction surfaces.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9486a521-0d63-47ca-bf4f-329bc9133923

📥 Commits

Reviewing files that changed from the base of the PR and between 053d8a5 and b50f737.

📒 Files selected for processing (2)
  • openspec/changes/extend-config-injection-to-apply-archive/.openspec.yaml
  • openspec/changes/extend-config-injection-to-apply-archive/proposal.md

Document reserved apply and archive rule targets, validation expectations, and user-facing docs impact for the proposal discussion.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@showms
Copy link
Copy Markdown
Author

showms commented May 7, 2026

Updated the proposal to include the config structure, validation expectations, and docs/migration impact

Copy link
Copy Markdown
Collaborator

@alfred-openspec alfred-openspec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the right direction: workflow-phase guidance belongs on apply/archive, and proposal-only scope is a good way to settle the contract before implementation. I’d keep rules.apply and rules.archive as reserved workflow targets, but the implementation should avoid turning them into artifact-rule warnings and should keep the built-in apply/archive safety prompts higher priority than config guidance.

@showms
Copy link
Copy Markdown
Author

showms commented May 9, 2026

@alfred-openspec noted, proposal already captures both constraints

…kflows

Add WORKFLOW_RULE_TARGETS constant for 'apply' and 'archive'
Add openspec instructions archive command
Extend generateApplyInstructions with context and rules.apply
Update apply/archive/bulk-archive templates to consume injected config
Add workflow rule examples to generated config.yaml
Document rules.apply and rules.archive in opsx.md
Refs: openspec/changes/extend-config-injection-to-apply-archive
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/core/artifact-graph/instruction-loader.ts (1)

246-251: ⚡ Quick win

Consider eliminating the type assertion for better type safety.

The filtering logic is correct, but the type assertion (WORKFLOW_RULE_TARGETS as Set<string>) on line 248 bypasses TypeScript's type checking. Since WORKFLOW_RULE_TARGETS is defined as Set<WorkflowId>, the .has() method expects a WorkflowId, but receives an arbitrary string from Object.entries().

A cleaner approach would be to define WORKFLOW_RULE_TARGETS as Set<string> in project-config.ts:

export const WORKFLOW_RULE_TARGETS = new Set<string>(['apply', 'archive'] as const satisfies readonly WorkflowId[]);

This maintains compile-time checking that the values are valid WorkflowId literals while allowing runtime string comparison without type assertions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/artifact-graph/instruction-loader.ts` around lines 246 - 251, The
code uses a type assertion (WORKFLOW_RULE_TARGETS as Set<string>) to allow
.has(key) when filtering projectConfig.rules, which weakens type safety; change
the declaration of WORKFLOW_RULE_TARGETS in project-config.ts to be Set<string>
(e.g., construct it from readonly WorkflowId[] but typed Set<string>) so you can
call WORKFLOW_RULE_TARGETS.has(key) without assertions, then remove the cast in
instruction-loader.ts where artifactOnlyRules is built and keep the call into
validateConfigRules unchanged.
src/commands/workflow/instructions.ts (1)

497-499: 💤 Low value

Clarify the purpose of optional change validation.

The command validates that the change exists when provided, but generateArchiveInstructions (line 501) doesn't accept or use the change name. This validation appears to be either:

  1. A courtesy check to ensure the user is in the right context, or
  2. Future-proofing for change-specific archive logic not yet implemented.

If it's (1), consider adding a comment explaining the intent. If it's (2), consider whether the validation should be deferred until the feature is needed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/commands/workflow/instructions.ts` around lines 497 - 499, The optional
call to validateChangeExists(options.change, projectRoot) is ambiguous because
generateArchiveInstructions does not use the change name; either add a one-line
comment above this if-block clarifying that this is a courtesy/contextual
validation (i.e., "ensure provided change name exists so the user is in the
right context") or, if the intent is future change-specific logic, remove/defer
the validation until that feature is implemented; refer to validateChangeExists,
options.change and generateArchiveInstructions when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/commands/workflow/instructions.ts`:
- Around line 497-499: The optional call to validateChangeExists(options.change,
projectRoot) is ambiguous because generateArchiveInstructions does not use the
change name; either add a one-line comment above this if-block clarifying that
this is a courtesy/contextual validation (i.e., "ensure provided change name
exists so the user is in the right context") or, if the intent is future
change-specific logic, remove/defer the validation until that feature is
implemented; refer to validateChangeExists, options.change and
generateArchiveInstructions when making the change.

In `@src/core/artifact-graph/instruction-loader.ts`:
- Around line 246-251: The code uses a type assertion (WORKFLOW_RULE_TARGETS as
Set<string>) to allow .has(key) when filtering projectConfig.rules, which
weakens type safety; change the declaration of WORKFLOW_RULE_TARGETS in
project-config.ts to be Set<string> (e.g., construct it from readonly
WorkflowId[] but typed Set<string>) so you can call
WORKFLOW_RULE_TARGETS.has(key) without assertions, then remove the cast in
instruction-loader.ts where artifactOnlyRules is built and keep the call into
validateConfigRules unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 785f619e-962c-4b51-ac1c-a4d23b545921

📥 Commits

Reviewing files that changed from the base of the PR and between ecd5d38 and 21bfbe6.

📒 Files selected for processing (25)
  • docs/opsx.md
  • openspec/changes/extend-config-injection-to-apply-archive/design.md
  • openspec/changes/extend-config-injection-to-apply-archive/proposal.md
  • openspec/changes/extend-config-injection-to-apply-archive/specs/cli-archive-instructions/spec.md
  • openspec/changes/extend-config-injection-to-apply-archive/specs/cli-artifact-workflow/spec.md
  • openspec/changes/extend-config-injection-to-apply-archive/specs/context-injection/spec.md
  • openspec/changes/extend-config-injection-to-apply-archive/specs/opsx-archive-skill/spec.md
  • openspec/changes/extend-config-injection-to-apply-archive/specs/opsx-bulk-archive-skill/spec.md
  • openspec/changes/extend-config-injection-to-apply-archive/specs/rules-injection/spec.md
  • openspec/changes/extend-config-injection-to-apply-archive/tasks.md
  • openspec/config.yaml
  • src/cli/index.ts
  • src/commands/workflow/index.ts
  • src/commands/workflow/instructions.ts
  • src/commands/workflow/shared.ts
  • src/core/artifact-graph/instruction-loader.ts
  • src/core/config-prompts.ts
  • src/core/project-config.ts
  • src/core/templates/workflows/apply-change.ts
  • src/core/templates/workflows/archive-change.ts
  • src/core/templates/workflows/bulk-archive-change.ts
  • test/commands/apply-archive-instructions.test.ts
  • test/commands/artifact-workflow.test.ts
  • test/core/artifact-graph/instruction-loader.test.ts
  • test/core/templates/skill-templates-parity.test.ts
✅ Files skipped from review due to trivial changes (7)
  • src/commands/workflow/index.ts
  • openspec/changes/extend-config-injection-to-apply-archive/specs/cli-archive-instructions/spec.md
  • openspec/changes/extend-config-injection-to-apply-archive/specs/opsx-archive-skill/spec.md
  • src/core/config-prompts.ts
  • openspec/changes/extend-config-injection-to-apply-archive/specs/opsx-bulk-archive-skill/spec.md
  • docs/opsx.md
  • openspec/changes/extend-config-injection-to-apply-archive/tasks.md

@showms
Copy link
Copy Markdown
Author

showms commented May 11, 2026

Addressed — removed the type assertion for workflow rule targets, and added a comment clarifying the optional archive change validation

@showms
Copy link
Copy Markdown
Author

showms commented May 11, 2026

@TabishB @alfred-openspec Follow-up changes are pushed and the latest feedback is addressed. Would appreciate a review when you have a moment

@showms showms requested a review from alfred-openspec May 11, 2026 16:00
Copy link
Copy Markdown
Collaborator

@alfred-openspec alfred-openspec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this from proposal to implementation, the overall shape looks coherent and the test suite passes. I found one validation gap to fix before merge: apply/archive read config directly and do not warn on unknown rules.* keys, so config typos can be missed on the new workflow surfaces.

showms added 2 commits May 18, 2026 14:04
…xtend-config-injection-to-apply-archive

# Conflicts:
#	src/core/artifact-graph/instruction-loader.ts
#	test/core/templates/skill-templates-parity.test.ts
@showms
Copy link
Copy Markdown
Author

showms commented May 18, 2026

@alfred-openspec Thanks for the review — I addressed the validation gap in this update.

Changes made:

  • apply/archive instructions now validate rules.* keys against schema artifact IDs
  • reserved workflow targets apply and archive are accepted explicitly
  • added tests for warnings, valid workflow targets, and cross-path deduplication

@showms showms requested a review from alfred-openspec May 18, 2026 09:08
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/core/project-config.ts (1)

50-53: ⚡ Quick win

Make workflow targets immutable at the export boundary.

WORKFLOW_RULE_TARGETS is exported as a mutable Set, so any consumer can mutate validation behavior at runtime. Prefer exporting a read-only shape.

♻️ Suggested change
-export const WORKFLOW_RULE_TARGETS = new Set<string>([
-  'apply',
-  'archive',
-] as const satisfies readonly WorkflowId[]);
+const WORKFLOW_RULE_TARGETS_LIST = [
+  'apply',
+  'archive',
+] as const satisfies readonly WorkflowId[];
+
+export const WORKFLOW_RULE_TARGETS: ReadonlySet<string> = new Set(WORKFLOW_RULE_TARGETS_LIST);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/project-config.ts` around lines 50 - 53, WORKFLOW_RULE_TARGETS is
exported as a mutable Set; make the export read-only by replacing the exported
Set with an immutable readonly tuple/array so consumers cannot mutate validation
targets at runtime. Update WORKFLOW_RULE_TARGETS (the exported symbol) to a
const readonly structure, e.g. export const WORKFLOW_RULE_TARGETS = ['apply',
'archive'] as const satisfies readonly WorkflowId[] (or a
ReadonlyArray<WorkflowId>), and update any callers that relied on Set methods
(use includes or construct a local Set where needed).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@openspec/changes/extend-config-injection-to-apply-archive/specs/rules-injection/spec.md`:
- Line 78: Update the warning example string to match the implementation/tests
by replacing single quotes with double quotes; locate the example line
containing "Unknown key in rules: 'unknownkey'. Valid keys for schema
'spec-driven': apply, archive (workflow), design, proposal, specs, tasks
(artifact)" and change it so the unknown key and schema use double quotes
instead of single quotes to align formats used in tests.

---

Nitpick comments:
In `@src/core/project-config.ts`:
- Around line 50-53: WORKFLOW_RULE_TARGETS is exported as a mutable Set; make
the export read-only by replacing the exported Set with an immutable readonly
tuple/array so consumers cannot mutate validation targets at runtime. Update
WORKFLOW_RULE_TARGETS (the exported symbol) to a const readonly structure, e.g.
export const WORKFLOW_RULE_TARGETS = ['apply', 'archive'] as const satisfies
readonly WorkflowId[] (or a ReadonlyArray<WorkflowId>), and update any callers
that relied on Set methods (use includes or construct a local Set where needed).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 14838602-9ce3-4b36-8b19-ce1dd8810d84

📥 Commits

Reviewing files that changed from the base of the PR and between 3bfc5eb and 74f7ae6.

📒 Files selected for processing (22)
  • docs/opsx.md
  • openspec/changes/extend-config-injection-to-apply-archive/design.md
  • openspec/changes/extend-config-injection-to-apply-archive/specs/cli-archive-instructions/spec.md
  • openspec/changes/extend-config-injection-to-apply-archive/specs/context-injection/spec.md
  • openspec/changes/extend-config-injection-to-apply-archive/specs/opsx-archive-skill/spec.md
  • openspec/changes/extend-config-injection-to-apply-archive/specs/opsx-bulk-archive-skill/spec.md
  • openspec/changes/extend-config-injection-to-apply-archive/specs/rules-injection/spec.md
  • openspec/changes/extend-config-injection-to-apply-archive/tasks.md
  • openspec/config.yaml
  • src/cli/index.ts
  • src/commands/workflow/instructions.ts
  • src/commands/workflow/shared.ts
  • src/core/artifact-graph/instruction-loader.ts
  • src/core/project-config.ts
  • src/core/templates/workflows/apply-change.ts
  • src/core/templates/workflows/archive-change.ts
  • src/core/templates/workflows/bulk-archive-change.ts
  • test/commands/apply-archive-instructions.test.ts
  • test/commands/artifact-workflow.test.ts
  • test/core/artifact-graph/instruction-loader.test.ts
  • test/core/project-config.test.ts
  • test/core/templates/skill-templates-parity.test.ts
✅ Files skipped from review due to trivial changes (7)
  • openspec/changes/extend-config-injection-to-apply-archive/specs/opsx-bulk-archive-skill/spec.md
  • src/commands/workflow/shared.ts
  • openspec/changes/extend-config-injection-to-apply-archive/specs/opsx-archive-skill/spec.md
  • test/core/templates/skill-templates-parity.test.ts
  • openspec/changes/extend-config-injection-to-apply-archive/specs/context-injection/spec.md
  • openspec/changes/extend-config-injection-to-apply-archive/tasks.md
  • docs/opsx.md
🚧 Files skipped from review as they are similar to previous changes (9)
  • openspec/changes/extend-config-injection-to-apply-archive/specs/cli-archive-instructions/spec.md
  • src/core/templates/workflows/apply-change.ts
  • test/core/artifact-graph/instruction-loader.test.ts
  • openspec/config.yaml
  • src/cli/index.ts
  • test/commands/apply-archive-instructions.test.ts
  • test/commands/artifact-workflow.test.ts
  • src/core/templates/workflows/bulk-archive-change.ts
  • src/core/templates/workflows/archive-change.ts

@showms
Copy link
Copy Markdown
Author

showms commented May 19, 2026

Follow-up update: the validation-gap fix is in, and I also addressed the latest CodeRabbit follow-ups.

@alfred-openspec @TabishB would appreciate a re-review when convenient.

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.

2 participants