Repository navigation
kb init: validate the adapter's knowledge_lifecycle.init block - #239
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5160b3844d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| target = (root / seed).resolve() | ||
| if not target.is_relative_to(root): |
There was a problem hiding this comment.
Reject symlink aliases that resolve into the initialized repo
When a valid-looking seed such as general/alias is a symlink to knowledge_root/repos/<repo>, _seed_problem approves the textual path and this runtime check approves the resolved target merely because it remains under the knowledge root. This bypasses the documented self-seed prohibition and can feed the repository's own existing knowledge back into initialization; runtime validation should also reject resolved paths under the repository being initialized, or reject such symlink aliases.
Useful? React with 👍 / 👎.
5160b38 to
e6bdb1c
Compare
e6bdb1c to
e90c31b
Compare
kb init (design kb-init v3 §3) reads its per-repository settings from a new,
strictly validated `init` sub-mapping of `knowledge_lifecycle`. Parsing
produces an `InitConfig` on `RepoLifecycle.init` (None when absent):
- seeds: knowledge-relative paths under general/ or repos/<other repo>/;
a seed naming the repository being initialised, an absolute path, empty,
`.` or `..` segments, or duplicates are refused at parse time
- doc_globs default to README* + docs/**/*.md (what build_doc_corpus reads)
plus CONTRIBUTING.md and AGENTS.md
- source_roots default to the manifest's ut_coverage.source_roots
- exclude, module_depth (>=1, 2), min_module_loc (>=0, 300),
pr_window {count, max_age_days} (>0, 200/180), coverage_target ((0,1],
0.85), budget_usd (>0, 30), judge_call_usd (>=0, 0.50); non-finite numbers (.nan, .inf) are refused
`validate_seeds(init, knowledge_root)` is the run-time check that every seed
exists in the knowledge tree and does not resolve outside it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e90c31b to
f325875
Compare
Part 1/9 of kb init (design v3, sol-approved): the adapter's
knowledge_lifecycle.initblock.Summary
kb_service/config.py:initis a new, strictly validated sub-mapping ofknowledge_lifecycle. It's parsed into a frozenInitConfigonRepoLifecycle.init(Nonewhen absent).seeds: knowledge-relative paths undergeneral/orrepos/<other repo>/. Self-seeds, absolute paths, empty/./..segments and duplicates are refused.doc_globs: defaults toREADME*,docs/**/*.md(the same setbuild_doc_corpusreads),CONTRIBUTING.mdandAGENTS.md.source_roots: defaults to the manifest'sut_coverage.source_roots.exclude,module_depth,min_module_loc,pr_window {count, max_age_days},coverage_target,budget_usdandjudge_call_usd. Each is range-checked, non-finite numbers are refused, and unknown keys are refused.validate_seeds(init, knowledge_root) -> list[str]: run-time check that each seed exists in the knowledge tree and stays inside it.src/.kb_service.mdis updated.Test evidence
test/test_kb_init_config.py: defaults, a full parse, theut_coveragefallback, 32 rejection cases (including.nan/.inf), andvalidate_seedsfor missing paths and symlink escape.--strict, knowledge linters): rc=0.🤖 Generated with Claude Code