Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ updates:
- "/pkgs/d1-gateway/worker"
- "/pkgs/desktop-commander/worker"
- "/pkgs/dot-bridge/site"
- "/pkgs/fleet/conductor-hosted"
- "/pkgs/fleet/hosted-worker"
- "/pkgs/github-ci/worker"
- "/pkgs/hosted-primitives"
Expand All @@ -47,6 +48,7 @@ updates:
- "/pm-stack/console"
- "/pm-stack/console/edge"
- "/pm-stack/decision-events-worker"
- "/pm-stack/dispatch-hosted"
- "/pm-stack/notify-relay"
- "/pm-stack/private-laptop-bridge"
- "/scripts/muse/handoff/worker"
Expand Down
56 changes: 50 additions & 6 deletions scripts/tests/test_dependabot_npm_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,40 @@
BUN_TARGETS = BUN_DIRS - {"pm-stack/voice-line-worker/ci"}


def npm_block(text):
blocks = re.findall(
def npm_blocks(text):
return re.findall(
r'(?ms)^ - package-ecosystem: "npm"\n(.*?)(?=^ - package-ecosystem:|\Z)',
text,
)
if len(blocks) != 1:
raise AssertionError(f"expected one npm update block, found {len(blocks)}")
return blocks[0]


def npm_block(text):
# The shared enumerated block is the one carrying a `directories:`
# list. Single-directory npm blocks are deliberate splits (the
# grok-cli ignore carrier, #15492; the atlas-search/worker vitest
# split, #16880) and are covered by npm_single_directories below.
enumerated = [
block
for block in npm_blocks(text)
if re.search(r"(?m)^ directories:", block)
]
if len(enumerated) != 1:
raise AssertionError(
f"expected one enumerated npm update block, found {len(enumerated)}"
)
return enumerated[0]


def npm_single_directories(text):
singles = []
for block in npm_blocks(text):
if re.search(r"(?m)^ directories:", block):
continue
match = re.search(r'(?m)^ directory: "([^"]+)"', block)
if not match:
raise AssertionError("npm block has neither directories nor directory")
singles.append(match.group(1))
return singles


def bun_block(text):
Expand Down Expand Up @@ -78,7 +104,24 @@ def test_every_npm_target_has_a_manifest_and_tarball_dirs_are_not_targets(self):
# The repository root is intentionally not an npm target: root
# discovery was the path that let lock-only subdirectories enter
# the security update job without a package.json.
expected = manifest_dirs - TARBALL_DIRS - BUN_DIRS - {"."}
# Single-directory npm blocks cover their directories through
# their own entries, so those directories are not expected in
# the enumerated list; each must still be manifest-backed and
# must not double-cover an enumerated target.
single_dirs = {
path.lstrip("/") for path in npm_single_directories(CONFIG.read_text())
}
for directory in single_dirs:
self.assertIn(
directory,
manifest_dirs,
f"single-directory npm target has no tracked manifest: {directory}",
)
self.assertTrue(
single_dirs.isdisjoint(targets),
"single-directory npm targets must not duplicate enumerated targets",
)
expected = manifest_dirs - TARBALL_DIRS - BUN_DIRS - {"."} - single_dirs

self.assertEqual(
targets, expected, "npm directories must match tracked npm manifests"
Expand Down Expand Up @@ -117,6 +160,7 @@ def test_bun_targets_are_lockfile_backed_and_not_npm_targets(self):
path.lstrip("/")
for path in list_values(npm_block(text), "directories")
}
| {path.lstrip("/") for path in npm_single_directories(text)}
),
"Bun targets must not also be configured for npm",
)
Expand Down