Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
61d3536
feat(analysis-view): project an environment manifest from web network…
earakely-scale Oct 18, 2026
2d95597
test(web-network): check the manifest refusal text like the api-surfa…
earakely-scale Oct 18, 2026
6cb38b5
docs(specs): record the hosted web-network lane run for the manifest …
earakely-scale Oct 18, 2026
b6d18d2
docs(specs): reconcile the manifest view verification scope note with…
earakely-scale Oct 18, 2026
44203ec
fix(analysis-view): bound body, route and name work in the environmen…
earakely-scale Oct 18, 2026
bfe5a36
fix(analysis-view): keep manifest folding, naming and media-type read…
earakely-scale Oct 18, 2026
71d7513
fix(analysis-view): charge the manifest group key before building it
earakely-scale Oct 18, 2026
2679323
fix(analysis-view): accept a +json suffix only on application media t…
earakely-scale Oct 18, 2026
692453b
chore: merge main into environment manifest review
gensokyo-dev Oct 18, 2026
f73af11
fix(analysis-view): require the capture parent's exact subject for a …
earakely-scale Oct 18, 2026
d6cb57e
fix(analysis-view): share truncated suffix allocation work
gensokyo-dev Oct 18, 2026
99be275
chore: incorporate environment manifest review updates
gensokyo-dev Oct 18, 2026
dd87f54
fix(analysis-view): merge only identifier-like siblings under sibling…
earakely-scale Oct 18, 2026
ef47ead
chore: update environment manifest review from main
gensokyo-dev Oct 18, 2026
252b55d
fix(analysis-view): combine qualifying sibling cohorts
gensokyo-dev Oct 18, 2026
f2c3456
chore: refresh environment manifest validation from main
gensokyo-dev Oct 18, 2026
adbbbe5
docs(analysis-view): clarify opt-in sibling folding
gensokyo-dev Oct 18, 2026
494e015
chore: merge main (d1adc607) into the environment manifest view branch
earakely-scale Oct 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(analysis-view): merge only identifier-like siblings under sibling…
…-variance

Addresses the sixth automated review finding: a bucket merged whenever one
literal carried a digit, folding plain words such as `mine` into the
parameter. The rule now partitions the bucket, merges the identifier-like
siblings and leaves the other literals as their own tools.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
  • Loading branch information
earakely-scale and claude committed Oct 18, 2026
commit dd87f54e37bcd0405a3817da82ae6aa8a8c73870
11 changes: 11 additions & 0 deletions docs/specs/agent-environments/manifest-view/verification.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,14 @@ on `#append` predate the change); `npx knip` no findings; `npm run jscpd`
files once; `vitest run` over the view, accumulator, JSON-shape and contract
example tests 32 passed in 4 files; `vitest run` over the service, CLI and
MCP boundary tests for analysis views 73 passed in 3 files.

A sixth automated finding (Codex) was addressed after the collaborator's
merge of main: `sibling-variance` merged a whole bucket when any one literal
carried a digit, so `/api/items/mine` could be folded into `{item_id}`. The
rule now partitions the bucket and merges only the identifier-like siblings
(each with a digit or colon, or three or more hyphenated names under a plural
literal), leaving the other literals as their own tools; with the rule alone
the fixture therefore keeps `/api/folders/general` and
`/api/folders/fg1jo91e57e2ob` separate, while all three rules still fold
`general` into `/api/folders/{uid}` through the opaque-token parameter. Tests:
the new partition case and the updated single-rule table.
10 changes: 5 additions & 5 deletions docs/web-network-captures.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,11 @@ template and `params` carry the four format rules with names `id`, `uuid`,
only when listed, each at most once (a repeated rule is an `invalid_request`),
in this order:

| Rule | Applies to | Parameter |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| `after-uid-literal` | The literal segment right after a literal `uid`, unless it is a stop word | `uid` |
| `opaque-token` | A lowercase alphanumeric segment of twelve or more characters mixing letters and digits that is not a `v1`-style version | `uid` |
| `sibling-variance` | Groups equal in method, origin and segment count that differ in one literal at index 2 or later whose values are identifier-like (a digit or `:`, or three or more hyphenated names under a plural literal) and never a stop word | singular previous literal plus `_id`, else `id` |
| Rule | Applies to | Parameter |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| `after-uid-literal` | The literal segment right after a literal `uid`, unless it is a stop word | `uid` |
| `opaque-token` | A lowercase alphanumeric segment of twelve or more characters mixing letters and digits that is not a `v1`-style version | `uid` |
| `sibling-variance` | Groups equal in method, origin and segment count that differ in one literal at index 2 or later; the siblings whose literal is identifier-like (a digit or `:`, or three or more hyphenated names under a plural literal) merge, never a stop word, and the other literals stay their own tools | singular previous literal plus `_id`, else `id` |

