English fallback
This translation is missing; the canonical English reference follows.
fuzzy1337.evidence¶
fuzzy1337.evidence
¶
Immutable, attributable raw evidence in an operator-owned local directory.
EvidenceError
¶
Bases: RuntimeError
Base failure for reading or publishing local evidence.
Source code in fuzzy1337/evidence.py
31 32 | |
EvidenceIntegrityError
¶
Bases: EvidenceError
Stored bytes, canonical metadata, or filesystem boundaries are inconsistent.
Source code in fuzzy1337/evidence.py
35 36 | |
EvidenceNotFoundError
¶
Bases: EvidenceError
An expected raw artifact or manifest is absent.
Source code in fuzzy1337/evidence.py
39 40 | |
EvidenceStorageError
¶
Bases: EvidenceError
The filesystem could not complete an evidence operation.
Source code in fuzzy1337/evidence.py
43 44 | |
EvidenceProvenance
dataclass
¶
Explicit non-secret collection context, independent from interpretation.
Scope references attribute collection; they do not authorize any operation. Times require UTC offsets and are stored in UTC. No environment, arguments, or credential values are collected automatically.
Source code in fuzzy1337/evidence.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
__post_init__() -> None
¶
Validate attribution and freeze canonical collection times.
Source code in fuzzy1337/evidence.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
ToDict() -> dict[str, object]
¶
Return detached schema-v1 metadata with no automatic secret collection.
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
JSON-compatible provenance, including explicit terminal failure state. |
Source code in fuzzy1337/evidence.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
EvidenceRecord
dataclass
¶
A versioned immutable raw-content reference and collection provenance.
Source code in fuzzy1337/evidence.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
__post_init__() -> None
¶
Bind identity to the canonical manifest, independently from content.
Source code in fuzzy1337/evidence.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | |
ToDict() -> dict[str, object]
¶
Return detached JSON-compatible schema fields without interpretation.
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
Version, five-field adapter reference, and collection provenance. |
Source code in fuzzy1337/evidence.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
Serialize() -> bytes
¶
Return deterministic UTF-8 JSON used to derive the evidence identifier.
Returns:
| Type | Description |
|---|---|
bytes
|
Sorted compact JSON with no non-finite numbers or embedded raw bytes. |
Source code in fuzzy1337/evidence.py
222 223 224 225 226 227 228 229 230 231 232 | |
LocalEvidenceStore
¶
Content-addressed storage in an explicit operator-owned physical directory.
The existing root and ancestors must not be symlinks/reparse points. Callers own the root; hostile concurrent directory replacement is outside this local pathname contract. Cooperative writers publish atomically without overwrite. Construction performs no filesystem access. No indexes, findings, or secret discovery are added; callers explicitly provide authorized non-secret bytes.
Source code in fuzzy1337/evidence.py
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | |
__init__(root: Path) -> None
¶
Retain an explicit root without creating or inspecting local state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
Existing physical evidence directory, possibly relative. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
The supplied root includes traversal or is a filesystem root. |
Source code in fuzzy1337/evidence.py
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | |
StoragePath(parts: tuple[str, ...], create: bool = False) -> Path
¶
Internal helper: validate the root and optionally create owned directories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parts
|
tuple[str, ...]
|
Fixed internal relative path components, never untrusted paths. |
required |
create
|
bool
|
Whether to create missing owned partition directories. |
False
|
Returns:
| Type | Description |
|---|---|
Path
|
Artifact path beneath checked physical directories. |
Raises:
| Type | Description |
|---|---|
EvidenceIntegrityError
|
An observed component is unsafe. |
OSError
|
A directory is absent, inaccessible, or cannot be created. |
Source code in fuzzy1337/evidence.py
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | |
ReadStoredBytes(parts: tuple[str, ...], max_bytes: int) -> bytes
¶
Internal helper: read safe paths within a known size ceiling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parts
|
tuple[str, ...]
|
Fixed internal artifact path components. |
required |
max_bytes
|
int
|
Maximum permitted byte length from the reference/schema. |
required |
Returns:
| Type | Description |
|---|---|
bytes
|
Artifact bytes bounded by the declared size ceiling. |
Raises:
| Type | Description |
|---|---|
EvidenceIntegrityError
|
A path is unsafe or the file exceeds its limit. |
OSError
|
The filesystem cannot read the artifact. |
Source code in fuzzy1337/evidence.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | |
PublishStoredBytes(parts: tuple[str, ...], data: bytes) -> None
¶
Internal helper: publish complete bytes and verify every existing identity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parts
|
tuple[str, ...]
|
Fixed internal content-addressed path components. |
required |
data
|
bytes
|
Complete immutable artifact bytes to publish without overwrite. |
required |
Raises:
| Type | Description |
|---|---|
EvidenceIntegrityError
|
Existing identity or filesystem kinds conflict. |
OSError
|
Creation, fsync, hard-link publication, or cleanup failed. |
Source code in fuzzy1337/evidence.py
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | |
Put(data: bytes, role: str, media_type: str, provenance: EvidenceProvenance) -> EvidenceRecord
¶
Publish immutable raw bytes followed by their versioned manifest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
bytes
|
Authorized non-secret raw bytes; no parsing or normalization. |
required |
role
|
str
|
Existing adapter role identifier, such as stdout or stderr. |
required |
media_type
|
str
|
Explicit payload media type. |
required |
provenance
|
EvidenceProvenance
|
Immutable collection attribution, never authorization. |
required |
Returns:
| Type | Description |
|---|---|
EvidenceRecord
|
Verified record usable by the unchanged adapter EvidenceReference. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Caller-supplied contract values are invalid. |
EvidenceError
|
A path is unsafe, identity is corrupt, or publication failed. A valid orphan blob may remain after manifest failure. |
Source code in fuzzy1337/evidence.py
511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | |
Read(reference: EvidenceReference) -> bytes
¶
Read an adapter reference and verify exact address, digest, and length.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
EvidenceReference
|
Existing adapter contract with canonical evidence locator. |
required |
Returns:
| Type | Description |
|---|---|
bytes
|
Original raw bytes only after integrity verification succeeds. |
Raises:
| Type | Description |
|---|---|
ValueError
|
The reference is invalid or uses a noncanonical locator. |
EvidenceError
|
Evidence is missing, unsafe, unreadable, or corrupt. |
Source code in fuzzy1337/evidence.py
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | |
Get(evidence_id: str) -> EvidenceRecord
¶
Load a canonical manifest and verify its identity and referenced bytes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
evidence_id
|
str
|
Manifest identity in sha256: |
required |
Returns:
| Type | Description |
|---|---|
EvidenceRecord
|
Immutable verified record, including unchanged adapter reference. |
Raises:
| Type | Description |
|---|---|
ValueError
|
The supplied identity is invalid. |
EvidenceError
|
A manifest or blob is missing, unsafe, corrupt, or unreadable; unsupported schema versions are integrity failures. |
Source code in fuzzy1337/evidence.py
591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | |
RequireEvidenceDigest(value: str) -> None
¶
Internal helper: require a lowercase digest without accepting path syntax.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
Candidate lowercase SHA-256 digest. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
The digest is invalid. |
Source code in fuzzy1337/evidence.py
47 48 49 50 51 52 53 54 55 56 57 58 | |
NormalizeEvidenceTime(value: str) -> str
¶
Internal helper: normalize offset-aware collection times to UTC.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
Single-line ISO 8601 datetime with an explicit UTC offset. |
required |
Returns:
| Type | Description |
|---|---|
str
|
UTC ISO 8601 text with fixed microsecond precision. |
Raises:
| Type | Description |
|---|---|
ValueError
|
The timestamp is invalid or lacks an offset. |
OverflowError
|
UTC conversion exceeds the datetime range. |
Source code in fuzzy1337/evidence.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
UniqueManifestObject(pairs: list[tuple[str, object]]) -> dict[str, object]
¶
Internal parser hook: reject duplicate JSON keys at every nesting level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pairs
|
list[tuple[str, object]]
|
Ordered fields decoded by the standard JSON parser. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
Detached mapping containing each field once. |
Raises:
| Type | Description |
|---|---|
ValueError
|
A JSON field occurs more than once. |
Source code in fuzzy1337/evidence.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
RejectManifestConstant(value: str) -> None
¶
Internal parser hook: reject NaN and infinities before schema validation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
Nonstandard numeric constant encountered by the JSON parser. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
Always, because these constants are not valid JSON numbers. |
Source code in fuzzy1337/evidence.py
259 260 261 262 263 264 265 266 267 268 269 | |
RequireManifestFields(value: object, expected: set[str]) -> dict[str, object]
¶
Internal parser helper: require exact fields without ignoring unknown values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
object
|
Decoded candidate schema object. |
required |
expected
|
set[str]
|
Complete schema-v1 field-name set for that object. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
The validated decoded dictionary, without coercion or ignored fields. |
Raises:
| Type | Description |
|---|---|
ValueError
|
The object type or field set does not match. |
Source code in fuzzy1337/evidence.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | |
ParseEvidenceManifest(data: bytes) -> EvidenceRecord
¶
Validate one schema-v1 manifest without accessing a filesystem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
bytes
|
Canonical UTF-8 JSON manifest bytes. |
required |
Returns:
| Type | Description |
|---|---|
EvidenceRecord
|
Immutable record whose identifier derives from its canonical manifest. |
Raises:
| Type | Description |
|---|---|
ValueError
|
JSON, schema, provenance, or canonical encoding is invalid. |
Source code in fuzzy1337/evidence.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
CheckStorageEntry(path: Path, directory: bool) -> os.stat_result
¶
Internal filesystem check: reject links/reparse points and invalid kinds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Explicit owned root component or artifact path to inspect. |
required |
directory
|
bool
|
Whether the entry must be a directory rather than regular file. |
required |
Returns:
| Type | Description |
|---|---|
stat_result
|
Observed lstat metadata without following a link at this entry. |
Raises:
| Type | Description |
|---|---|
EvidenceIntegrityError
|
A link, reparse point, or invalid kind is observed. |
OSError
|
The metadata could not be read. |
Source code in fuzzy1337/evidence.py
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | |