Empty config.json fails closed and blanks usage; a missing file does not
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
Research direction
Start in Sources/CodexBarCore/Config/CodexBarConfigStore.swift, focusing on load() and loadOrCreateDefault(). Add a store regression test covering missing, zero-byte, and whitespace-only files, while confirming that {"providers": still throws decodeFailed; done means empty files follow the missing-file path and partial files are not rewritten.
Written by the indexing model from the issue text.
Description
What happens
A missing CodexBar config validates and does not block usage. A zero-byte or whitespace-only file at the resolved path does not. config validate exits 1, and usage returns a config error instead of provider data.
Reproduced with the installed Linux CLI, against an isolated CODEXBAR_CONFIG so the real config was not touched:
- missing file:
codexbar config validateprintsConfig: OKand exits 0 - zero-byte file:
Error: Failed to decode CodexBar config: The operation could not be completed. The data isn’t in the correct format.and exits 1 - whitespace-only file: same decode error, exit 1
codexbar usage --format json --provider grok --json-onlyagainst the zero-byte file returns akind: configerror and no provider usage
A one-byte partial document ({) also fails decode. That case should keep failing closed.
Where
Current main (efe690450e46f8d51413b04b149786ab717afaf6), Sources/CodexBarCore/Config/CodexBarConfigStore.swift:
load() returns nil only when the file does not exist. If the file exists, it always decodes. There is no zero-byte or whitespace short-circuit before CodexBarConfig.decode(from:).
I did not find an open issue for this. No Swift toolchain here, so I did not open a patch.
Contract
- zero-byte, or whitespace-only, config at the resolved path should take the same path as a missing file
- non-empty invalid JSON must still fail closed, and must not be replaced with defaults
loadOrCreateDefault()must not rewrite a partial file
A regression can be a store test: missing file loads as nil; zero-byte loads as nil; {"providers": still throws decodeFailed.
- Dominant language
- Swift
- Stars
- 21.9k
- Forks
- 2k
- Avg merge
- 22h 13m
- Merged PRs (30d)
- 443
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from steipete/CodexBar
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
steipete/CodexBar#3349 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr impact:ux-friction issue-rating: 🌊 off-meta tidepool P3
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
steipete/CodexBar#2860 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:needs-security-review clawsweeper:no-new-fix-pr impact:auth-provider impact:security issue-rating: 🌊 off-meta tidepool P2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
steipete/CodexBar#2429 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
impact:other issue-rating: 🌊 off-meta tidepool P3
Difficulty 4/5 3-5 days Newbie friendliness 52/100
steipete/CodexBar#4110 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
Difficulty 3/5 1-2 days Newbie friendliness 62/100
steipete/CodexBar#4101 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
All issues in steipete/CodexBar
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
openwatersio/slackwater-ios#535 ·
Maintainers usually reply within 1 day
-
area:dictation bug P2
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
uttrflow/uttrflow-swift#2721 · 2 comments ·
Maintainers usually reply within 1 day
-
[@capacitor/app] iOS: 'Expression implicitly coerced from String? to Any' warning in getAppLanguageOpentriage
Difficulty 1/5 Under an hour Newbie friendliness 88/100
ionic-team/capacitor-plugins#2604 ·
-
auth type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
googleapis/google-cloud-swift#1260 ·
Maintainers usually reply within 1 day