Skip to content

Commit 66746a8

Browse files
chore(adj-validator): copy ADJ-Validator from test-adj
1 parent fc6a167 commit 66746a8

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.github/workflows/adj-tester.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,20 @@ jobs:
2424
2525
- name: Run ADJ validation
2626
run: |
27-
python3 .github/workflows/scripts/adj-tester/main.py
27+
python3 .github/workflows/scripts/adj-tester/main.py > /dev/null 2>&1
28+
29+
- name: Notify Slack on failure
30+
if: failure()
31+
env:
32+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
33+
run: |
34+
jq -n \
35+
--arg repo "${{ github.repository }}" \
36+
--arg branch "${{ github.ref_name }}" \
37+
--arg actor "${{ github.actor }}" \
38+
--arg run_url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
39+
'{
40+
text: "<!channel> ❌ ADJ Validator Failed\n\nRepository: \($repo)\nBranch: \($branch)\nActor: \($actor)\n\nWorkflow run:\n\($run_url)"
41+
}' | curl -X POST -H "Content-type: application/json" \
42+
--data @- \
43+
$SLACK_WEBHOOK

.github/workflows/scripts/adj-tester/main.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,26 @@ def check_packet_json(
448448
)
449449
is_valid = False
450450

451+
# Ensure that if one of period_type, period, socket is present, all must be present
452+
has_period_type = "period_type" in pkt
453+
has_period = "period" in pkt
454+
has_socket = "socket" in pkt
455+
456+
# Count how many of the three fields are present
457+
fields_present = sum([has_period_type, has_period, has_socket])
458+
459+
# If any field is present, all three must be present
460+
if fields_present > 0 and fields_present < 3:
461+
error_list.append(
462+
logError(
463+
path,
464+
f"id {pkt_id}",
465+
f"Fields 'period_type', 'period', and 'socket' must all be present together or all be absent. "
466+
f"Found: period_type={has_period_type}, period={has_period}, socket={has_socket}",
467+
)
468+
)
469+
is_valid = False
470+
451471
except RuntimeError as e:
452472
error_list.append(logError(path, "<load>", str(e)))
453473
is_valid = False

0 commit comments

Comments
 (0)