Skip to content

Feature mapping: package-less nested TypeScript sources under packages/* can be unowned #243

Closed

Description

@ptahdunbar

Summary

ClawPatch v0.8.2's default deterministic mapper can skip a package-less TypeScript project under packages/* whose implementation lives directly in a nested folder rather than src// lib/. This leaves the file outside all ownedFiles feature records.

This may be an intentional boundary rather than a bug; raising a reproducible upstream-first mapping coverage gap rather than implementing a competing mapper.

Minimal synthetic reproduction (no private source)

mkdir -p feature-map-repro/packages/core/governance
cd feature-map-repro
printf '%s\n' '{"name":"portable-mapping-fixture","private":true,"type":"module"}' > package.json
printf '%s\n' 'packages:' "  - 'packages/*'" > pnpm-workspace.yaml
printf '%s\n' 'export type Policy = { enabled: boolean };' > packages/core/governance/types.ts
git init && git add .
clawpatch init
clawpatch map --source heuristic

Inspect .clawpatch/features/*.json and look for ownedFiles[].path === "packages/core/governance/types.ts".

Observed: the map completed successfully with 2 feature records, but none owns that path. Node 24, clawpatch@0.8.2, no provider/model calls. The fixture was exercised in a clean Linux GitHub Actions job with an exact npm version.

Expected / question

Ideally, the package-less project root should produce a bounded generic TypeScript source feature (or source-group feature) for the nested implementation, even when there is no nested package.json, project.json, or conventional src directory. Alternatively, document that this structure is intentionally unsupported and the recommended native configuration for adding coverage.

The Feature Mapping documentation describes package-less Node/TypeScript project roots and bounded source-group discovery, so this is a meaningful gap to clarify.

Constraints

  • Keep deterministic mapping fast and bounded; no model invocation to make basic source inventory complete.
  • Respect excludes, generated paths, symlinks, and existing package/project owners.
  • Add a synthetic mapper test proving the new coverage, with false-positive guards.
  • Prefer upstream correction rather than a ClawPatch-specific fork or downstream feature mapper.

No private source, credentials or customer data included.

Activity

  1. added
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    P2Normal priority bug or improvement with limited blast radius.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    and removed
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    on Oct 20, 2026
  2. clawsweeper commented on Oct 20, 2026

    @clawsweeper
    Contributor

    Codex review: this still needs some work.

    Summary
    This issue remains unresolved: current main omits the reported layout, and the supported automatic-discovery boundary still needs a maintainer decision.

    Reproducibility: Current source establishes the omission and the metadata ownership path; this review did not execute the fixture, and the reporter's external CI artifacts were unavailable.

    Maintainer decision needed

    • Question: Should packages/core/governance require explicit project.json sourceRoot metadata, or should heuristic discovery automatically cover arbitrary nested TypeScript folders?
    • Recommendation: Document explicit metadata: Document packages/core/project.json with sourceRoot packages/core/governance and add a focused ownership regression.
    • Why: The source and introduction history use conventional roots, while the issue requests either broader discovery or explicit documentation; the merged maintenance PR leaves that choice unresolved.

    Next step
    Choose the discovery boundary, then document the validated sourceRoot example or specify bounded automatic coverage and its ownership guards.

    Review details

    Best possible solution:

    Document the existing project.json sourceRoot workaround with an ownership regression and an explicit statement of the supported discovery boundary.

    Do we have a high-confidence way to reproduce the issue?

    Current source establishes the omission and the metadata ownership path; this review did not execute the fixture, and the reporter's external CI artifacts were unavailable.

    Is this the best way to solve the issue?

    Documenting existing sourceRoot metadata is the smallest supported solution; automatic discovery would require coordinated changes to project discovery and source-root selection.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • Whether arbitrary package-less source folders should be discovered automatically remains undecided.
    • Any discovery expansion must preserve bounded traversal, exclusions, symlink handling, and existing project ownership.

    Codex review notes: model internal, reasoning medium; reviewed against f4eb220dd82e.

    Label changes

    Label changes:

    No label changes.

    Label justifications:

    • P2: A concrete layout loses deterministic review coverage, but mapping completes and explicit project metadata provides a workaround.
    • impact:other: Unowned TypeScript files are omitted from feature-based review coverage.
    Evidence reviewed

    Acceptance criteria:

    • pnpm test src/mapper.test.ts
    • pnpm typecheck
    • pnpm lint
    • pnpm test
    • pnpm build

    What I checked:

    • Current default branch: GitHub identifies main as the default branch, and its SHA matches the clean checkout. (f4eb220dd82e)
    • Discovery omits the reported folder: Generic discovery checks framework signals and source beneath src, app, pages, lib, server, and api; governance/types.ts supplies none of these signals. (src/mappers/projects.ts:733, f4eb220dd82e)
    • Ownership requires selected source roots: Source grouping walks conventional directories plus explicit sourceRoot metadata, so broadening project discovery alone would not cover the reported file. (src/mappers/node.ts:378, f4eb220dd82e)
    • Documentation leaves the alternative unclear: The guide lists package-less roots, conventional source groups, and project.json source roots, but provides neither the governance example nor an explicit requirement for metadata on arbitrary layouts. (docs/feature-mapping.md:34, f4eb220dd82e)
    • Feature introduction and subsequent ownership: The REST commit patch establishes that 16e91bc introduced convention-based package-less discovery and explicit sourceRoot grouping; feat(mapper): map package-less monorepo roots #75 merged that work. Later history includes project-tooling refactors and preservation of package-less Nx mapping. (src/mappers/projects.ts:764, 16e91bc8a689)
    • Existing metadata coverage: Current tests preserve package-less projects with project.json sourceRoot outside conventional project locations. (src/mapper.test.ts:1484, f4eb220dd82e)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge; those execution lanes are retired.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

    Reviewed October 21, 2026, 1:59 AM ET / 05:59 UTC.

  3. added
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    and removed
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    on Oct 20, 2026
  4. ptahdunbar commented on Oct 20, 2026

    @ptahdunbar
    Author

    Verified configuration-first workaround (synthetic GitHub Actions repro)

    Thanks for the review. I exercised the recommended native project.json route against unmodified clawpatch@0.8.2, using the same public-safe synthetic workspace as the issue (Node 24, Linux, no Nx package installed, no model calls).

    Before: packages/core/governance/types.ts is unowned; default heuristic mapper emits 2 features, neither with that file in ownedFiles.

    Change: create packages/core/project.json with:

    {"name":"governance-synthetic","sourceRoot":"packages/core/governance","projectType":"library"}

    After: clawpatch map --source heuristic emits a native feature with ownedFiles[].path === "packages/core/governance/types.ts". The CI check asserts this and passed, observing 1 owning feature slice.

    Evidence: agencyftw/agents PR #574; GitHub Actions run 39365416017.

    This validates the maintainer/reviewer suggestion that explicit native metadata can solve the documented package-less mapping case without broadening heuristics or maintaining a fork. Suggest documenting this as the recommended workaround in feature-mapping guidance, with a regression example. I am treating the automated discovery-boundary question as separate; the user still needs to decide whether new project metadata should be required for arbitrary layouts.

    No customer code or private findings included.

  5. 17 remaining items

  6. added
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    and removed
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    on Oct 20, 2026
  7. steipete commented on Oct 21, 2026

    @steipete
    Contributor

    Fixed in #246 and released in v0.8.4, now npm latest.

    Your synthetic reproduction now assigns packages/core/governance/types.ts exactly one deterministic owner. Nested explicit manifests still win, including when packages/* workspace discovery does not enumerate them. Regression tests also cover excludes, symlinks, bounded groups, and stable remapping.

    Exact-head CI and the release pipeline passed. The published registry tarball passed SHA-512 integrity verification and an installed-CLI smoke of the reproduction. Thanks @ptahdunbar for the report.

  8. added a commit that references this issue on Oct 25, 2026
    8cf3053
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions