Skip to content

Commit 45a8d3a

Browse files
leliaclaude
andcommitted
docs: document the monorepo scan layout trade-off
The mechanics of --sub-path and --workspace-name were documented, but not the choice they force. One combined scan gives a single dashboard entry and no per-component attribution; one scan per component gives attribution, baselines and per-component policy, but adds a repository entry per component, which grows the dashboard's repository list. There is no layout that provides both today. Customers hit this at a dozen-plus components and reasonably assume they have configured something wrong. Naming the trade-off, and adding rules of thumb for picking a side, is cheaper than each of them discovering it. Cross-referenced from the CI/CD guide's independent-workspace pattern, which is the layout that grows the list. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent a0c5715 commit 45a8d3a

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

docs/ci-cd.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ to start a small selector job on every PR update, then create one scan job per
7979
affected logical workspace. This also avoids a required check remaining pending
8080
when GitHub skips the entire workflow because of a top-level path filter.
8181

82+
This pattern produces one dashboard entry per logical workspace, which is what
83+
gives each component its own alerts, baseline, and policy. It is also the layout
84+
that grows the dashboard's repository list. See
85+
[Choosing a scan layout](cli-reference.md#choosing-a-scan-layout) for when that
86+
trade-off is worth making.
87+
8288
Define a repository variable named `SOCKET_MONOREPO_WORKSPACES_JSON`. Its value is
8389
an array with one stable workspace name, one or more scan roots, and the path globs
8490
that should select that workspace. Fill these placeholders with the repository's

docs/cli-reference.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,47 @@ Normal scan logs include the effective repository and Socket workspace context,
7070
repository-relative discovery roots, aggregate manifest count, and selected baseline.
7171
Individual manifest paths remain opt-in through `--save-submitted-files-list`.
7272

73+
### Choosing a scan layout
74+
75+
`--sub-path` and `--workspace-name` support two layouts, and picking between them
76+
is a trade-off rather than a preference. There is no third option today.
77+
78+
**One combined scan** — a single invocation, no `--workspace-name`, with
79+
`--target-path` at the repository root or several repeated `--sub-path` values
80+
sharing one workspace name:
81+
82+
- One dashboard entry for the repository, named after the repository
83+
- One server-side dependency graph covering everything that was uploaded
84+
- Alerts are **not** broken out by component, so a finding does not tell you which
85+
part of the monorepo introduced it
86+
- Transitive findings can surface without a clear owning component, because the
87+
combined graph has no component boundaries to attribute them to
88+
89+
**One scan per component** — a separate invocation per component, each with its
90+
own `--sub-path` and a distinct `--workspace-name`:
91+
92+
- Per-component alerts, baselines, and policy
93+
- Each component gets its own dependency graph, which is also the faster option
94+
(see the performance note above)
95+
- But `--workspace-name` suffixes the repository slug, so *N* components produce
96+
*N* separate entries in the dashboard's repository list
97+
98+
The second point is what makes this a real choice: a monorepo with a dozen or more
99+
independently scanned components produces a dozen or more repository entries, which
100+
gets hard to navigate as the list grows. A single consolidated entry that still
101+
preserves per-component attribution is a known request and is not available today.
102+
103+
Rules of thumb:
104+
105+
- **Few components, or components that share a release cycle** — use one combined
106+
scan and accept coarser attribution.
107+
- **Many components, or components with different owners or policies** — use
108+
per-component scans and accept the extra dashboard entries. Per-component policy
109+
is only possible in this layout.
110+
- **Components that are genuinely one application** — group them under a single
111+
`--workspace-name`, as in the first example below. Grouping is per logical
112+
application, not per directory.
113+
73114
### Usage Examples
74115

75116
**Scan several directories that belong to one logical application:**

0 commit comments

Comments
 (0)