A literal sibling of a position templated by an opt-in rule folds into that
parameter as an observed value, so `/api/folders/{uid}` lists `general` beside
Expand Down
46 changes: 27 additions & 19 deletions src/domain/analysisView/environmentManifestRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,35 +174,42 @@ const literalAt = (group: ToolGroup, position: number): string => {
return part?.kind === "literal" ? part.value : "";
};

/** Values look like identifiers: digits or colons, or three-plus hyphenated names under a plural literal. */
const identifierLike = (
values: readonly string[],
previous: RoutePart | undefined,
): boolean =>
values.some((value) => /[\d:]/u.test(value)) ||
(values.length >= 3 &&
values.every((value) => value.includes("-")) &&
/** The siblings whose literal looks like an identifier: each carries a digit or colon, or three or more are hyphenated names under a plural literal. Stop words never qualify. */
const identifierLikeSiblings = (
literal: readonly ToolGroup[],
position: number,
): ToolGroup[] => {
const candidates = literal.filter(
(group) => !STOP_WORDS.has(literalAt(group, position)),
);
const coded = candidates.filter((group) =>
/[\d:]/u.test(literalAt(group, position)),
);
if (coded.length >= 2) return coded;
Comment thread
gensokyo-dev marked this conversation as resolved.
Resolved
Comment thread
gensokyo-dev marked this conversation as resolved.
Resolved
const previous = literal[0]?.parts[position - 1];
const hyphenated = candidates.filter((group) =>
literalAt(group, position).includes("-"),
);
return hyphenated.length >= 3 &&
previous?.kind === "literal" &&
previous.value.endsWith("s"));
previous.value.endsWith("s")
? hyphenated
: [];
};

const optInParamAt = (group: ToolGroup, position: number): boolean => {
const part = group.parts[position];
return part?.kind === "param" && OPT_IN_RULES.has(part.rule);
};

/** Merge literal siblings into one sibling-variance parameter when every value is identifier-like. */
/** Merge the identifier-like literal siblings into one sibling-variance parameter; other literals stay their own tools. */
const mergeLiteralSiblings = (
literal: readonly ToolGroup[],
position: number,
): ToolGroup[] => {
const values = literal.map((group) => literalAt(group, position));
if (
literal.length < 2 ||
values.some((value) => STOP_WORDS.has(value)) ||
!identifierLike(values, literal[0]!.parts[position - 1])
)
return [...literal];
const first = earliest(literal);
const eligible = new Set(identifierLikeSiblings(literal, position));
if (eligible.size < 2) return [...literal];
const first = earliest([...eligible]);
const shape = withParts(
first,
first.parts.map((part, index) =>
Expand All @@ -213,9 +220,10 @@ const mergeLiteralSiblings = (
);
return [
mergeGroups(
literal.map((group) => (group === first ? shape : group)),
[...eligible].map((group) => (group === first ? shape : group)),
shape,
),
...literal.filter((group) => !eligible.has(group)),
];
};

Expand Down
34 changes: 33 additions & 1 deletion src/domain/analysisView/environmentManifestView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,14 @@ it.each([
],
[
"sibling-variance",
["/api/plugins/{plugin_id}/settings", "/api/folders/{folder_id}"],
["/api/plugins/{plugin_id}/settings"],
[
"/api/dashboards/uid/acb4v6",
"/api/datasources/uid/dg1jo96tern5sb/health",
// `general` is not identifier-like, so on its own the rule leaves both folder literals alone;
// with opaque-token selected the token's parameter absorbs it instead.
"/api/folders/fg1jo91e57e2ob",
"/api/folders/general",
],
],
] as const)(
Expand Down Expand Up @@ -964,3 +968,31 @@ it("refuses a parent whose subject is absent or names another path or digest", (
).toMatchObject(refusal);
expect(projectAnalysisView(parent, view()).ok).toBe(true);
});

it("merges only the identifier-like siblings and keeps the other literals as their own tools", () => {
const projected = manifest(
["sibling-variance"],
syntheticCapture([
["GET", "https://s.test/api/items/a1"],
["GET", "https://s.test/api/items/b2"],
["GET", "https://s.test/api/items/mine"],
["GET", "https://s.test/api/items/search"],
["GET", "https://s.test/api/widgets/red-one"],
["GET", "https://s.test/api/widgets/blue-two"],
["GET", "https://s.test/api/widgets/green-three"],
["GET", "https://s.test/api/widgets/shared"],
]),
);
expect(projected.tools.map((tool) => tool.path_template)).toEqual([
"/api/items/mine",
"/api/items/search",
"/api/items/{item_id}",
"/api/widgets/shared",
"/api/widgets/{widget_id}",
]);
expect(
projected.tools.find(
(tool) => tool.path_template === "/api/items/{item_id}",
)?.params[0]?.observed_values,
).toEqual(["a1", "b2"]);
});
Loading