Skip to content

feat(kb): add docs-first feature discovery to initialization - #299

Merged
tzhouam merged 2 commits into
mainfrom
feat/feature-discovery-20261005
Oct 5, 2026
Merged

tzhouam merged 2 commits into
mainfrom
feat/feature-discovery-20261005

Conversation

@tzhouam

@tzhouam tzhouam commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Initialization previously depended on a manually declared feature catalog and a single repository language hint. This adds feature-discovery between skeleton and breadth: project-document bodies establish candidates, the complete pinned source/test inventory expands them, and independent review produces a catalog PR whose merged hash gates downstream stages.

  • Reuse a pinned inventory with per-file languages, nested tests, complete chunks, explicit unknowns and scope suggestions. Source-only features are supported; formal IDs and historical denominators remain stable.
  • Keep legacy adapters compatible; enable discovery through the new initialization template. Resolve policy paths from the actual adapter directory and create reviewed new owners during modules.
  • Default to GLM-5.3 extraction and independent Codex review with concurrency 13. Preserve successful tasks and repair drafts, bind recovery to prompts/models, verify native decisions against their actual candidate inputs, and keep full traces outside Git. Codex events are archived in buffered order after CLI completion.
  • Add the Chinese workflow diagram, compact native reports, reproducible pilot/recheck scripts, and initialization documentation.

Validation: local full suite 3429 passed / 18 skipped; final discovery/provider/compatibility regressions 95 passed; documentation, SPEC and both knowledge validators passed. Independent review findings were fixed and covered by recovery/binding tests.

The bounded JiuwenSwarm pilot uses one document and one production file at f0a69728…. A fresh review of archived extraction supports four links to the existing instances feature (three supplements and one subcapability), retaining two documentary unknowns. It preserves the 79-feature catalog and existing knowledge approvals; no full-repository discovery or PR-review accuracy gain is claimed. Raw native traces, runtime snapshots, fees-as-unknown and audit hashes are documented in eval/feature-discovery/README.md.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-05T10:24:33.534171Z e833a50 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e833a503c9

ℹ️ 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".

return scan_modules(tree, self.lifecycle.init, language, self.record)
from .feature_discovery_index import build_for_stage

self.source_index = build_for_stage(tree, self)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle invalid coverage policies in modules

When an optional knowledge-coverage.yaml exists but is malformed or uses an older invalid shape, build_for_stage() calls load_policy() and lets its ValueError, TypeError, or YAML parser error escape. The modules stage previously did not depend on this policy, and unlike the knowledge and discovery stages this new call has no precheck or exception handling, so kb init --stage modules terminates instead of returning a controlled blocked record. Catch these policy errors here or add the same policy precheck used by the other stages.

Useful? React with 👍 / 👎.

Comment on lines 133 to +136
extensions = tuple(core.get("suffixes", SUFFIXES))
if not extensions or any(s not in SUFFIXES for s in extensions):
raise ValueError("unsupported production-code suffix")
if not extensions or any(not isinstance(s, str) or not re.fullmatch(r"\.[A-Za-z0-9][A-Za-z0-9._+-]*", s)
for s in extensions):
raise ValueError("production-code suffixes must be safe literal extensions")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject or correctly match multi-dot suffixes

This validation now accepts suffixes such as .d.ts or .blade.php, but both inventory() and the discovery index compare them against Path.suffix, which returns only .ts or .php. A valid policy using one of the newly accepted multi-dot suffixes therefore silently excludes all matching production files from discovery and coverage denominators. Either disallow embedded dots here or make both inventory implementations match full filename endings.

Useful? React with 👍 / 👎.

@tzhouam
tzhouam merged commit 73b245f into main Oct 5, 2026
2 checks passed
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