Skip to content

refactor(config): stop writing modules; drop the legacy fields (CORE-189) [v0.21.0] - #402

Merged
PrzemekGalarowicz merged 1 commit into
mainfrom
przemek/core-189-c64-stop-writing-modules-legacy-fields
Nov 17, 2026
Merged

PrzemekGalarowicz merged 1 commit into
mainfrom
przemek/core-189-c64-stop-writing-modules-legacy-fields

Conversation

@PrzemekGalarowicz

@PrzemekGalarowicz PrzemekGalarowicz commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Ships in v0.21.0. Now unblocked: v0.20.0 is released (#403, tag v0.20.0), so the support window (current + previous minor) is 0.20.x + 0.21.x once this ships, and 0.20.0 is the first CLI that reads a config without modules (0.19.x reads one as no config).

Rebased onto main after the v0.20.0 release. The two CHANGELOG lines now sit under the new, empty ## [Unreleased] (their own ### Changed / ### Removed); the [0.20.0] section is byte-identical to main's.

What

The v0.21.0 half of CORE-189 (C6.4, epic CORE-155). #395 did the v0.20.0 half.

  • init no longer writes "modules": [] (src/steps/install-archetype.ts).
  • writePharnConfig drops every key only older CLIs wrote — modules, constitution, isMultiTenant, stackAnswers, installedSkills — so the first config write by init, add, remove or update removes them. Readers (list, status, every --dry-run) leave the file as found.
  • A config that still carries them loads in every command, unchanged: the load guard still accepts a modules array (so a pre-archetype config still reaches the "re-run pharn init" message) or a capabilities key.
  • The names stay pharn-owned via the new LEGACY_CONFIG_KEYS (src/lib/pharn-config.ts), spread into CLI_OWNED_KEYS, so userOwnedConfigEntries never carries one over as the user's.
  • PharnConfig.modules and LegacyConfigFields leave src/types.ts.

Why

0.19.x reads a config without a modules array as absent, so init kept writing it while 0.19 was in the support window. From v0.21.0 the window is 0.20.x + 0.21.x, and 0.20.0 is the first CLI that reads a config without modules.

Decision: the legacy keys are dropped on write, not carried verbatim. They are CLI-owned and nothing reads them, so dropping them loses no user data and finishes the retirement in one step.

Docs

  • docs/reference/pharn-config.md: modules leaves the top-level table and the example; "Fields older CLIs wrote" says they load but are no longer written, and that 0.20.0 is the oldest CLI that can read a new config.
  • docs/commands/init.md: modules: [] leaves the written-fields list.
  • docs/contributing.md (C6.4 v0.21.0 shim row → "Removed: …", window paragraph) and docs/support-policy.md (v0.21.0 row).
  • CHANGELOG: ### Changed "New configs no longer carry modules; pharn 0.20.0 is the oldest CLI that can read them" and ### Removed naming 0.20.x as the last CLI that wrote modules.

Tests

No test or test title deleted. Tests that pinned modules: [] in a new config now assert its absence (init.test.ts, add.test.ts); typed PharnConfig fixtures lose the key. Round-trip tests in pharn-config.test.ts now round-trip a current archetype config, and the legacy ones write the old config as raw bytes, then assert the write drops the keys. New: init.test.ts "an old config with modules and the legacy fields loads in every command, and a write drops them" (status, list, update --dry-run, init --dry-run, then add, remove, re-run init, update, uninstall).

Verified

After the rebase: CI=1 npm run check green (3704 passed, 1 skipped), npm run build green. Before it: npm run test:coverage green (pharn-config.ts 98.46/97.02/100/99.11).

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 53 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 6f229a6 and e384366.

Files selected for processing: 17

  • CHANGELOG.md
  • docs/commands/init.md
  • docs/contributing.md
  • docs/reference/pharn-config.md
  • docs/support-policy.md
  • src/lib/pharn-config.ts
  • src/steps/install-archetype.ts
  • src/types.ts
  • tests/commands/add.test.ts
  • tests/commands/init.test.ts
  • tests/commands/list.test.ts
  • tests/commands/uninstall.test.ts
  • tests/layout.test.ts
  • tests/pharn-config.test.ts
  • tests/status-report.test.ts
  • tests/update-next.test.ts
  • tests/update-plan.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

Copy link
Copy Markdown

pharn

🛡️ pharn-ci · ✅ Pass

Tip

Pass · Diff coverage of this change is 100% against a threshold of 80%; 29 agent setup files found.

Verdict Diff coverage Test integrity Agent setup
✅ Pass 100% (threshold 80%) none (block) 29 files

🧪 Diff coverage

▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰ 100%

100% of changed lines covered (6/6, threshold 80%)

Changed files (1)
File Coverage Covered Uncovered lines
src/lib/pharn-config.ts 100% 6/6

🔍 Test integrity

No test-integrity findings (mode: block).

Tests changed: +1 −0 ~17 · 5 renamed
Test file Added Removed Modified Renamed
tests/commands/add.test.ts 0 0 0 1
tests/commands/init.test.ts 1 0 2 1
tests/pharn-config.test.ts 0 0 15 3

🤖 Agent setup (29 files)

Agent setup: 29 files · claude-code

Agent setup files (29)
Path Kind
.claude/commands/pharn-dev-build.md claude-command
.claude/commands/pharn-dev-eval.md claude-command
.claude/commands/pharn-dev-grill.md claude-command
.claude/commands/pharn-dev-memory-promote.md claude-command
.claude/commands/pharn-dev-plan.md claude-command
.claude/commands/pharn-dev-regress.md claude-command
.claude/commands/pharn-dev-review.md claude-command
.claude/commands/pharn-dev-ship.md claude-command
.claude/commands/pharn-dev-verify.md claude-command
.claude/hooks/enforce-writes-scope.cjs claude-hook
.claude/hooks/enforce-writes-scope.test.cjs claude-hook
.claude/hooks/git-worktree-fixture.cjs claude-hook
.claude/hooks/protect-trusted-paths.cjs claude-hook
.claude/hooks/protect-trusted-paths.test.cjs claude-hook
.claude/hooks/session-root.cjs claude-hook
.claude/hooks/session-root.test.cjs claude-hook
.claude/hooks/set-writes-scope.cjs claude-hook
.claude/hooks/set-writes-scope.test.cjs claude-hook
.claude/settings.json claude-settings
.claude/skills/phargus-diagnose claude-skill
.claude/skills/phargus-memory claude-skill
.claude/skills/phargus-rules claude-skill
.claude/skills/phargus-setup claude-skill
.claude/skills/phargus-verify claude-skill
.claude/skills/pharn-ci-cover claude-skill
.claude/skills/pharn-ci-explain claude-skill
.claude/skills/pharn-ci-install claude-skill
.claude/skills/pharn-cli claude-skill
CLAUDE.md claude-md

pharn-ci 0.10.0 · report schema v2 · coverage format lcov

@PrzemekGalarowicz
PrzemekGalarowicz force-pushed the przemek/core-189-c64-stop-writing-modules-legacy-fields branch from 3a0b82c to 456e56c Compare November 17, 2026 08:46
…189) [v0.21.0]

The v0.21.0 half of C6.4. `init` no longer writes `"modules": []` (only
0.19.x needed it), and `writePharnConfig` drops every key only older CLIs
wrote (`modules`, `constitution`, `isMultiTenant`, `stackAnswers`,
`installedSkills`) from any config it writes, so add/remove/update/init
finish the retirement. A config that still carries them loads in every
command as before. The names stay pharn-owned through `LEGACY_CONFIG_KEYS`,
so `userOwnedConfigEntries` never carries one over as the user's.

`PharnConfig.modules` and `LegacyConfigFields` leave src/types.ts. Docs
(config reference, init, support policy, shim table) and CHANGELOG updated;
tests that pinned `modules: []` now assert its absence, and a new test runs
an old config with every legacy key through every command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PrzemekGalarowicz
PrzemekGalarowicz force-pushed the przemek/core-189-c64-stop-writing-modules-legacy-fields branch from 456e56c to e384366 Compare November 17, 2026 10:04
@PrzemekGalarowicz
PrzemekGalarowicz marked this pull request as ready for review November 17, 2026 10:04
@PrzemekGalarowicz
PrzemekGalarowicz merged commit b90305f into main Nov 17, 2026
15 checks passed
@PrzemekGalarowicz
PrzemekGalarowicz deleted the przemek/core-189-c64-stop-writing-modules-legacy-fields branch November 17, 2026 10:07
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.

1 participant