Repository navigation
fix(init): keep the config keys pharn does not own across a re-run - #215
Merged
Merged
Conversation
Upstream pharn-oss 6.15+ reads top-level pharn.config.json keys that users add by hand: `testResults` (without it /pharn-loop stops `blocked: no-test-runner`) and `ship.requireAttestation`. add/update/remove keep unknown keys through the loaded config's spread, but init rebuilt the config from its own fields and dropped them. init now copies every top-level key the CLI does not declare in PharnConfig across from the config it replaces. It reads the old file raw and tolerantly, just before the write: any read or parse failure carries nothing. The owned-key list is exhaustive by `satisfies Record<keyof PharnConfig, true>`, so a pharn-owned field can never be carried over stale. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 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. Comment |
PrzemekGalarowicz
pushed a commit
that referenced
this pull request
Sep 24, 2026
Resolve the overlap with #215 (init keeps the config keys pharn does not own): both helpers are kept, `keptRecords` and `readCarriedEntries`. The three doc passages and the CHANGELOG now describe both carry-overs. Two of #215's comments are updated. One cited the removed carriedManualCapabilities. The other said a key edited while init's prompt is open is carried; init now refuses first when the config changed, so the key is still not lost. Adds one test: kept entries and user-owned keys survive the same re-run. Regress and verify re-run on the merged tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0199owRmYfskqYQVQrVP679o
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Upstream pharn-oss 6.15–6.20 reads top-level
pharn.config.jsonkeys that users add by hand, following the pharn-oss README's "Per-test results" section:testResults, read by/pharn-testand/pharn-verify's acceptance-criteria check. Without it,/pharn-loopstops withblocked: no-test-runner.ship.requireAttestation, read by/pharn-ship.add,updateandremovekeep unknown keys, because they spread the loaded config.initdoes not:steps/install-archetype.tsbuilds a fresh config object, and the only thing carried over from the replaced config wassource: 'manual'capabilities. So a re-runpharn initdropped both keys.Fix
initnow copies every top-level key the CLI does not declare inPharnConfig. It is appended after pharn's own keys, so the committed file's diff stays small.userOwnedConfigEntries):initthe one command where a key survives only if this CLI release knows it.main, so a fixed list would drop the next upstream key in every deployed CLI.satisfies Record<keyof PharnConfig, true>. A field declared onPharnConfigbut missing from the list, or listed but not declared, fails the typecheck. I confirmed both directions.readPharnConfig: that returnsnullfor a config with nomodulesarray, which is the case where every other command tells the user to runpharn init.Setand rebuilt withObject.fromEntries. A key namedconstructor,toStringor__proto__round-trips as an ordinary key.skillsVersion,layout,models,seam,pendingSkillsVersion,frozenCapabilities, the legacy fields, and every other key pharn owns.Tests
8 new cases in
tests/init-archetype.test.ts. The first 5 below failed before the fix; the last 3 already passed and pin the fallback.testResultsandshipare kept verbatim, and nothing else is added.testResults.modulesarray.seamblock.npm run checkpasses (1480 tests), and so doesnpm run build, both run on the branch after rebasing ontomain.Docs
docs/reference/pharn-config.md: new "Keys pharn does not own" section. It also fixes an out-of-date note that said a re-runinitlosesmanualcapabilities.docs/commands/init.md,docs/troubleshooting.md: short updates to match.CHANGELOG.md: an entry under Unreleased / Fixed.🤖 Generated with Claude Code