Hacktrix-121 commited on
Commit
f7d1695
·
1 Parent(s): ba50a7f

fix bounds

Browse files
.gitignore CHANGED
@@ -40,6 +40,7 @@ venv.bak/
40
  *.swo
41
  *~
42
  .DS_Store
 
43
 
44
  # Testing
45
  .pytest_cache/
 
40
  *.swo
41
  *~
42
  .DS_Store
43
+ .cline
44
 
45
  # Testing
46
  .pytest_cache/
src/adaptive_alert_triage/validate.py CHANGED
@@ -69,13 +69,13 @@ class OpenEnvValidator:
69
  def check(self, name: str, condition: bool, details: str = "") -> bool:
70
  if condition:
71
  self.checks_passed.append(name)
72
- self.log(f" {name}", "PASS")
73
  if details:
74
  self.log(f" {details}", "INFO")
75
  return True
76
  else:
77
  self.checks_failed.append((name, details))
78
- self.log(f" {name}", "FAIL")
79
  if details:
80
  self.log(f" {details}", "ERROR")
81
  return False
@@ -370,7 +370,7 @@ class OpenEnvValidator:
370
  if details:
371
  self.log(f" {details}", "ERROR")
372
  else:
373
- self.log("All checks passed!", "PASS")
374
 
375
  self.log("=" * 60 + "\n", "INFO")
376
  return len(self.checks_failed) == 0
 
69
  def check(self, name: str, condition: bool, details: str = "") -> bool:
70
  if condition:
71
  self.checks_passed.append(name)
72
+ self.log(f"[PASS] {name}", "PASS")
73
  if details:
74
  self.log(f" {details}", "INFO")
75
  return True
76
  else:
77
  self.checks_failed.append((name, details))
78
+ self.log(f"[FAIL] {name}", "FAIL")
79
  if details:
80
  self.log(f" {details}", "ERROR")
81
  return False
 
370
  if details:
371
  self.log(f" {details}", "ERROR")
372
  else:
373
+ self.log("All checks passed!", "PASS")
374
 
375
  self.log("=" * 60 + "\n", "INFO")
376
  return len(self.checks_failed) == 0
tasks/easy.py CHANGED
@@ -167,9 +167,11 @@ class EasyTaskGrader:
167
  return 0.5
168
 
169
  raw = self.correct_actions / self.total_actions
170
- # Map [0,1] -> (0,1) with a small epsilon margin, no rounding
171
- score = 0.001 + 0.998 * float(raw)
172
- return max(0.001, min(0.999, score))
 
 
173
 
174
 
175
  def passed(self) -> bool:
 
167
  return 0.5
168
 
169
  raw = self.correct_actions / self.total_actions
170
+ if raw == 0.0:
171
+ return 0.001
172
+ if raw == 1.0:
173
+ return 0.999
174
+ return float(raw)
175
 
176
 
177
  def passed(self) -> bool:
tasks/hard.py CHANGED
@@ -388,9 +388,11 @@ class HardTaskGrader:
388
  stability = self._stability_score(self._system_failures)
389
  final_base = max(0.0, min(raw * stability, 1.0))
390
 
391
- # Map [0,1] -> (0,1) with a small epsilon margin, no rounding
392
- score = 0.001 + 0.998 * float(final_base)
393
- return max(0.001, min(0.999, score))
 
 
394
 
395
 
396
  def passed(self) -> bool:
 
388
  stability = self._stability_score(self._system_failures)
389
  final_base = max(0.0, min(raw * stability, 1.0))
390
 
391
+ if final_base == 0.0:
392
+ return 0.001
393
+ if final_base == 1.0:
394
+ return 0.999
395
+ return float(final_base)
396
 
397
 
398
  def passed(self) -> bool:
tasks/medium.py CHANGED
@@ -212,9 +212,11 @@ class MediumTaskGrader:
212
  miss_penalty = _CRITICAL_MISS_PENALTY_WEIGHT * miss_rate
213
 
214
  base_score = max(0.0, raw - fp_penalty - miss_penalty)
215
- # Map [0,1] -> (0,1) with a small epsilon margin, no rounding
216
- score = 0.001 + 0.998 * float(base_score)
217
- return max(0.001, min(0.999, score))
 
 
218
 
219
 
220
  def passed(self) -> bool:
 
212
  miss_penalty = _CRITICAL_MISS_PENALTY_WEIGHT * miss_rate
213
 
214
  base_score = max(0.0, raw - fp_penalty - miss_penalty)
215
+ if base_score == 0.0:
216
+ return 0.001
217
+ if base_score == 1.0:
218
+ return 0.999
219
+ return float(base_score)
220
 
221
 
222
  def passed(self) -> bool: