Skip to content

refactor(config): legacy fields leave PharnConfig; modules written until v0.21.0 (CORE-189) - #395

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

PrzemekGalarowicz merged 2 commits into
mainfrom
przemek/core-189-c64-stop-writing-modules-legacy-fields

Conversation

@PrzemekGalarowicz

@PrzemekGalarowicz PrzemekGalarowicz commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

What

  • constitution, installedSkills, stackAnswers and isMultiTenant move out of the public PharnConfig into an internal LegacyConfigFields type (src/types.ts). They stay in CLI_OWNED_KEYS (src/lib/pharn-config.ts; the satisfies now covers keyof PharnConfig minus seam plus keyof LegacyConfigFields), so their behaviour is unchanged: they load, add/update/remove write them back as found, and a re-run init drops them. Each is commented as legacy, to be removed in v0.21.0.
  • modules stays in the public type and is still written by init. The type and the write site (src/steps/install-archetype.ts) now carry the shim comment: written for 0.19.x, whose guard needs it; stop writing in v0.21.0 (support policy: current + previous minor).
  • docs/reference/pharn-config.md: the legacy section becomes "Fields older CLIs wrote" and lists the four fields plus modules; the schema is described as additive within the support window, linking ../support-policy.md (added by docs(policy): publish the support policy and the shims it retires (CORE-186) #394, so the link resolves once both merge).
  • CHANGELOG [Unreleased] → ### Changed: one line. No behaviour change.

Why the "stop writing modules" half is retargeted to v0.21.0

The guard change that lets a config without modules load (C2.2, CORE-164, #380) is not in any release: git tag --contains fdc1f453 is empty, so it first ships in v0.20.0. v0.19.0's guard (!Array.isArray(raw.modules) → null) reads a config without modules as no config. Its commands then say "run pharn init", and that re-run overwrites the config. Under the support policy (the current minor plus the previous one), 0.19 must still read 0.20's config. So 0.20.0 keeps writing modules: []. v0.21.0 can stop, because 0.20.0, the first CLI that reads such a config, will then be the oldest supported one.

Ticket: https://linear.app/pharn-dev/issue/CORE-189/c64-stop-writing-modules-legacy-fields-leave-the-public-type (epic CORE-155)

How verified

  • New tests in tests/pharn-config.test.ts (legacy fields (LegacyConfigFields)):
    • type checks that the four fields are not on PharnConfig and modules is;
    • userOwnedConfigEntries treats them (and modules) as pharn-owned;
    • an archetype config with them loads through loadArchetypeConfig and round-trips verbatim.
  • New test in tests/commands/add.test.ts: init still writes modules: [], and add keeps legacy fields. status then loads that config.
  • New test in tests/commands/init.test.ts: a fresh config has modules: [] and none of the four legacy fields. tests/pharn-config.test.ts also loads src/types.ts at run time and asserts it exports no value.
  • Existing tests are kept. Their typing now reads the legacy fields through PharnConfig & LegacyConfigFields.
  • Passed locally: format check, lint, markdown lint, typecheck, CI=1 vitest run --coverage (103 files, 3657 passed, floors met) and npm run build.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Compatibility
    • Existing configuration files with fields written by older CLI versions remain readable, and those fields are preserved when using add, update, or remove.
    • Fresh installs continue to write an empty modules setting through v0.20.x; this is scheduled to stop in v0.21.0.
  • Documentation
    • Clarified which older configuration fields remain supported, how they are handled, and when that support ends.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

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 29 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 893673f and c55589d.

Files selected for processing: 8

  • CHANGELOG.md
  • docs/reference/pharn-config.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/pharn-config.test.ts

No actionable comments were generated in the recent review.

Walkthrough

The public PharnConfig type no longer declares four older CLI fields. LegacyConfigFields represents them for compatibility, and config handling and tests cover their preservation. init continues writing modules: []; documentation describes the compatibility window through v0.21.0.

Changes: Legacy config compatibility

Layer / File(s) Summary
Config contract, handling, and verification
src/types.ts, src/lib/pharn-config.ts, src/steps/install-archetype.ts, tests/pharn-config.test.ts, tests/commands/add.test.ts, tests/commands/init.test.ts, docs/reference/pharn-config.md, CHANGELOG.md
PharnConfig no longer declares the four older fields; LegacyConfigFields declares them separately. Config ownership includes those fields, and tests cover their preservation during add and archetype config write-back. Tests also check that fresh init output omits the legacy fields and retains modules: []. Documentation describes the compatibility window and planned cutoff.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Merge Risk: Minimal · previous review 89367

This change moves older config fields out of the public config type and documents the compatibility window. Runtime behavior is unchanged, and existing configs keep loading and round-tripping. The merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: legacy config fields move out of the public PharnConfig type, and modules keeps being written until v0.21.0. The raw summary confirms this change in src/types.ts, src/…
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the main change: legacy config fields move out of the public PharnConfig type, and modules keeps being written until v0.21.0. The raw summary confirms this change in src/types.ts, src/lib/pharn-config.ts, docs, and tests. The title is specific and concise, and it includes a ticket reference, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between df1fc92 and 893673f.

Files selected for processing: 8

  • CHANGELOG.md
  • docs/reference/pharn-config.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/pharn-config.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

pharn

🛡️ pharn-ci · ✅ Pass

Tip

Pass · This change adds no coverable lines; 29 agent setup files found.

Verdict Diff coverage Test integrity Agent setup
✅ Pass no coverable lines none (block) 29 files

🧪 Diff coverage

No coverable lines changed.

🔍 Test integrity

No test-integrity findings (mode: block).

Tests changed: +6 −0 ~4
Test file Added Removed Modified Renamed
tests/commands/add.test.ts 1 0 0 0
tests/commands/init.test.ts 1 0 0 0
tests/pharn-config.test.ts 4 0 4 0

💬 Messages (1)

  • ℹ️ NO_COVERABLE_CHANGES No added lines are tracked by the coverage report; nothing to measure.
    • Hint: Nothing to do if the change has no code; otherwise check that the coverage report includes the changed files.

🤖 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 and others added 2 commits November 17, 2026 09:04
…til v0.21.0 (CORE-189)

constitution, installedSkills, stackAnswers and isMultiTenant move out of
the public PharnConfig into an internal LegacyConfigFields type. They stay
in CLI_OWNED_KEYS (the satisfies clause now covers both types), so they
still load, are written back as found by add/update/remove, and are dropped
by a re-run init, as before. Each names v0.21.0 as its removal version.

modules stays in the public type and is still written: 0.19.x's shape
guard reads a config without a modules array as no config, and 0.19 stays
supported while 0.20 is current. The write site and the type now say so,
with v0.21.0 as the release that stops writing it.

docs/reference/pharn-config.md: "Fields older CLIs wrote" lists the four
fields plus modules. No behavior change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… name the support window (CORE-189)

pharn-ci warned that src/types.ts and src/steps/install-archetype.ts were
not imported by a changed test. tests/pharn-config.test.ts now loads
src/types.ts at run time and asserts it exports no value. A new init test
asserts that a fresh config has modules: [] and none of the legacy fields.

docs/reference/pharn-config.md: the schema is additive within the support
window (links docs/support-policy.md, added by #394).

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 893673f to c55589d Compare November 17, 2026 08:06
@PrzemekGalarowicz
PrzemekGalarowicz merged commit 27f456b 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 08:16
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