microsoft / microsoft/FluidFramework
Duplicate Code Detected: Repo layout duplicated in fluidBuild.config.cjs and _buildProject.config.cjs
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.9k
- Forks
- 586
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 146
Description
🔍 Duplicate Code Detected: Repo layout config duplication
Analysis of commit 58a9758e3de31ffcae78f52bb340a124fe242ce3
Assignee: @copilot
Summary
The repository/workspace layout (release group names → directories + independent package locations) is duplicated in two separate configuration files:
fluidBuild.config.cjs(repoPackages)_buildProject.config.cjs(buildProject.workspaces)
These two blocks describe the same underlying repo topology (client/build-tools/server/gitrest/historian + common/tools packages) in two different schemas, creating a drift risk and requiring parallel updates.
Duplication Details
Pattern: Duplicated repo/workspace layout mapping
-
Severity: Medium
-
Occurrences: 2
-
Locations:
fluidBuild.config.cjs(lines 260-294)_buildProject.config.cjs(lines 33-205)
-
Code Sample (excerpt from
fluidBuild.config.cjs):// fluidBuild.config.cjs (261+) repoPackages: { "client": { directory: "", /* ... */ }, "build-tools": { directory: "build-tools" }, "server": { directory: "server/routerlicious" }, "gitrest": { directory: "server/gitrest" }, "historian": { directory: "server/historian" }, "build-common": "common/build/build-common", "common-utils": "common/lib/common-utils", "protocol-def": "common/lib/protocol-definitions", "tools": [ "tools/api-markdown-documenter", "tools/benchmark", "tools/getkeys", "tools/test-tools", ], }, -
Code Sample (excerpt from
_buildProject.config.cjs):// _buildProject.config.cjs (33+) buildProject: { workspaces: { "client": { directory: ".", /* ... */ }, "build-tools": { directory: "./build-tools", /* ... */ }, "server": { directory: "./server/routerlicious", /* ... */ }, "gitrest": { directory: "server/gitrest", /* ... */ }, "historian": { directory: "server/historian", /* ... */ }, "`@fluidframework/build-common`": { directory: "common/build/build-common", /* ... */ }, "`@fluidframework/common-utils`": { directory: "common/lib/common-utils", /* ... */ }, "`@fluidframework/protocol-definitions`": { directory: "common/lib/protocol-definitions", /* ... */ }, "`@fluid-tools/api-markdown-documenter`": { directory: "tools/api-markdown-documenter", /* ... */ }, "`@fluid-tools/benchmark`": { directory: "tools/benchmark", /* ... */ }, "`@fluid-internal/getkeys`": { directory: "tools/getkeys", /* ... */ }, "`@fluidframework/test-tools`": { directory: "tools/test-tools", /* ... */ }, }, },
Impact Analysis
- Maintainability: Any workspace/release-group directory change (or addition/removal of an independent package workspace) must be made twice, with no automated consistency enforcement.
- Bug Risk: Drift between these configs can cause build-tooling to disagree about workspace membership, leading to confusing CI/build behavior.
- Code Bloat: This is effectively two parallel sources-of-truth for the same repo topology.
Refactoring Recommendations
-
Introduce a single canonical repo-layout module
- Extract the shared repo layout definition into a dedicated file (e.g.
repoLayout.config.cjs), then have bothfluidBuild.config.cjsand_buildProject.config.cjsimport/derive their specific shapes from it. - Estimated effort: Medium
- Benefits: Eliminates drift risk; a single edit updates both configs.
- Extract the shared repo layout definition into a dedicated file (e.g.
-
Add a lightweight consistency check
- Add a build/policy check that validates both configs resolve to the same set of directories/workspaces.
- Estimated effort: Low–Medium
- Benefits: Prevents future divergence even if full refactor is deferred.
Implementation Checklist
- Confirm which config is intended to be the source-of-truth (comments suggest
_buildProject.config.cjsmay be renamed torepoLayout.config.cjsin the future) - Extract shared layout data into a single module
- Update both configs to consume shared layout
- Add a validation check (optional but recommended)
- Run build-tool validation (e.g. tasks relying on repo/workspace enumeration)
Analysis Metadata
- Analyzed Files: 5 (only
.cjs/.mjspresent in this checkout) - Detection Method: Serena semantic code analysis + manual verification
- Commit: 58a9758e3de31ffcae78f52bb340a124fe242ce3
- Analysis Date: 2026-03-12T08:00:19.626Z
AI generated by Duplicate Code Detector
To add this workflow in your repository, run
gh aw add github/gh-aw/.github/workflows/duplicate-code-detector.md@94662b1dee8ce96c876ba9f33b3ab8be32de82a4. See usage guide.
Contributor guide
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.
Research direction
Read fluidBuild.config.cjs and _buildProject.config.cjs, focusing on repoPackages and buildProject.workspaces and the comments about a possible repoLayout.config.cjs rename. Determine which configuration should be canonical, then inspect build-tool validation or workspace-enumeration tasks. Done means both configs consume one shared layout without duplicated mappings, and the relevant build-tool checks pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system, tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100