Skip to content

Commit e92b455

Browse files
committed
refactor(lobster): deduplicate upstream_req_list via depset; tighten test assertion
- dependable_element.bzl: replace list.extend() accumulation with depset transitive merge so repeated ASR deps across multiple feature_requirements targets cannot produce duplicate {UPSTREAM_REQ_SOURCES} entries or duplicate lobster report inputs - seooc_test.bzl: replace generic count assertion with explicit check that 'asr_trlc.lobster' is present in the lobster report action inputs
1 parent 916fd50 commit e92b455

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

bazel/rules/rules_score/private/dependable_element.bzl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,10 +1080,11 @@ def _dependable_element_index_impl(ctx):
10801080

10811081
# Build the DE-level lobster report if feature and component traces exist
10821082
feat_req_list = feat_req_lobster_depset.to_list()
1083-
upstream_req_list = []
1083+
upstream_req_depsets = []
10841084
for req_target in ctx.attr.requirements:
10851085
if FeatureRequirementsInfo in req_target:
1086-
upstream_req_list.extend(req_target[FeatureRequirementsInfo].upstream_srcs.to_list())
1086+
upstream_req_depsets.append(req_target[FeatureRequirementsInfo].upstream_srcs)
1087+
upstream_req_list = depset(transitive = upstream_req_depsets).to_list()
10871088
comp_req_list = comp_req_lobster_depset.to_list()
10881089
comp_test_list = comp_test_lobster_depset.to_list()
10891090
comp_arch_list = comp_arch_lobster_depset.to_list()

bazel/rules/rules_score/test/seooc_test.bzl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,11 @@ def _de_lobster_config_includes_upstream_srcs_test_impl(ctx):
388388
input_basenames = [f.basename for f in lobster_report_action.inputs.to_list()]
389389
lobster_inputs = [n for n in input_basenames if n.endswith(".lobster")]
390390

391-
# Both the feature req and upstream ASR lobster files should appear as inputs
391+
# The upstream ASR lobster file (from the asr_trlc fixture target) must be present
392392
asserts.true(
393393
env,
394-
len(lobster_inputs) >= 2,
395-
"Expected at least 2 .lobster file inputs to the lobster report action " +
396-
"(feature req + upstream ASR); got: " + str(lobster_inputs),
394+
"asr_trlc.lobster" in lobster_inputs,
395+
"Expected 'asr_trlc.lobster' in lobster report action inputs; got: " + str(lobster_inputs),
397396
)
398397

399398
return analysistest.end(env)

0 commit comments

Comments
 (0)