╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ patch.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
428 429 _ = arena.reset(.retain_capacity); 430 const status_moment = try evt.currentMoment(repo_opts, &target); 431 const merged_child_record = (try evt.Patch.readById(Repo.DB, repo_opts.hash, status_moment, &arena, &child_id)) orelse return error.NotFound; 432 try std.testing.expectEqual(.merged, merged_child_record.event.status.kind()); 433 try std.testing.expectEqual(0, try patchStatusCount(status_moment, .open)); 434 try std.testing.expectEqual(1, try patchStatusCount(status_moment, .closed)); 435 try std.testing.expectEqual(1, try patchStatusCount(status_moment, .merged)); 436 try std.testing.expectEqual(1, try patchTagStatusCount(status_moment, "enhancement", .merged)); 437 const status_conflicts_cursor = try status_moment.getCursor(hash.hashInt(repo_opts.hash, evt.Patch.conflicts_key)) orelse return error.NotFound; 438 const status_conflicts = try Repo.DB.SortedMap(.read_only).init(status_conflicts_cursor); 439 const child_conflict = try status_conflicts.getCursor(&evt.orderKeyDesc(merged_child_record.created_order, &child_id)); 440 try std.testing.expectEqual(null, child_conflict); 441 442 var reopened_child = merged_child_record.event; 443 reopened_child.status = .open; 444 try std.testing.expectError(error.PatchAlreadyMerged, evt.consume(.repo, .xit, repo_opts, io, allocator, &target, evt.events_ref, &.{.{ 445 .id = std.fmt.bytesToHex(child_id, .lower), 446 .timestamp = 16, 447 .author = author, 448 .event = .{ .patch = reopened_child }, 449 }})); 450 451 const invalid_merged_id = evt.EventWithId.randomId(prng.random()); 452 try std.testing.expectError(error.InvalidPatch, evt.consume(.repo, .xit, repo_opts, io, allocator, &target, evt.events_ref, &.{.{ 453 .id = std.fmt.bytesToHex(invalid_merged_id, .lower), 454 .timestamp = 16, 455 .author = author, 456 .event = .{ .patch = .{ 457 .title = "invalid merged patch", 458 .description = "has no revision", 459 .tags = "enhancement", 460 .target_branch = "master", 461 .status = .{ .merged = &base_oid }, 462 } }, 463 }})); 464 465 // 466 // retain the ref-free commits during garbage collection 467 // 468 469 { 470 const roots = try evt.PatchRev.gcRoots(Repo.DB, repo_opts.hash, allocator, stacked_moment); 471 defer allocator.free(roots); 472 try std.testing.expectEqual(4, roots.len); 473 _ = try target.garbageCollect(io, allocator, roots); 474 475 var after_gc_moment = try target.core.latestMoment(); 476 const after_gc_state = Repo.State(.read_only){ .core = &target.core, .extra = .{ .moment = &after_gc_moment } }; 477 var retained = try obj.Object(.xit, repo_opts).init(after_gc_state, io, allocator, &roots[0]); 478 retained.deinit(); 479 } 480 } 481 482 test "patch lifecycle" { 483 try patchLifecycle(.squash); 484 try patchLifecycle(.source); 485 } 486 487 fn patchLifecycle(merge_revision: pch.MergeRevision) !void { 488 const io = std.testing.io; 489 const allocator = std.testing.allocator; 490 491 var temp = std.testing.tmpDir(.{}); 492 defer temp.cleanup(); 493 const temp_path = try temp.dir.realPathFileAlloc(io, ".", allocator); 494 defer allocator.free(temp_path); 495 496 const repos_dir = try std.fs.path.join(allocator, &.{ temp_path, "repos" }); 497 defer allocator.free(repos_dir); 498 const admin_path = try std.fs.path.join(allocator, &.{ temp_path, "admin" }); 499 defer allocator.free(admin_path); 500 const upstream_path = try std.fs.path.join(allocator, &.{ temp_path, "upstream" }); 501 defer allocator.free(upstream_path); 502 const source_path = try std.fs.path.join(allocator, &.{ temp_path, "source" }); 503 defer allocator.free(source_path); 504 505 var prng = std.Random.DefaultPrng.init(std.testing.random_seed); 506 const user_id = evt.EventWithId.randomId(prng.random()); 507 const repo_id = evt.EventWithId.randomId(prng.random()); 508 const repo_id_hex = std.fmt.bytesToHex(repo_id, .lower); 509 const target_path = try std.fs.path.join(allocator, &.{ repos_dir, &repo_id_hex }); 510 defer allocator.free(target_path); 511 512 var admin = try rp.Repo(.xit, evt.admin_repo_opts).init(io, allocator, .{ .path = admin_path }); 513 defer admin.deinit(io, allocator); 514 try evt.consume(.admin, .xit, evt.admin_repo_opts, io, allocator, &admin, evt.events_ref, &.{ 515 .{ 516 .id = std.fmt.bytesToHex(user_id, .lower), 517 .timestamp = 1, 518 .author = author, 519 .event = .{ .user = .{ 520 .name = author.name, 521 .email = author.email, 522 .password_hash = "", 523 } }, 524 }, 525 .{ 526 .id = repo_id_hex, 527 .timestamp = 1, 528 .author = author, 529 .event = .{ .repo = .{ 530 .user_id = &user_id, 531 .name = "repo", 532 .description = "", 533 } }, 534 }, 535 }); 536 537 // 538 // create the target repo 539 // 540 541 { 542 var upstream = try rp.Repo(.git, .{ .is_test = true }).init(io, allocator, .{ .path = upstream_path }); 543 defer upstream.deinit(io, allocator); 544 const file = try upstream.core.work_dir.createFile(io, "main.zig", .{ .truncate = true }); 545 defer file.close(io); 546 try file.writeStreamingAll(io, "pub fn main() void {}\n"); 547 try upstream.add(io, allocator, &.{"main.zig"}); 548 _ = try upstream.commit(io, allocator, .{ .author = "alice <alice@example.test>", .message = "initial code", .timestamp = 1 }); 549 } 550 var target = try Repo.clone(io, allocator, upstream_path, target_path, target_path, null, .{}); 551 defer target.deinit(io, allocator); 552 553 // 554 // create the patch draft in the fork 555 // 556 557 const patch_id = evt.EventWithId.randomId(prng.random()); 558 const patch_id_hex = std.fmt.bytesToHex(patch_id, .lower); 559 const draft_path = try fork.create(repo_opts, io, allocator, repos_dir, &admin, .{ 560 .target_branch = "master", 561 .id = patch_id_hex, 562 .user_id = user_id, 563 .repo_id = repo_id, 564 .title = "add the answer", 565 .tags = "enhancement", 566 .description = "adds a reusable answer constant", 567 .author = author, 568 .timestamp = 2, 569 }); 570 defer allocator.free(draft_path); 571 572 // 573 // create and record the proposed revision in the fork 574 // 575 576 const base_oid = (try target.readRef(io, .{ .kind = .head, .name = "master" })) orelse return error.NotFound; 577 const base_tree_oid = try commitTree(io, allocator, &target, &base_oid); 578 var source = try Repo.clone(io, allocator, upstream_path, source_path, source_path, null, .{}); 579 defer source.deinit(io, allocator); 580 const source_oid = blk: { 581 const file = try source.core.work_dir.createFile(io, "feature.zig", .{ .truncate = true }); 582 defer file.close(io); 583 try file.writeStreamingAll(io, "pub const answer = 42;\n"); 584 try source.add(io, allocator, &.{"feature.zig"}); 585 break :blk try source.commit(io, allocator, .{ .author = "alice <alice@example.test>", .message = "add feature", .timestamp = 2 }); 586 }; 587 const head_tree_oid = try commitTree(io, allocator, &source, &source_oid); 588 const first_patchrev_id = evt.EventWithId.randomId(prng.random()); 589 const first_patchrev_hex = std.fmt.bytesToHex(first_patchrev_id, .lower); 590 const first_entries = [_]evt.EventTreeEntry{ 591 .{ .tree = .{ .name = "base", .oid = &base_tree_oid } }, 592 .{ .tree = .{ .name = "head", .oid = &head_tree_oid } }, 593 }; 594 { 595 var draft = try Repo.open(io, allocator, .{ .path = draft_path }); 596 defer draft.deinit(io, allocator); 597 var arena = std.heap.ArenaAllocator.init(allocator); 598 defer arena.deinit(); 599 600 const initial_moment = try evt.currentMoment(repo_opts, &draft); 601 const initial_patch = (try evt.Patch.readById(Repo.DB, repo_opts.hash, initial_moment, &arena, &patch_id)) orelse return error.NotFound; 602 try std.testing.expect(!initial_patch.removed); 603 try std.testing.expectEqualStrings("add the answer", initial_patch.event.title); 604 try std.testing.expectEqual(null, initial_patch.event.revision); 605 try std.testing.expectEqual(null, try evt.PatchRev.readNewest(Repo.DB, repo_opts.hash, initial_moment, &arena)); 606 607 var source_moment = try source.core.latestMoment(); 608 const source_state = Repo.State(.read_only){ .core = &source.core, .extra = .{ .moment = &source_moment } }; 609 var objects = try obj.ObjectIterator(.xit, repo_opts).init(source_state, io, allocator, .{ .kind = .all }); 610 defer objects.deinit(); 611 try objects.include(&source_oid); 612 try draft.copyObjects(.xit, repo_opts, &objects, io, null); 613 try consumePatchWithRevision(.fork, io, allocator, &draft, evt.events_ref, first_patchrev_id, .{ 614 .base_oid = &base_oid, 615 .source_oid = &source_oid, 616 .message = "add the answer", 617 }, &first_entries, 3, patch_id, .{ 618 .title = "add the answer", 619 .tags = "enhancement", 620 .description = "adds a reusable answer constant", 621 .target_branch = "master", 622 }, 3); 623 624 _ = arena.reset(.retain_capacity); 625 const moment = try evt.currentMoment(repo_opts, &draft); 626 const patch = (try evt.Patch.readById(Repo.DB, repo_opts.hash, moment, &arena, &patch_id)) orelse return error.NotFound; 627 try std.testing.expect(!patch.removed); 628 try std.testing.expectEqualStrings(&first_patchrev_hex, &(patch.event.revision orelse return error.NotFound).id); 629 try std.testing.expect(null != try evt.PatchRev.readById(Repo.DB, repo_opts.hash, moment, &arena, &first_patchrev_id)); 630 } 631 try std.testing.expectError(error.NotFound, evt.currentMoment(repo_opts, &target)); 632 633 // 634 // publish another draft before its first push 635 // 636 637 const unpushed_id = evt.EventWithId.randomId(prng.random()); 638 const unpushed_id_hex = std.fmt.bytesToHex(unpushed_id, .lower); 639 const unpushed_path = try fork.create(repo_opts, io, allocator, repos_dir, &admin, .{ 640 .id = unpushed_id_hex, 641 .user_id = user_id, 642 .repo_id = repo_id, 643 .title = "explain the answer", 644 .tags = "documentation", 645 .description = "describes the existing answer", 646 .target_branch = "master", 647 .author = author, 648 .timestamp = 3, 649 }); 650 defer allocator.free(unpushed_path); 651 try pch.publish(repo_opts, io, allocator, &admin, &target, unpushed_path, .{ 652 .id = unpushed_id_hex, 653 .user_id = user_id, 654 .repo_id = repo_id, 655 .author = author, 656 .timestamp = 4, 657 }); 658 { 659 var verify_arena = std.heap.ArenaAllocator.init(allocator); 660 defer verify_arena.deinit(); 661 const target_moment = try evt.currentMoment(repo_opts, &target); 662 const unpushed = (try evt.Patch.readById(Repo.DB, repo_opts.hash, target_moment, &verify_arena, &unpushed_id)) orelse return error.NotFound; 663 try std.testing.expectEqual(null, unpushed.event.revision); 664 665 var unpushed_repo = try Repo.open(io, allocator, .{ .path = unpushed_path }); 666 defer unpushed_repo.deinit(io, allocator); 667 const fork_moment = try evt.currentMoment(repo_opts, &unpushed_repo); 668 const removed = (try evt.Patch.readById(Repo.DB, repo_opts.hash, fork_moment, &verify_arena, &unpushed_id)) orelse return error.NotFound; 669 try std.testing.expect(removed.removed); 670 } 671 672 // 673 // edit the patch metadata in the fork 674 // 675 676 try std.testing.expect(try pch.editDraft(repo_opts, io, allocator, &admin, draft_path, .{ 677 .id = patch_id_hex, 678 .user_id = user_id, 679 .repo_id = repo_id, 680 .title = "explain the answer", 681 .tags = "enhancement documentation", 682 .description = "adds and explains a reusable answer constant", 683 .target_branch = "master", 684 .author = author, 685 .timestamp = 4, 686 })); 687 688 // 689 // publish the metadata and revision pointer 690 // 691 692 try pch.publish(repo_opts, io, allocator, &admin, &target, draft_path, .{ 693 .id = patch_id_hex, 694 .user_id = user_id, 695 .repo_id = repo_id, 696 .author = author, 697 .timestamp = 5, 698 }); 699 try pch.publish(repo_opts, io, allocator, &admin, &target, draft_path, .{ 700 .id = patch_id_hex, 701 .user_id = user_id, 702 .repo_id = repo_id, 703 .author = author, 704 .timestamp = 6, 705 }); 706 707 var arena = std.heap.ArenaAllocator.init(allocator); 708 defer arena.deinit(); 709 const moment = try evt.currentMoment(repo_opts, &target); 710 const patch = (try evt.Patch.readById(Repo.DB, repo_opts.hash, moment, &arena, &patch_id)) orelse return error.NotFound; 711 try std.testing.expectEqualStrings("explain the answer", patch.event.title); 712 try std.testing.expectEqualStrings(&first_patchrev_hex, &(patch.event.revision orelse return error.NotFound).id); 713 try std.testing.expectEqual(.open, patch.event.status); 714 try std.testing.expectEqual(null, try evt.PatchRev.readById(Repo.DB, repo_opts.hash, moment, &arena, &first_patchrev_id)); 715 716 _ = arena.reset(.retain_capacity); 717 const admin_moment = try evt.currentMoment(evt.admin_repo_opts, &admin); 718 const published_fork = (try evt.Fork.readById(evt.AdminDB, evt.admin_repo_opts.hash, admin_moment, &arena, &patch_id)) orelse return error.NotFound; 719 try std.testing.expect(!published_fork.removed); 720 try std.testing.expectEqual(.publish, published_fork.event.stage); 721 const draft_key = evt.Fork.draftKey(&repo_id, &user_id); 722 try std.testing.expectEqual(0, try indexedForkCount(admin_moment, evt.Fork.repo_user_to_draft_id_set_key, &draft_key)); 723 try std.testing.expectEqual(2, try indexedForkCount(admin_moment, evt.Fork.user_id_to_fork_id_set_key, &user_id)); 724 var squash_oid: [hash.hexLen(repo_opts.hash)]u8 = undefined; 725 { 726 var draft = try Repo.open(io, allocator, .{ .path = draft_path }); 727 defer draft.deinit(io, allocator); 728 _ = arena.reset(.retain_capacity); 729 const draft_moment = try evt.currentMoment(repo_opts, &draft); 730 const removed = (try evt.Patch.readById(Repo.DB, repo_opts.hash, draft_moment, &arena, &patch_id)) orelse return error.NotFound; 731 try std.testing.expect(removed.removed); 732 const revision = (try evt.PatchRev.readById(Repo.DB, repo_opts.hash, draft_moment, &arena, &first_patchrev_id)) orelse return error.NotFound; 733 @memcpy(&squash_oid, revision.patch_oid); 734 try std.testing.expectEqualStrings("master", removed.event.target_branch); 735 try std.testing.expectEqual(hash.hexLen(repo_opts.hash), revision.event_oid.len); 736 var event_oid: [hash.hexLen(repo_opts.hash)]u8 = undefined; 737 @memcpy(&event_oid, revision.event_oid); 738 var repo_moment = try draft.core.latestMoment(); 739 const state = Repo.State(.read_only){ .core = &draft.core, .extra = .{ .moment = &repo_moment } }; 740 var event_object = try obj.Object(.xit, repo_opts).initCommit(state, io, allocator, &event_oid); 741 defer event_object.deinit(); 742 const trees = try evt.PatchRev.readTrees(.xit, repo_opts, state, io, allocator, &event_object.content.commit.tree); 743 try std.testing.expectEqualStrings(revision.base_tree_oid, &trees.base); 744 try std.testing.expectEqualStrings(revision.head_tree_oid, &trees.head); 745 } 746 747 // 748 // merge the selected revision into the target 749 // 750 751 try evt.Patch.update(.xit, repo_opts, io, allocator, &target, &patch_id, .{ .status = .closed }, author); 752 try std.testing.expectError(error.PatchClosed, pch.merge(repo_opts, io, allocator, repos_dir, &target, .{ 753 .id = patch_id_hex, 754 .revision = merge_revision, 755 .author = author, 756 .timestamp = 5, 757 })); 758 try evt.Patch.update(.xit, repo_opts, io, allocator, &target, &patch_id, .{ .status = .open }, author); 759 760 const selected_oid = switch (merge_revision) { 761 .squash => squash_oid, 762 .source => source_oid, 763 }; 764 try pch.mergeAndRemoveFork(repo_opts, io, allocator, repos_dir, &admin, &target, .{ 765 .id = patch_id_hex, 766 .revision = merge_revision, 767 .author = author, 768 .timestamp = 5, 769 }); 770 const target_oid = (try target.readRef(io, .{ .kind = .head, .name = "master" })) orelse return error.NotFound; 771 try std.testing.expectEqualStrings(&selected_oid, &target_oid); 772 773 _ = arena.reset(.retain_capacity); 774 const merged_moment = try evt.currentMoment(repo_opts, &target); 775 const merged = (try evt.Patch.readById(Repo.DB, repo_opts.hash, merged_moment, &arena, &patch_id)) orelse return error.NotFound; 776 try std.testing.expectEqual(.merged, merged.event.status.kind()); 777 const merged_oid = switch (merged.event.status) { 778 .merged => |oid| oid, 779 else => return error.InvalidPatch, 780 }; 781 try std.testing.expectEqualStrings(&selected_oid, merged_oid); 782 try std.testing.expect(null != try evt.PatchRev.readById(Repo.DB, repo_opts.hash, merged_moment, &arena, &first_patchrev_id)); 783 784 _ = arena.reset(.retain_capacity); 785 const removed_fork = (try evt.Fork.readById(evt.AdminDB, evt.admin_repo_opts.hash, try evt.currentMoment(evt.admin_repo_opts, &admin), &arena, &patch_id)) orelse return error.NotFound; 786 try std.testing.expect(removed_fork.removed); 787 } 788 789 fn indexedForkCount( 790 moment: evt.AdminDB.HashMap(.read_only), 791 index_key: []const u8, 792 parent_id: []const u8, 793 ) !u64 { 794 const index_cursor = try moment.getCursor(hash.hashInt(evt.admin_repo_opts.hash, index_key)) orelse return 0; 795 const index = try evt.AdminDB.HashMap(.read_only).init(index_cursor); 796 const ids_cursor = try index.getCursor(hash.hashInt(evt.admin_repo_opts.hash, parent_id)) orelse return 0; 797 const ids = try evt.AdminDB.SortedSet(.read_only).init(ids_cursor); 798 return try ids.count(); 799 } 800 801 fn patchStatusCount(moment: Repo.DB.HashMap(.read_only), status: evt.Patch.StatusKind) !u64 { 802 const statuses_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, evt.Patch.status_to_id_set_key)) orelse return 0; 803 const statuses = try Repo.DB.SortedMap(.read_only).init(statuses_cursor); 804 const ids_cursor = try statuses.getCursor(@tagName(status)) orelse return 0; 805 const ids = try Repo.DB.SortedSet(.read_only).init(ids_cursor); 806 return try ids.count(); 807 } 808 809 fn patchTagStatusCount(moment: Repo.DB.HashMap(.read_only), tag: []const u8, status: evt.Patch.StatusKind) !u64 { 810 const tags_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, evt.Patch.tag_status_to_id_set_key)) orelse return 0; 811 const tags = try Repo.DB.SortedMap(.read_only).init(tags_cursor); 812 var key_buffer: evt.Patch.TagStatusKey = undefined; 813 const ids_cursor = try tags.getCursor(try evt.Patch.tagStatusKey(&key_buffer, tag, status)) orelse return 0; 814 const ids = try Repo.DB.SortedSet(.read_only).init(ids_cursor); 815 return try ids.count(); 816 } 817