Skip to content

Commit b90142f

Browse files
committed
fix: close release lint and security gates [skip jenkins]
1 parent c6a3dc8 commit b90142f

92 files changed

Lines changed: 10882 additions & 8088 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Jenkinsfile‎

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,78 @@
11
pipeline {
22
agent any
33

4+
parameters {
5+
string(name: 'CBM_RELEASE_VERSION', defaultValue: '',
6+
description: 'Optional version passed to the release build, for example v0.11.0-rc.2')
7+
}
8+
49
options {
510
buildDiscarder(logRotator(numToKeepStr: '10'))
611
disableConcurrentBuilds()
7-
timeout(time: 45, unit: 'MINUTES')
12+
timeout(time: 240, unit: 'MINUTES')
813
}
914

1015
stages {
16+
stage('Lint') {
17+
steps {
18+
sh '''
19+
set -eu
20+
scripts/lint.sh --ci CLANG_FORMAT=clang-format-20
21+
'''
22+
}
23+
}
24+
stage('Memory lint') {
25+
steps {
26+
sh 'scripts/ci/lint-mem.sh clang-tidy-22'
27+
}
28+
}
29+
stage('Security static') {
30+
steps {
31+
sh '''
32+
set -eu
33+
scripts/security-audit.sh
34+
scripts/security-ui.sh
35+
scripts/security-vendored.sh
36+
'''
37+
}
38+
}
39+
stage('License gate') {
40+
steps {
41+
sh '''
42+
set -eu
43+
scripts/license-gate.sh --selftest
44+
scripts/license-gate.sh
45+
scripts/audit-license-provenance.py
46+
'''
47+
}
48+
}
1149
stage('Build') {
12-
steps { sh 'scripts/build.sh' }
50+
steps {
51+
sh '''
52+
set -eu
53+
if [ -n "${CBM_RELEASE_VERSION:-}" ]; then
54+
scripts/build.sh --version "$CBM_RELEASE_VERSION"
55+
else
56+
scripts/build.sh
57+
fi
58+
'''
59+
}
1360
}
1461
stage('Test') {
1562
steps {
1663
sh 'if [ -n "${CBM_TEST_SUITES:-}" ]; then scripts/test.sh --suites "$CBM_TEST_SUITES"; else scripts/test.sh; fi'
1764
}
1865
}
66+
stage('Package wrappers') {
67+
steps {
68+
sh 'scripts/ci/test-package-wrappers.sh'
69+
}
70+
}
71+
stage('Thread sanitizer') {
72+
steps {
73+
sh 'scripts/test.sh --tsan'
74+
}
75+
}
1976
stage('Archive Linux CLI artifact') {
2077
steps {
2178
sh '''

‎internal/cbm/extract_defs.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7918,16 +7918,14 @@ static bool cbm_path_is_razor(const char *rel_path) {
79187918
return false;
79197919
}
79207920

7921-
static const char *razor_page_route_on_line(CBMArena *a, const char *line,
7922-
const char *line_end) {
7921+
static const char *razor_page_route_on_line(CBMArena *a, const char *line, const char *line_end) {
79237922
static const char directive[] = "@page";
79247923
const size_t dlen = sizeof(directive) - 1U;
79257924
const char *p = line;
79267925
while (p < line_end && (*p == ' ' || *p == '\t')) {
79277926
p++;
79287927
}
7929-
if (p == line_end || (size_t)(line_end - p) <= dlen ||
7930-
strncmp(p, directive, dlen) != 0) {
7928+
if (p == line_end || (size_t)(line_end - p) <= dlen || strncmp(p, directive, dlen) != 0) {
79317929
return NULL;
79327930
}
79337931
p += dlen;

‎internal/cbm/lsp/c_lsp.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ typedef struct {
9494
// READ-ONLY across resolve workers — never mutate it
9595
// (and never store per-worker arena pointers into it)
9696
bool debug;
97-
int eval_depth; // recursion depth for c_eval_expr_type (crash guard)
98-
int eval_steps; // total expression eval calls for current file (hang guard)
99-
int walk_depth; // c_resolve_calls_in_node self-recursion (AST nesting)
97+
int eval_depth; // recursion depth for c_eval_expr_type (crash guard)
98+
int eval_steps; // total expression eval calls for current file (hang guard)
99+
int walk_depth; // c_resolve_calls_in_node self-recursion (AST nesting)
100100
int control_flow_depth; // if/loop/switch/catch nesting; assignments merge fail-closed
101101
} CLSPContext;
102102

‎internal/cbm/lsp/cs_lsp.h‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ typedef struct {
8686
/* Enclosing class / struct / record / interface — the "type" body
8787
* we're currently inside. NULL outside type body. */
8888
const char *enclosing_class_qn;
89-
const char *enclosing_base_qn; /* base class QN; NULL if none */
90-
const char **enclosing_iface_qns; /* NULL-terminated; NULL if none */
89+
const char *enclosing_base_qn; /* base class QN; NULL if none */
90+
const char **enclosing_iface_qns; /* NULL-terminated; NULL if none */
9191

9292
/* Enclosing function/method/lambda. */
9393
const char *enclosing_func_qn;
@@ -117,8 +117,7 @@ typedef struct {
117117

118118
/* Initialize a CSLSPContext for processing one file. */
119119
void cs_lsp_init(CSLSPContext *ctx, CBMArena *arena, const char *source, int source_len,
120-
const CBMTypeRegistry *registry, const char *module_qn,
121-
CBMResolvedCallArray *out);
120+
const CBMTypeRegistry *registry, const char *module_qn, CBMResolvedCallArray *out);
122121

123122
/* Append a using directive. local_name may be NULL/empty for non-alias kinds. */
124123
void cs_lsp_add_using(CSLSPContext *ctx, CBMCSUsingKind kind, const char *local_name,
@@ -140,7 +139,7 @@ const char *cs_resolve_type_name(CSLSPContext *ctx, const char *name);
140139

141140
/* Look up a method on a type, walking base + interface chains. */
142141
const CBMRegisteredFunc *cs_lookup_method(CSLSPContext *ctx, const char *type_qn,
143-
const char *method_name);
142+
const char *method_name);
144143

145144
/* Apply the local AST-declared return-type refinement to an already populated
146145
* registry. Kept as a production-used seam so post-registration signature
@@ -153,9 +152,9 @@ void cbm_run_cs_lsp(CBMArena *arena, CBMFileResult *result, const char *source,
153152

154153
/* Cross-file entry. Like Go/C: caller supplies pre-resolved defs from siblings. */
155154
void cbm_run_cs_lsp_cross(CBMArena *arena, const char *source, int source_len,
156-
const char *module_qn, CBMLSPDef *defs, int def_count,
157-
const char **using_targets, int using_count,
158-
TSTree *cached_tree, CBMResolvedCallArray *out);
155+
const char *module_qn, CBMLSPDef *defs, int def_count,
156+
const char **using_targets, int using_count, TSTree *cached_tree,
157+
CBMResolvedCallArray *out);
159158

160159
/* Tier 2: build a project-wide C# registry ONCE from all defs (filters
161160
* by lang), shared READ-ONLY across resolve workers. Def-driven. */
@@ -180,7 +179,7 @@ typedef struct {
180179
} CBMBatchCSLSPFile;
181180

182181
void cbm_batch_cs_lsp_cross(CBMArena *arena, CBMBatchCSLSPFile *files, int file_count,
183-
CBMResolvedCallArray *out);
182+
CBMResolvedCallArray *out);
184183

185184
/* Register .NET BCL stdlib types and functions. Generated. */
186185
void cbm_csharp_stdlib_register(CBMTypeRegistry *reg, CBMArena *arena);

‎internal/cbm/lsp/generated/c_stdlib_data.c‎

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,38 @@
55
#include <string.h>
66

77
// Helper macros for concise registration
8-
#define REG_FUNC(qn, short, ret_type) do { \
9-
memset(&rf, 0, sizeof(rf)); \
10-
rf.min_params = -1; \
11-
rf.qualified_name = (qn); \
12-
rf.short_name = (short); \
13-
rf.signature = cbm_type_func(arena, NULL, NULL, (const CBMType*[]){(ret_type), NULL}); \
14-
cbm_registry_add_func(reg, rf); \
15-
} while(0)
8+
#define REG_FUNC(qn, short, ret_type) \
9+
do { \
10+
memset(&rf, 0, sizeof(rf)); \
11+
rf.min_params = -1; \
12+
rf.qualified_name = (qn); \
13+
rf.short_name = (short); \
14+
rf.signature = cbm_type_func(arena, NULL, NULL, (const CBMType *[]){(ret_type), NULL}); \
15+
cbm_registry_add_func(reg, rf); \
16+
} while (0)
1617

17-
#define REG_TYPE(qn, short) do { \
18-
memset(&rt, 0, sizeof(rt)); \
19-
rt.qualified_name = (qn); \
20-
rt.short_name = (short); \
21-
cbm_registry_add_type(reg, rt); \
22-
} while(0)
18+
#define REG_TYPE(qn, short) \
19+
do { \
20+
memset(&rt, 0, sizeof(rt)); \
21+
rt.qualified_name = (qn); \
22+
rt.short_name = (short); \
23+
cbm_registry_add_type(reg, rt); \
24+
} while (0)
2325

24-
void cbm_c_stdlib_register(CBMTypeRegistry* reg, CBMArena* arena) {
26+
void cbm_c_stdlib_register(CBMTypeRegistry *reg, CBMArena *arena) {
2527
CBMRegisteredFunc rf;
2628
CBMRegisteredType rt;
2729

28-
const CBMType* t_int = cbm_type_builtin(arena, "int");
29-
const CBMType* t_size_t = cbm_type_builtin(arena, "size_t");
30-
const CBMType* t_double = cbm_type_builtin(arena, "double");
31-
const CBMType* t_void = cbm_type_builtin(arena, "void");
32-
const CBMType* t_char_ptr = cbm_type_pointer(arena, cbm_type_builtin(arena, "char"));
33-
const CBMType* t_void_ptr = cbm_type_pointer(arena, t_void);
30+
const CBMType *t_int = cbm_type_builtin(arena, "int");
31+
const CBMType *t_size_t = cbm_type_builtin(arena, "size_t");
32+
const CBMType *t_double = cbm_type_builtin(arena, "double");
33+
const CBMType *t_void = cbm_type_builtin(arena, "void");
34+
const CBMType *t_char_ptr = cbm_type_pointer(arena, cbm_type_builtin(arena, "char"));
35+
const CBMType *t_void_ptr = cbm_type_pointer(arena, t_void);
3436

3537
// FILE type
3638
REG_TYPE("FILE", "FILE");
37-
const CBMType* t_file_ptr = cbm_type_pointer(arena, cbm_type_named(arena, "FILE"));
39+
const CBMType *t_file_ptr = cbm_type_pointer(arena, cbm_type_named(arena, "FILE"));
3840

3941
// stdio.h
4042
REG_FUNC("fopen", "fopen", t_file_ptr);

0 commit comments

Comments
 (0)