mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-12-02 09:03:37 +01:00
Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts: # public/asset-manifest.json # public/script/vendor.min.js
This commit is contained in:
commit
4e622adea3
13 files changed
+252
-80
No files matched your search
@@ -42,7 +42,7 @@ if service == "mongodb" {
|
||||
if includes(["quota_denied", "deployment", "account_removed", "application_log", "billing_maintenance_failed", "billing_reconciliation_deferred", "billing_requires_attention", "billing_worker_failed", "blob_api_failed_falling_back_to_raw_url", "branch_not_found", "cache_removal_failed", "cache_removed", "checking_repository_status_and_unused_repositories", "cleared_lock_for_active_job", "conference_expire_failed", "content_expiration_failed", "daily_stats_snapshot_failed", "daily_stats_snapshot_stored", "download_completed", "download_start", "downloaded", "downloadfile_failed", "downloading_file", "downloading_gist", "downloading_pull_request", "downloading_via_raw_url_lfs", "duplicate_stripe_customer_requires_review", "ensuretodaysnapshot_failed", "error_log_redis_connect_failed", "expired_repository_cleanup_failed", "failed_removal_recovery_failed", "failed_to_persist_error_status", "failed_to_record_repository_removal_error", "gettoken", "github_primary_rate_limit_hit", "github_secondary_rate_limit_hit", "grant_revocation_failed", "initial_repository_status_check_failed", "job_completed", "job_failed", "job_stalled", "job_started", "lastusedat_update_failed", "login_token_failed", "login_token_req_login_failed", "logout_after_account_removal_failed", "logout_failed", "lookup_failed", "markerrorifinflight_failed", "markerrorifremoving_failed", "metadata_cleanup_complete", "metadata_cleanup_deferred", "owner_access_alert_reset_unavailable", "owner_access_email_accepted", "owner_access_email_audit_unavailable", "owner_access_email_claim_cleanup_unavailable", "owner_access_email_deferred_recovery_unavailable", "owner_access_email_delivery_failed", "owner_access_email_preparation_cleanup_unavailable", "owner_access_email_recovery_recorded", "owner_access_email_recovery_unavailable", "owner_access_email_result_reconciliation_required", "owner_access_email_unavailable", "pr_comments_404_continuing_without_them", "process_fatal_error", "process_heartbeat", "process_started", "progress", "queue_heartbeat", "queued_for_download", "rate_limit_gate_active_delaying_job_before_work", "rate_limit_gate_set", "rate_limited_delaying_job", "recover_failed", "recovered_expired_repository_cleanup", "recovered_file_from_truncated_tree", "recovered_file_invalidation_failed", "recovered_stuck_repo", "recoverstuckpreparing_failed", "recoverstuckremoving_failed", "redis_client_error", "redis_rate_limit_gate_written", "rejected_upstream_download_destination", "removal_failed", "removal_recovery_failed", "removecache_save_failed", "removed_cache_for_unused_repository", "removing_cache", "removing_repository", "repo_claimed", "repository_cache_removal_failed", "repository_expiration_failed", "repository_expired", "repository_removal_failed", "repository_removed", "request_cancelled", "request_completed", "request_slow", "requeued_failed_removal", "requeued_interrupted_removal", "reset", "retired_tree_cleanup_deferred", "retired_tree_cleanup_failed", "running_daily_stats_snapshot", "s3_body_stream_error", "send_failed", "server_started", "source_stream_failed_cache_write_discarded", "staged_tree_cleanup_failed", "staged_tree_completion_deferred", "streamer_fetch_failed", "streamer_started", "streamer_startup_failed", "streamer_zip_fetch_failed", "temporary_storage_cleanup_deferred", "token_refresh_failed_backing_off", "up_to_date", "update_queued", "verify_failed", "waiting_for_rate_limit_gate", "webhook_log", "webhook_processing_failed", "write_failed", "zip_stream_failed"], record.event) { out.event = record.event }
|
||||
if is_string(record.release) && match(string!(record.release), r'^[a-f0-9]{7,40}$') { out.release = record.release }
|
||||
if is_string(record.instance) && match(string!(record.instance), r'^[a-f0-9-]{36}$') { out.instance = record.instance }
|
||||
if includes(["repo_renamed", "preparation_interrupted", "commit_not_found", "zip_not_available", "ABORT_ERR", "ECONNREFUSED", "ECONNRESET", "ENOTFOUND", "EPIPE", "ETIMEDOUT", "billing_address_missing", "billing_city_missing", "billing_country_missing", "billing_email_missing", "billing_missing", "billing_name_missing", "billing_zip_missing", "branch_not_found", "branch_not_specified", "cache_busy", "cache_miss", "cannot_coauthor_self", "commit_not_specified", "conf_end_date_invalid", "conf_end_date_missing", "conf_id_missing", "conf_id_used", "conf_name_missing", "conf_not_activated", "conf_not_found", "conf_start_date_invalid", "conf_start_date_missing", "conference_not_found", "connection_changed", "download_not_enabled", "expiration_limit_reached", "file_listing_too_large", "file_not_accessible", "file_not_found", "file_not_supported", "file_too_big", "folder_not_supported", "gistId_already_used", "gistId_not_specified", "gist_expired", "gist_not_found", "gist_not_ready", "github_app_access_required", "github_app_reconnect_required", "github_identity_mismatch", "github_rate_limit_exceeded", "github_token_invalid", "github_user_not_found", "invalid_commit_format", "invalid_cursor", "invalid_file_path", "invalid_gistId", "invalid_path", "invalid_plan", "invalid_preserve_files_format", "invalid_project_name", "invalid_pullRequestId", "invalid_repo", "invalid_repoId", "invalid_request", "invalid_settings", "invalid_signature", "invalid_sort", "invalid_status", "invalid_terms_format", "invalid_token_id", "invalid_token_options", "is_removed", "not_authorized", "not_connected", "options_not_provided", "page_not_activated", "page_not_supported_on_different_branch", "path_not_defined", "path_not_specified", "pullRequestId_already_used", "pullRequestId_is_not_a_number", "pullRequestId_not_specified", "pull_request_expired", "pull_request_not_found", "pull_request_not_ready", "token_refresh_failed", "anonymized_output_too_large", "anonymization_memory_budget_exceeded", "anonymization_queue_full", "anonymization_queue_timeout", "anonymization_cancelled", "anonymization_worker_exited", "anonymization_deadline_exceeded", "anonymization_spool_budget_exceeded", "anonymization_worker_failed", "anonymization_storage_full", "anonymization_io_failed", "zip_unsafe_entry_path", "quota_exceeded", "quota_repository_limit", "quota_storage_limit", "rate_limited", "readme_not_available", "repoId_already_used", "repoId_not_defined", "repoUrl_not_defined", "repo_access_limited", "repo_empty", "repo_not_accessible", "repo_not_found", "repo_saml_enforcement", "repository_archived", "repository_changed", "repository_expired", "repository_job_cancelled", "repository_not_found", "repository_not_ready", "repository_not_specified", "repository_tree_incomplete", "repository_tree_too_large", "s3_config_not_provided", "source_not_provided", "storage_delete_failed", "storage_write_size_mismatch", "submodule_not_available", "terms_not_specified", "token_expired", "token_limit_reached", "unable_to_connect_user", "unable_to_download", "upstream_error", "upstream_timeout", "user_not_found", "username_not_defined", "webhook_processing_failed", "another_login_required", "billing_already_paid", "billing_busy", "billing_checkout_disabled", "billing_checkout_in_progress", "billing_customer_mismatch", "billing_draft_not_found", "billing_invalid_conference", "billing_invalid_draft", "billing_invalid_purchase", "billing_invalid_repository_size", "billing_invalid_review_window", "billing_plan_change_not_supported", "billing_plan_unavailable", "billing_price_misconfigured", "billing_recovery_required", "billing_review_window_locked", "billing_subscription_exists", "billing_unavailable", "conference_payment_required", "gist_not_available", "github_app_authorization_cancelled", "github_app_disabled", "github_app_permissions_invalid", "github_app_refresh_busy", "github_grant_revocation_failed", "github_oauth_required", "github_unavailable", "invalid_auth_state", "invalid_billing_expiration", "invalid_connection", "invalid_github_path", "not_owner", "oauth_resources_remaining", "pull_request_not_available", "repository_busy", "repository_not_accessible", "streamer_unreachable", "streamer_upstream_error", "subscription_required_for_never_expiration", "user_banned", "sync_failed"], record.errorCode) { out.errorCode = record.errorCode }
|
||||
if includes(["repo_renamed", "preparation_interrupted", "commit_not_found", "zip_not_available", "ABORT_ERR", "ECONNREFUSED", "ECONNRESET", "ENOTFOUND", "EPIPE", "ETIMEDOUT", "billing_address_missing", "billing_city_missing", "billing_country_missing", "billing_email_missing", "billing_missing", "billing_name_missing", "billing_zip_missing", "branch_not_found", "branch_not_specified", "cache_busy", "cache_miss", "cannot_coauthor_self", "commit_not_specified", "conf_end_date_invalid", "conf_end_date_missing", "conf_id_missing", "conf_id_used", "conf_name_missing", "conf_not_activated", "conf_not_found", "conf_start_date_invalid", "conf_start_date_missing", "conference_not_found", "connection_changed", "download_not_enabled", "expiration_limit_reached", "file_listing_too_large", "file_not_accessible", "file_not_found", "file_not_supported", "file_too_big", "folder_not_supported", "gistId_already_used", "gistId_not_specified", "gist_expired", "gist_not_found", "gist_not_ready", "github_app_access_required", "github_app_reconnect_required", "github_identity_mismatch", "github_rate_limit_exceeded", "github_token_invalid", "github_user_not_found", "invalid_commit_format", "invalid_cursor", "invalid_file_path", "invalid_gistId", "invalid_path", "invalid_plan", "invalid_preserve_files_format", "invalid_project_name", "invalid_pullRequestId", "invalid_repo", "invalid_repoId", "invalid_request", "invalid_settings", "invalid_signature", "invalid_sort", "invalid_status", "invalid_terms_format", "invalid_token_id", "invalid_token_options", "is_removed", "not_authorized", "not_connected", "options_not_provided", "page_not_activated", "page_not_supported_on_different_branch", "path_not_defined", "path_not_specified", "pullRequestId_already_used", "pullRequestId_is_not_a_number", "pullRequestId_not_specified", "pull_request_expired", "pull_request_not_found", "pull_request_not_ready", "token_refresh_failed", "anonymized_output_too_large", "anonymization_memory_budget_exceeded", "anonymization_queue_full", "anonymization_queue_timeout", "anonymization_cancelled", "anonymization_worker_exited", "anonymization_deadline_exceeded", "anonymization_spool_budget_exceeded", "anonymization_worker_failed", "anonymization_storage_full", "anonymization_io_failed", "zip_unsafe_entry_path", "quota_exceeded", "quota_repository_limit", "quota_storage_limit", "rate_limited", "readme_not_available", "repoId_already_used", "repoId_not_defined", "repoUrl_not_defined", "repo_access_limited", "repo_empty", "repo_not_accessible", "repo_not_found", "repo_saml_enforcement", "repository_archived", "repository_changed", "repository_expired", "repository_job_cancelled", "repository_not_found", "repository_not_ready", "repository_not_specified", "repository_tree_incomplete", "repository_tree_too_large", "s3_config_not_provided", "source_not_provided", "storage_delete_failed", "storage_write_size_mismatch", "submodule_not_available", "terms_not_specified", "token_expired", "token_limit_reached", "unable_to_connect_user", "unable_to_download", "upstream_error", "upstream_timeout", "user_not_found", "username_not_defined", "webhook_processing_failed", "another_login_required", "billing_already_paid", "billing_busy", "billing_checkout_disabled", "billing_checkout_in_progress", "billing_customer_mismatch", "billing_draft_not_found", "billing_invalid_conference", "billing_invalid_draft", "billing_invalid_purchase", "billing_invalid_repository_size", "billing_invalid_review_window", "billing_plan_change_not_supported", "billing_plan_unavailable", "billing_price_misconfigured", "billing_recovery_required", "billing_review_window_locked", "billing_subscription_exists", "billing_unavailable", "conference_payment_required", "gist_not_available", "github_app_authorization_cancelled", "github_app_disabled", "github_app_permissions_invalid", "github_app_refresh_busy", "github_grant_revocation_failed", "github_oauth_required", "github_unavailable", "invalid_auth_state", "invalid_billing_expiration", "invalid_connection", "invalid_github_path", "not_owner", "oauth_resources_remaining", "pull_request_not_available", "repository_busy", "repository_not_accessible", "streamer_unreachable", "streamer_upstream_error", "subscription_required_for_never_expiration", "user_banned", "sync_failed", "streamer_route_not_found", "streamer_unexpected_response"], record.errorCode) { out.errorCode = record.errorCode }
|
||||
if includes(["admin", "anonymized-file", "auth", "billing", "dailyStats", "file-tree", "fs", "gh-stream", "gist", "github", "github-app-webhook", "owner-notifications", "process", "pull-request", "queue", "queue:cache", "queue:download", "queue:remove", "repository", "repository-public", "requests", "route", "route:repo", "s3", "schedule", "server", "streamer", "temporary-storage", "token-auth", "user", "zip-stream"], record.module) { out.module = record.module }
|
||||
if includes(["protocol", "credentials", "port", "host"], record.reason) { out.reason = record.reason }
|
||||
if includes(["parse", "find_grant_owners", "reconcile_grant", "persist_installation_block", "reconcile_installation"], record.phase) { out.phase = record.phase }
|
||||
@@ -81,7 +81,7 @@ if includes(["/", "other", "/dashboard", "/anonymize", "/healthcheck", "/api/hea
|
||||
}
|
||||
}
|
||||
# BEGIN GENERATED DIAGNOSTICS
|
||||
source_functions = {"src/cli/index.ts":["<anonymous>","generateRandomFileName","main"],"build/cli/index.js":["<anonymous>","generateRandomFileName","main"],"src/config.ts":["<anonymous>"],"build/config.js":["<anonymous>"],"src/core/AnonymizedFile.ts":["<anonymous>","anonymizedContent","assertContentFile","cancel","content","defaultMaskCandidateRegex","escapeRegex","extension","forwardHeaders","getFileInfo","handleStreamError","isFileSupported","isImage","originalPath","probe","recoverTruncatedFile","send","sha","size","streamerErrorToAnonymous","visibleFile"],"build/core/AnonymizedFile.js":["<anonymous>","anonymizedContent","assertContentFile","cancel","content","defaultMaskCandidateRegex","escapeRegex","extension","forwardHeaders","getFileInfo","handleStreamError","isFileSupported","isImage","originalPath","probe","recoverTruncatedFile","send","sha","size","streamerErrorToAnonymous","visibleFile"],"src/core/AnonymousError.ts":["<anonymous>","detail","toString","url"],"build/core/AnonymousError.js":["<anonymous>","detail","toString","url"],"src/core/Conference.ts":["<anonymous>","expire","isExpired","remove","repositories","toJSON","updateStatus"],"build/core/Conference.js":["<anonymous>","expire","isExpired","remove","repositories","toJSON","updateStatus"],"src/core/Gist.ts":["<anonymous>","anonymize","check","conference","content","countView","download","downloadContent","downloadWithAccess","expire","getAccess","getToken","markExpired","remove","resetSate","toJSON","updateIfNeeded","updateStatus"],"build/core/Gist.js":["<anonymous>","anonymize","check","conference","content","countView","download","downloadContent","downloadWithAccess","expire","getAccess","getToken","markExpired","remove","resetSate","toJSON","updateIfNeeded","updateStatus"],"src/core/GitHubUtils.ts":["<anonymous>","abortableGateLookup","cancelled","checkToken","ensureRedisGateClient","getRedisGateResetAt","getToken","getTokenGateResetAt","octokit","ownerGitHubAccessRequired","rateLimitDetail","resolveRepositoryToken","run","setRedisGate","setRedisGateFromWorker","setTokenGate","waitForTokenGate"],"build/core/GitHubUtils.js":["<anonymous>","abortableGateLookup","cancelled","checkToken","ensureRedisGateClient","getRedisGateResetAt","getToken","getTokenGateResetAt","octokit","ownerGitHubAccessRequired","rateLimitDetail","resolveRepositoryToken","run","setRedisGate","setRedisGateFromWorker","setTokenGate","waitForTokenGate"],"src/core/PullRequest.ts":["<anonymous>","anonymize","check","conference","content","countView","download","downloadContent","expire","getToken","markExpired","remove","resetSate","toJSON","updateIfNeeded","updateStatus"],"build/core/PullRequest.js":["<anonymous>","anonymize","check","conference","content","countView","download","downloadContent","expire","getToken","markExpired","remove","resetSate","toJSON","updateIfNeeded","updateStatus"],"src/core/Repository.ts":["<anonymous>","anonymize","anonymizeTreeRecursive","anonymizedFiles","assertNotArchived","buildPathIndex","check","checkRefreshWrite","cleanupRetiredFileTrees","cleanupStagedFileTree","clearRows","completeRecoveredFileMetadata","computeSize","conference","countView","current","ensureFileTree","expire","fileSnapshotFilter","files","findAnonymizedPath","generateAnonymizeTransformer","getToken","hasEmptyTree","indexPaths","insertBatch","invalidateFileMetadata","isReady","markCachePresent","markExpired","pathKey","readFiles","refresh","refreshFilter","refreshIfNeeded","remove","removeCache","resetSate","searchFiles","snapshotValue","submoduleMounts","toJSON","updateIfNeeded","updateProgressMessage","updateRetiringPathIndex","updateStatus","zip"],"build/core/Repository.js":["<anonymous>","anonymize","anonymizeTreeRecursive","anonymizedFiles","assertNotArchived","buildPathIndex","check","checkRefreshWrite","cleanupRetiredFileTrees","cleanupStagedFileTree","clearRows","completeRecoveredFileMetadata","computeSize","conference","countView","current","ensureFileTree","expire","fileSnapshotFilter","files","findAnonymizedPath","generateAnonymizeTransformer","getToken","hasEmptyTree","indexPaths","insertBatch","invalidateFileMetadata","isReady","markCachePresent","markExpired","pathKey","readFiles","refresh","refreshFilter","refreshIfNeeded","remove","removeCache","resetSate","searchFiles","snapshotValue","submoduleMounts","toJSON","updateIfNeeded","updateProgressMessage","updateRetiringPathIndex","updateStatus","zip"],"src/core/User.ts":["<anonymous>","getAccessToken","getGists","getGitHubRepositories","getPullRequests","getRepositories","markListExpired","quotaRepositories","repositoryMembership","toJSON"],"build/core/User.js":["<anonymous>","getAccessToken","getGists","getGitHubRepositories","getPullRequests","getRepositories","markListExpired","quotaRepositories","repositoryMembership","toJSON"],"src/core/anonymization-errors.ts":["<anonymous>","anonymizationErrorCode","data"],"build/core/anonymization-errors.js":["<anonymous>","anonymizationErrorCode","data"],"srLine truncated
|
||||
source_functions = {"src/cli/index.ts":["<anonymous>","generateRandomFileName","main"],"build/cli/index.js":["<anonymous>","generateRandomFileName","main"],"src/config.ts":["<anonymous>"],"build/config.js":["<anonymous>"],"src/core/AnonymizedFile.ts":["<anonymous>","anonymizedContent","assertContentFile","cancel","content","defaultMaskCandidateRegex","escapeRegex","extension","forwardHeaders","getFileInfo","handleStreamError","isFileSupported","isImage","originalPath","probe","recoverTruncatedFile","send","sha","size","streamerErrorToAnonymous","visibleFile"],"build/core/AnonymizedFile.js":["<anonymous>","anonymizedContent","assertContentFile","cancel","content","defaultMaskCandidateRegex","escapeRegex","extension","forwardHeaders","getFileInfo","handleStreamError","isFileSupported","isImage","originalPath","probe","recoverTruncatedFile","send","sha","size","streamerErrorToAnonymous","visibleFile"],"src/core/AnonymousError.ts":["<anonymous>","detail","toString","url"],"build/core/AnonymousError.js":["<anonymous>","detail","toString","url"],"src/core/Conference.ts":["<anonymous>","expire","isExpired","remove","repositories","toJSON","updateStatus"],"build/core/Conference.js":["<anonymous>","expire","isExpired","remove","repositories","toJSON","updateStatus"],"src/core/Gist.ts":["<anonymous>","anonymize","check","conference","content","countView","download","downloadContent","downloadWithAccess","expire","getAccess","getToken","markExpired","remove","resetSate","toJSON","updateIfNeeded","updateStatus"],"build/core/Gist.js":["<anonymous>","anonymize","check","conference","content","countView","download","downloadContent","downloadWithAccess","expire","getAccess","getToken","markExpired","remove","resetSate","toJSON","updateIfNeeded","updateStatus"],"src/core/GitHubUtils.ts":["<anonymous>","abortableGateLookup","cancelled","checkToken","ensureRedisGateClient","getRedisGateResetAt","getToken","getTokenGateResetAt","octokit","ownerGitHubAccessRequired","rateLimitDetail","resolveRepositoryToken","run","setRedisGate","setRedisGateFromWorker","setTokenGate","waitForTokenGate"],"build/core/GitHubUtils.js":["<anonymous>","abortableGateLookup","cancelled","checkToken","ensureRedisGateClient","getRedisGateResetAt","getToken","getTokenGateResetAt","octokit","ownerGitHubAccessRequired","rateLimitDetail","resolveRepositoryToken","run","setRedisGate","setRedisGateFromWorker","setTokenGate","waitForTokenGate"],"src/core/PullRequest.ts":["<anonymous>","anonymize","check","conference","content","countView","download","downloadContent","expire","getToken","markExpired","remove","resetSate","toJSON","updateIfNeeded","updateStatus"],"build/core/PullRequest.js":["<anonymous>","anonymize","check","conference","content","countView","download","downloadContent","expire","getToken","markExpired","remove","resetSate","toJSON","updateIfNeeded","updateStatus"],"src/core/Repository.ts":["<anonymous>","anonymize","anonymizeTreeRecursive","anonymizedFiles","assertNotArchived","buildPathIndex","check","checkRefreshWrite","cleanupRetiredFileTrees","cleanupStagedFileTree","clearRows","completeRecoveredFileMetadata","computeSize","conference","countView","current","ensureFileTree","expire","fileSnapshotFilter","files","findAnonymizedPath","generateAnonymizeTransformer","getToken","hasEmptyTree","indexPaths","insertBatch","invalidateFileMetadata","isReady","markCachePresent","markExpired","pathKey","readFiles","refresh","refreshFilter","refreshIfNeeded","remove","removeCache","resetSate","searchFiles","snapshotValue","submoduleMounts","toJSON","updateIfNeeded","updateProgressMessage","updateRetiringPathIndex","updateStatus","zip"],"build/core/Repository.js":["<anonymous>","anonymize","anonymizeTreeRecursive","anonymizedFiles","assertNotArchived","buildPathIndex","check","checkRefreshWrite","cleanupRetiredFileTrees","cleanupStagedFileTree","clearRows","completeRecoveredFileMetadata","computeSize","conference","countView","current","ensureFileTree","expire","fileSnapshotFilter","files","findAnonymizedPath","generateAnonymizeTransformer","getToken","hasEmptyTree","indexPaths","insertBatch","invalidateFileMetadata","isReady","markCachePresent","markExpired","pathKey","readFiles","refresh","refreshFilter","refreshIfNeeded","remove","removeCache","resetSate","searchFiles","snapshotValue","submoduleMounts","toJSON","updateIfNeeded","updateProgressMessage","updateRetiringPathIndex","updateStatus","zip"],"src/core/User.ts":["<anonymous>","getAccessToken","getGists","getGitHubRepositories","getPullRequests","getRepositories","markListExpired","quotaRepositories","repositoryMembership","toJSON"],"build/core/User.js":["<anonymous>","getAccessToken","getGists","getGitHubRepositories","getPullRequests","getRepositories","markListExpired","quotaRepositories","repositoryMembership","toJSON"],"src/core/anonymization-errors.ts":["<anonymous>","anonymizationErrorCode","data"],"build/core/anonymization-errors.js":["<anonymous>","anonymizationErrorCode","data"],"srLine truncated
|
||||
for_each(["errorType", "causeType"]) -> |_index, key| {
|
||||
value = get(record, [key]) ?? null
|
||||
if includes(["Error","TypeError","RangeError","ReferenceError","SyntaxError","URIError","EvalError","AggregateError","AnonymousError","HTTPError","RequestError","MongoServerError","MongoNetworkError","MongoServerSelectionError","ValidationError","TimeoutError","AbortError","UnknownError"], value) { out = set!(out, [key], value) }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"core.min.js": "core.d23af1c652.min.js",
|
||||
"vendor.min.js": "vendor.c506d2db31.min.js",
|
||||
"vendor.min.js": "vendor.a28ff63e90.min.js",
|
||||
"mermaid.min.js": "mermaid.a7356d5ed1.min.js",
|
||||
"all.min.css": "all.55b8fff331.min.css",
|
||||
"markdown.min.js": "markdown.6c8dfb7b1d.min.js",
|
||||
|
||||
@@ -146,6 +146,8 @@
|
||||
"upstream_error": "A temporary error occurred while fetching from GitHub — please try again.",
|
||||
"streamer_upstream_error": "The file server received an unexpected response — please try again.",
|
||||
"streamer_unreachable": "The file server is temporarily unreachable — please try again.",
|
||||
"streamer_unexpected_response": "The file server received an unexpected response — please try again.",
|
||||
"streamer_route_not_found": "The file server could not handle this request — please try again later.",
|
||||
"token_expired": "The repository owner needs to renew their GitHub connection before this content can be loaded.",
|
||||
"job_is_active": "This job is currently running — wait for it to finish or remove it first.",
|
||||
"github_app_access_required": "Allow this repository on GitHub using the read-only access button, then retry. Organization access may require administrator approval.",
|
||||
|
||||
Vendored
+2
-2
@@ -1,4 +1,4 @@
|
||||
"use strict";(()=>{var vl=Object.defineProperty;var yl=e=>{throw TypeError(e)};var Sf=(e,t,s)=>t in e?vl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var Ef=(e,t)=>{for(var s in t)vl(e,s,{get:t[s],enumerable:!0})};var tt=(e,t,s)=>Sf(e,typeof t!="symbol"?t+"":t,s),Ar=(e,t,s)=>t.has(e)||yl("Cannot "+s);var ae=(e,t,s)=>(Ar(e,t,"read from private field"),s?s.call(e):t.get(e)),Le=(e,t,s)=>t.has(e)?yl("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),Ue=(e,t,s,i)=>(Ar(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),qe=(e,t,s)=>(Ar(e,t,"access private method"),s);var bl=(e,t,s,i)=>({set _(o){Ue(e,t,o,s)},get _(){return ae(e,t,i)}});var ve=["abap","abc","actionscript","ada","alda","apache_conf","apex","applescript","aql","asciidoc","asl","assembly_x86","autohotkey","batchfile","c9search","c_cpp","cirru","clojure","cobol","coffee","coldfusion","crystal","csharp","csound_document","csound_orchestra","csound_score","csp","css","curly","d","dart","diff","django","dockerfile","dot","drools","edifact","eiffel","ejs","elixir","elm","erlang","forth","fortran","fsharp","fsl","ftl","gcode","gherkin","gitignore","glsl","gobstones","golang","graphqlschema","groovy","haml","handlebars","haskell","haskell_cabal","haxe","hjson","html","html_elixir","html_ruby","ini","io","jack","jade","java","javascript","json","json5","jsoniq","jsp","jssm","jsx","julia","kotlin","latex","less","liquid","lisp","livescript","logiql","logtalk","lsl","lua","luapage","lucene","makefile","markdown","mask","matlab","maze","mediawiki","mel","mixal","mushcode","mysql","nginx","nim","nix","nsis","nunjucks","objectivec","ocaml","pascal","perl","perl6","pgsql","php","php_laravel_blade","pig","plain_text","powershell","praat","prisma","prolog","properties","protobuf","puppet","python","qml","r","razor","rdoc","red","redshift","rhtml","rst","ruby","rust","sass","scad","scala","scheme","scss","sh","sjs","slim","smarty","snippets","soy_template","space","sparql","sql","sqlserver","stylus","svg","swift","tcl","terraform","tex","text","textile","toml","tsx","turtle","twig","typescript","vala","vbscript","velocity","verilog","vhdl","visualforce","wollok","xml","xquery","yaml","zeek"];var ye={markdown:"/script/markdown.6c8dfb7b1d.min.js",notebook:"/script/notebook.c3144c18ae.min.js",org:"/script/org.f61f262915.min.js",editor:"/script/editor.4f142d3adc.min.js",pdf:"/script/pdf.4d9cc6ff49.min.js"};function wl(e){let t=e.location.hash.slice(1);if(e.history.replaceState(null,"","/review-link"),t.length>2048)return null;let s=new URLSearchParams(t);if([...s.keys()].length!==3||[...s.keys()].some(u=>!["clientId","intentId","token"].includes(u)))return null;let i=s.get("clientId"),o=s.get("intentId"),r=s.get("token");return!/^[a-f0-9]{32}$/.test(i||"")||!/^[a-f0-9]{32}$/.test(o||"")||!/^[a-f0-9]{64}$/.test(r||"")?null:{contract:"4open.artifacts/1",clientId:i,intentId:o,token:r}}function kl(e,t){let{http:s,promises:i,window:o}=t,r=t.takeReviewHandoff(),u=r?{clientId:r.clientId,intentId:r.intentId}:null,f,c,v,h,y,g=!0,C,w=i.defer(),S=()=>[...o.crypto.getRandomValues(new Uint8Array(16))].map(_=>_.toString(16).padStart(2,"0")).join("");Object.assign(e,{repositoryId:"",handoffEnabled:!1,busy:!1,preview:null,acceptAccess:!1,acceptRetention:!1,uncertain:!1,saved:!1,expired:!1,error:r?"":"Open a new artifact link from your submission. This link is missing or invalid."});let N=()=>g&&e.user?.username===y;function b(){g=!1,r=f=c=void 0,w.resolve(),o.clearTimeout(C)}e.on("dispose",b),e.on("routeLeave",b),e.watch(()=>e.user?.username,_=>{!y&&_?y=_:y&&_!==y&&(b(),e.preview=null,e.repositoryId="",e.busy=!1,e.saved=!1,e.handoffEnabled=!1,e.error="Your account changed. Open a new artifact link from your submission.")});let T=()=>({timeout:w.promise,headers:{"Content-Type":"application/json","X-Review-CSRF":c}}),M=_=>_?.status===404?"Artifact linking is not available on this server.":_?.status===401?"Sign in, then open a new artifact link from your submission.":_?.status===403?"This account cannot approve this repository or this link.":"The request could not be completed. You can retry from this page.";e.loadPreview=async()=>{if(!g||!r||e.busy||e.uncertain||e.saved||!e.user?.username)return;y=e.user.username;let _=e.repositoryId.trim();if(!/^[A-Za-z0-9_-]{3,128}$/.test(_)){e.error="Enter the anonymous repository ID from its URL.";return}e.busy=!0,e.error="",e.preview=null,f=void 0,e.acceptAccess=e.acceptRetention=!1,e.expired=!1,o.clearTimeout(C),h||(h=S());try{let H=(await s.get("/api/review-consent/csrf",{timeout:w.promise})).data;if(!N())return;if(c=H.csrf,e.handoffEnabled=H.handoffEnabled===!0,!/^[a-f0-9]{64}$/.test(c||""))throw new Error("invalid_csrf");let oe=(await s.post("/api/review-consent/preview",{repositoryId:_,intent:{...r,requestId:h}},T())).data;if(!N())return;if(!oe||typeof oe.ticket!="string"||!oe.ticket||oe.ticket.length>8192||typeof oe.repositoryName!="string"||!["restricted-review","anonymous-liLine truncated
|
||||
"use strict";(()=>{var vl=Object.defineProperty;var yl=e=>{throw TypeError(e)};var Sf=(e,t,s)=>t in e?vl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var Ef=(e,t)=>{for(var s in t)vl(e,s,{get:t[s],enumerable:!0})};var tt=(e,t,s)=>Sf(e,typeof t!="symbol"?t+"":t,s),Ar=(e,t,s)=>t.has(e)||yl("Cannot "+s);var ae=(e,t,s)=>(Ar(e,t,"read from private field"),s?s.call(e):t.get(e)),Le=(e,t,s)=>t.has(e)?yl("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),Ue=(e,t,s,i)=>(Ar(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),qe=(e,t,s)=>(Ar(e,t,"access private method"),s);var bl=(e,t,s,i)=>({set _(o){Ue(e,t,o,s)},get _(){return ae(e,t,i)}});var ve=["abap","abc","actionscript","ada","alda","apache_conf","apex","applescript","aql","asciidoc","asl","assembly_x86","autohotkey","batchfile","c9search","c_cpp","cirru","clojure","cobol","coffee","coldfusion","crystal","csharp","csound_document","csound_orchestra","csound_score","csp","css","curly","d","dart","diff","django","dockerfile","dot","drools","edifact","eiffel","ejs","elixir","elm","erlang","forth","fortran","fsharp","fsl","ftl","gcode","gherkin","gitignore","glsl","gobstones","golang","graphqlschema","groovy","haml","handlebars","haskell","haskell_cabal","haxe","hjson","html","html_elixir","html_ruby","ini","io","jack","jade","java","javascript","json","json5","jsoniq","jsp","jssm","jsx","julia","kotlin","latex","less","liquid","lisp","livescript","logiql","logtalk","lsl","lua","luapage","lucene","makefile","markdown","mask","matlab","maze","mediawiki","mel","mixal","mushcode","mysql","nginx","nim","nix","nsis","nunjucks","objectivec","ocaml","pascal","perl","perl6","pgsql","php","php_laravel_blade","pig","plain_text","powershell","praat","prisma","prolog","properties","protobuf","puppet","python","qml","r","razor","rdoc","red","redshift","rhtml","rst","ruby","rust","sass","scad","scala","scheme","scss","sh","sjs","slim","smarty","snippets","soy_template","space","sparql","sql","sqlserver","stylus","svg","swift","tcl","terraform","tex","text","textile","toml","tsx","turtle","twig","typescript","vala","vbscript","velocity","verilog","vhdl","visualforce","wollok","xml","xquery","yaml","zeek"];var ye={markdown:"/script/markdown.6c8dfb7b1d.min.js",notebook:"/script/notebook.c3144c18ae.min.js",org:"/script/org.f61f262915.min.js",pdf:"/script/pdf.4d9cc6ff49.min.js",editor:"/script/editor.4f142d3adc.min.js"};function wl(e){let t=e.location.hash.slice(1);if(e.history.replaceState(null,"","/review-link"),t.length>2048)return null;let s=new URLSearchParams(t);if([...s.keys()].length!==3||[...s.keys()].some(u=>!["clientId","intentId","token"].includes(u)))return null;let i=s.get("clientId"),o=s.get("intentId"),r=s.get("token");return!/^[a-f0-9]{32}$/.test(i||"")||!/^[a-f0-9]{32}$/.test(o||"")||!/^[a-f0-9]{64}$/.test(r||"")?null:{contract:"4open.artifacts/1",clientId:i,intentId:o,token:r}}function kl(e,t){let{http:s,promises:i,window:o}=t,r=t.takeReviewHandoff(),u=r?{clientId:r.clientId,intentId:r.intentId}:null,f,c,v,h,y,g=!0,C,w=i.defer(),S=()=>[...o.crypto.getRandomValues(new Uint8Array(16))].map(_=>_.toString(16).padStart(2,"0")).join("");Object.assign(e,{repositoryId:"",handoffEnabled:!1,busy:!1,preview:null,acceptAccess:!1,acceptRetention:!1,uncertain:!1,saved:!1,expired:!1,error:r?"":"Open a new artifact link from your submission. This link is missing or invalid."});let N=()=>g&&e.user?.username===y;function b(){g=!1,r=f=c=void 0,w.resolve(),o.clearTimeout(C)}e.on("dispose",b),e.on("routeLeave",b),e.watch(()=>e.user?.username,_=>{!y&&_?y=_:y&&_!==y&&(b(),e.preview=null,e.repositoryId="",e.busy=!1,e.saved=!1,e.handoffEnabled=!1,e.error="Your account changed. Open a new artifact link from your submission.")});let T=()=>({timeout:w.promise,headers:{"Content-Type":"application/json","X-Review-CSRF":c}}),M=_=>_?.status===404?"Artifact linking is not available on this server.":_?.status===401?"Sign in, then open a new artifact link from your submission.":_?.status===403?"This account cannot approve this repository or this link.":"The request could not be completed. You can retry from this page.";e.loadPreview=async()=>{if(!g||!r||e.busy||e.uncertain||e.saved||!e.user?.username)return;y=e.user.username;let _=e.repositoryId.trim();if(!/^[A-Za-z0-9_-]{3,128}$/.test(_)){e.error="Enter the anonymous repository ID from its URL.";return}e.busy=!0,e.error="",e.preview=null,f=void 0,e.acceptAccess=e.acceptRetention=!1,e.expired=!1,o.clearTimeout(C),h||(h=S());try{let H=(await s.get("/api/review-consent/csrf",{timeout:w.promise})).data;if(!N())return;if(c=H.csrf,e.handoffEnabled=H.handoffEnabled===!0,!/^[a-f0-9]{64}$/.test(c||""))throw new Error("invalid_csrf");let oe=(await s.post("/api/review-consent/preview",{repositoryId:_,intent:{...r,requestId:h}},T())).data;if(!N())return;if(!oe||typeof oe.ticket!="string"||!oe.ticket||oe.ticket.length>8192||typeof oe.repositoryName!="string"||!["restricted-review","anonymous-liLine truncated
|
||||
`))),e[bn]=Bo(o);let r=i||o.props&&o.props.type==="number";Fn(e,t?"change":"input",u=>{u.target.composing||e[bn](ga(e.value,s,r))}),(s||r)&&Fn(e,"change",()=>{e.value=ga(e.value,s,r)}),t||(Fn(e,"compositionstart",Th),Fn(e,"compositionend",au),Fn(e,"change",au))},mounted(e,{value:t,modifiers:{trim:s,number:i}}){let o=t??"",r=e[Hi];delete e[Hi],r!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==r?e[bn](ga(e.value,s,i)):e.value=o},beforeUpdate(e,{value:t,oldValue:s,modifiers:{lazy:i,trim:o,number:r}},u){if(e[bn]=Bo(u),e.composing)return;let f=(r||e.type==="number")&&!/^0\d/.test(e.value)?Vo(e.value):e.value,c=t??"";if(f===c)return;let v=e.getRootNode();(v instanceof Document||v instanceof ShadowRoot)&&v.activeElement===e&&e.type!=="range"&&(i&&t===s||o&&e.value.trim()===c)||(e.value=c)}},ya={deep:!0,created(e,t,s){e[bn]=Bo(s),Fn(e,"change",()=>{let i=e._modelValue,o=Fs(e),r=e.checked,u=e[bn];if(Ee(i)){let f=vi(i,o),c=f!==-1;if(r&&!c)u(i.concat(o));else if(!r&&c){let v=[...i];v.splice(f,1),u(v)}}else if(Zt(i)){let f=new Set(i);r?f.add(o):f.delete(o),u(f)}else u(fu(e,r))})},mounted:lu,beforeUpdate(e,t,s){e[bn]=Bo(s),lu(e,t,s)}};function lu(e,{value:t,oldValue:s},i){e._modelValue=t;let o;if(Ee(t))o=vi(t,i.props.value)>-1;else if(Zt(t))o=t.has(i.props.value);else{if(t===s)return;o=xt(t,fu(e,!0))}e.checked!==o&&(e.checked=o)}var Nt={deep:!0,created(e,{value:t,modifiers:{number:s}},i){e._modelValue=t,Fn(e,"change",()=>{let o=Array.prototype.filter.call(e.options,c=>c.selected).map(c=>s?Vo(Fs(c)):Fs(c)),r=e.multiple,u=r?Zt(e._modelValue)?new Set(o):o:o[0],f=e._pendingValue=[r,r?Ee(u)?o.slice():o:u];try{e[bn](u)}finally{ze(()=>{e._pendingValue===f&&(e._pendingValue=void 0)})}}),e[bn]=Bo(i)},mounted(e,{value:t}){du(e,t)},beforeUpdate(e,{value:t},s){e._modelValue=t,e[bn]=Bo(s)},updated(e,{value:t}){let s=e._pendingValue;e._pendingValue=void 0,(!s||s[0]!==e.multiple||!Ph(t,s[1],s[0]))&&du(e,t)}};function Ph(e,t,s){if(!s)return xt(e,t);if(Ee(e))return xt(e,t);if(Zt(e)){if(e.size!==t.length)return!1;for(let i of t)if(!e.has(i))return!1;return!0}return!1}function du(e,t){let s=e.multiple,i=Ee(t);if(!(s&&!i&&!Zt(t))){for(let o=0,r=e.options.length;o<r;o++){let u=e.options[o],f=Fs(u);if(s)if(i){let c=typeof f;c==="string"||c==="number"?u.selected=t.some(v=>String(v)===String(f)):u.selected=vi(t,f)>-1}else u.selected=t.has(f);else if(xt(Fs(u),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!s&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Fs(e){return"_value"in e?e._value:e.value}function fu(e,t){let s=t?"_trueValue":"_falseValue";return s in e?e[s]:t}var Dh=["ctrl","shift","alt","meta"],Ah={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Dh.some(s=>e[`${s}Key`]&&!t.includes(s))},de=(e,t)=>{if(!e)return e;let s=e._withMods||(e._withMods={}),i=t.join(".");return s[i]||(s[i]=((o,...r)=>{for(let u=0;u<t.length;u++){let f=Ah[t[u]];if(f&&f(o,t))return}return e(o,...r)}))},Ih={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},$t=(e,t)=>{let s=e._withKeys||(e._withKeys={}),i=t.join(".");return s[i]||(s[i]=(o=>{if(!("key"in o))return;let r=dn(o.key);if(t.some(u=>u===r||Ih[u]===r))return e(o)}))},Oh=pt({patchProp:Eh},lh),uu;function Mh(){return uu||(uu=Hd(Oh))}var mu=((...e)=>{let t=Mh().createApp(...e),{mount:s}=t;return t.mount=i=>{let o=Lh(i);if(!o)return;let r=t._component;!Ae(r)&&!r.render&&!r.template&&(r.template=o.innerHTML),o.nodeType===1&&(o.textContent="");let u=s(o,!1,Vh(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),u},t});function Vh(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Lh(e){return at(e)?document.querySelector(e):e}var co=typeof document<"u";function gu(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function qh(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&gu(e.default)}var Ze=Object.assign;function Gi(e,t){let s={};for(let i in t){let o=t[i];s[i]=Xt(o)?o.map(e):e(o)}return s}var Ho=()=>{},Xt=Array.isArray;function ka(e,t){let s={};for(let i in e)s[i]=i in t?t[i]:e[i];return s}var vu=/#/g,$h=/&/g,Fh=/\//g,_h=/=/g,Uh=/\?/g,yu=/\+/g,Bh=/%5B/g,zh=/%5D/g,bu=/%5E/g,Hh=/%60/g,wu=/%7B/g,jh=/%7C/g,ku=/%7D/g,Gh=/%20/g;function Ca(e){return e==null?"":encodeURI(""+e).replace(jh,"|").replace(Bh,"[").replace(zh,"]")}function Cu(e){return Ca(e).replace(wu,"{").replace(ku,"}").replace(bu,"^")}function ba(e){return Ca(e).replace(yu,"%2B").replace(Gh,"+").replace(vu,"%23").replace($h,"%26").replace(Hh,"`").replace(wu,"{").replace(ku,"}").replace(bu,"^")}function Wh(e){return ba(e).replace(_h,"%3D")}function Kh(e){return CLine truncated
|
||||
${JSON.stringify(e)}${t?`
|
||||
while being at
|
||||
@@ -18,7 +18,7 @@ while being at
|
||||
`)},Ha=class{constructor(t){tt(this,"gen");tt(this,"threads",[]);tt(this,"match",!1);tt(this,"runs",[]);tt(this,"ids",[]);this.gen=t}get dead(){return!this.threads.length&&!this.match&&!this.runs.length}},Ec=(e,t)=>e.ids.length!==t.ids.length||e.runs.length!==t.runs.length||e.ids.some((s,i)=>s!==t.ids[i])?!1:e.runs.every(s=>t.runs.some(i=>i.neg===s.neg&&Ec(i.state,s.state))),vc=e=>({has:new Float64Array(e),seen:new Float64Array(e),gen:0}),ho,Gn,ja,Ga,Gs=class{constructor(t,s,i){Le(this,Gn);tt(this,"dots");tt(this,"dotStart");Le(this,ho);this.dots=t,this.dotStart=s,Ue(this,ho,i)}state(){return new Ha(++ae(this,ho).gen)}done(t){return t.ids=t.threads.map(s=>s.id).sort((s,i)=>s-i),t.match&&t.ids.unshift(za.id),t}restricted(t,s){return s&&(this.dots||this.dotStart&&t===0)}add(t,s,i,o){switch(s.t){case"split":if(!qe(this,Gn,ja).call(this,t,s))return;for(let u of s.out)this.add(t,u,i,o);return;case"neg":if(!qe(this,Gn,ja).call(this,t,s))return;let r=this.state();return this.add(r,s.sub,i,!1),this.done(r),this.addRun(t,{t:"run",neg:s,state:r},i,o);case"star":if(this.restricted(i,o))return;qe(this,Gn,Ga).call(this,t,s)&&this.add(t,s.next,i,o);return;case"match":t.match=!0;return;default:qe(this,Gn,Ga).call(this,t,s)}}addRun(t,s,i,o){for(let r of t.runs)if(r.neg===s.neg&&Ec(r.state,s.state))return;t.runs.push(s),s.state.match||this.add(t,s.neg.next,i,o)}step(t,s,i,o){let r=this.state();for(let u of t.threads)switch(u.t){case"lit":Ya(u,s)&&this.add(r,u.next,i+1,o);break;case"any":this.restricted(i,o)||this.add(r,u.next,i+1,o);break;case"class":!this.restricted(i,o)&&u.re.test(s)&&this.add(r,u.next,i+1,o);break;case"star":this.restricted(i,o)||this.add(r,u,i+1,o)}if(!this.restricted(i,o))for(let u of t.runs){if(u.state.dead){this.addRun(r,u,i+1,o);continue}let f=this.step(u.state,s,i,!1);this.addRun(r,{t:"run",neg:u.neg,state:f},i+1,o)}return this.done(r)}};ho=new WeakMap,Gn=new WeakSet,ja=function(t,s){let{seen:i}=ae(this,ho);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,!0)},Ga=function(t,s){let{has:i}=ae(this,ho);return i[s.id]===t.gen?!1:(i[s.id]=t.gen,t.threads.push(s),!0)};var Nc=e=>{let t=e.ids.join();if(!e.runs.length)return t;let s=e.runs.map(i=>`${i.neg.id}(${Nc(i.state)})`);return`${t}|${s.sort().join("|")}`},vv=1<<18,Wo,Ko,Un,go,Bn,zn,Hn,an,Ka,pr,Rc,Wa=class{constructor(t,s){Le(this,an);Le(this,Wo);Le(this,Ko,new Map);Le(this,Un,0);Le(this,go);Le(this,Bn);Le(this,zn);Le(this,Hn);Ue(this,Wo,t),Ue(this,zn,new Gs(!1,!1,s)),Ue(this,Hn,new Gs(!1,!0,s))}start(t){if(t){if(ae(this,Bn))return ae(this,Bn);let i=ae(this,Hn).state();return ae(this,Hn).add(i,ae(this,Wo),0,!0),Ue(this,Bn,qe(this,an,Ka).call(this,ae(this,Hn).done(i)))}if(ae(this,go))return ae(this,go);let s=ae(this,zn).state();return ae(this,zn).add(s,ae(this,Wo),0,!0),Ue(this,go,qe(this,an,pr).call(this,ae(this,zn).done(s)))}next(t,s){let i=s.charCodeAt(0),o=i<128?void 0:t.next.get(s);if(o)return o;let r=t===ae(this,Bn)?qe(this,an,pr).call(this,ae(this,Hn).step(t.state,s,0,!0)):qe(this,an,pr).call(this,ae(this,zn).step(t.state,s,1,!0));return i<128?(t.ascii||(t.ascii=new Array(128),Ue(this,Un,ae(this,Un)+128)),t.ascii[i]=r):t.next.set(s,r),bl(this,Un)._++,r}};Wo=new WeakMap,Ko=new WeakMap,Un=new WeakMap,go=new WeakMap,Bn=new WeakMap,zn=new WeakMap,Hn=new WeakMap,an=new WeakSet,Ka=function(t){return{state:t,match:t.match,dead:t.dead,next:new Map}},pr=function(t){let s=Nc(t),i=ae(this,Ko).get(s);if(i)return i;ae(this,Un)>vv&&qe(this,an,Rc).call(this);let o=qe(this,an,Ka).call(this,t);return ae(this,Ko).set(s,o),Ue(this,Un,ae(this,Un)+(s.length+1)),o},Rc=function(){ae(this,Ko).clear(),Ue(this,Un,0),Ue(this,go,void 0),Ue(this,Bn,void 0)};var yv=e=>{let t=[];for(let s=e;s.t!=="match";s=s.next){if(s.t==="split"||s.t==="neg")return;t.push(s)}return t},bv=(e,t,s,i)=>{let o=0,r=s,u=-1,f=0;for(;r<i;){let c=e[o];if(c?.t==="star"){u=o++,f=r;continue}let v=t[r];if(c&&(c.t==="any"||c.t==="lit"&&Ya(c,v)||c.t==="class"&&c.re.test(v))){o++,r++;continue}if(u===-1)return!1;o=u+1,r=++f}for(;e[o]?.t==="star";)o++;return o===e.length},Tc=e=>{let t=0,s=0;for(let i of e){let[o,r]=wv(i);t+=o,s+=r}return[t,s]},wv=e=>{if(e.t==="star")return[0,1/0];if(e.t!=="ext")return[1,1];if(e.type==="!")return[0,1/0];let t=e.alts.map(Tc),s=Math.min(...t.map(r=>r[0])),i=Math.max(...t.map(r=>r[1])),o=i===0?0:1/0;return e.type==="@"?[s,i]:e.type==="?"?[0,i]:e.type==="*"?[0,o]:[s,o]},yc=(e,t,s)=>{for(let i=0;i<e.length;i++)if(!Ya(e[i],t[s+i]))return!1;return!0},kv=/[/\ud800-\udfff]/,Cv=/[\ud800-\udfff]/,cr=e=>Cv.test(e)?[...e]:e,bc=e=>{if(e.includes("/"))throw new Error("can only match a single path portion, got: "+e)},jn,Yo,vo,fr,yo,Ks,mr,bo,Ys,Js,Xs,Mn,kn,Jo,Xo,Qs,hr,rn,wo,js,Ws=class{constructor(t,s={}){Le(this,wo);tt(this,"pattern");tt(this,"options");Le(this,jn);Le(this,Yo);Le(this,vo);Le(this,fr);Le(this,yo);Le(this,Ks,!1);Le(this,mr);Le(this,bo);Le(this,Ys,!1);Le(this,Js,0);Le(this,Xs,1/0);Le(this,Mn,[]);Le(this,kn,[]);Le(this,Jo);Le(this,Xo);Le(this,Qs,!1);Le(this,hr);Le(this,rn);if(t.includes
Line truncated
|
||||
`).forEach((s,i)=>{let{term:o}=rl(s.trim());if(!o)return;let r=[];for(let u=0;u<o.length;u++){if(o[u]==="\\"){u++;continue}jc.has(o[u])&&!r.includes(o[u])&&r.push(o[u])}r.length&&t.push({line:i,term:o,symbols:r})}),t}function Wc(e,t){let s=String(e||"").split(`
|
||||
`),i=s[t];if(i===void 0)return e;let{term:o}=rl(i.trim());if(!o)return e;let r="";for(let f=0;f<o.length;f++){if(o[f]==="\\"){r+=o.slice(f,f+2),f++;continue}r+=jc.has(o[f])||o[f]==="."?"\\"+o[f]:o[f]}let u=i.indexOf(o);return s[t]=i.slice(0,u)+r+i.slice(u+o.length),s.join(`
|
||||
`)}var Qn={VIEWER_ERRORS:{title:"Content could not be loaded",access_title:"GitHub access needs attention",reader_help:"Reading this repository? You do not need to sign in. Try again after the owner restores access, or let them know this anonymous link is unavailable.",owner_help:"Own this repository? If your GitHub account was suspended or recently recovered, sign in to Anonymous GitHub again and check the GitHub connection and repository permissions in your dashboard. Then retry this page. Keep the existing anonymous URL; do not delete the repository to restore access.",retry:"Try again",dashboard:"Open owner dashboard"},ERRORS:{cache_busy:"Downloads are busy. Please try again shortly.",cache_miss:"This file is not cached yet. Please try again.",invalid_sort:"The selected sort order is invalid.",invalid_cursor:"This project page is no longer valid. Reload the list.",repository_changed:"The repository changed while processing. Please retry.",repository_job_cancelled:"The repository changed or was removed while processing.",storage_delete_failed:"Unable to remove cached files. Please try again later.",unknown_error:"We could not load this content. Try again. If it still fails, contact support with the anonymous URL and the time of the error.",unreachable:"The service could not complete this request. Wait a moment and try again.",request_error:"The connection was interrupted. Check your internet connection and try again.",not_found:"The requested resource could not be found.",not_connected:"You must be logged in to perform this action.",not_authorized:"You do not have permission to perform this action.",unable_to_connect_user:"Unable to connect your account. Please try again later.",user_not_found:"The requested user could not be found.",user_banned:"Your account has been banned. Contact the admin for more information.",repo_access_limited:"GitHub blocked access because the repository's organization restricts third-party OAuth apps. Ask an org owner to approve Anonymous GitHub under Settings \u2192 Third-party Access \u2192 OAuth app policy, or anonymize a personal fork instead.",repo_saml_enforcement:"The repository's organization enforces SAML single sign-on. Authorize your token for that organization (GitHub \u2192 Settings \u2192 Applications, or re-run the org's SSO sign-in), then retry. Alternatively, anonymize a personal fork.",repo_not_found:"Anonymous GitHub cannot access the source repository on GitHub. It may be private, unavailable, or require the owner to reconnect GitHub.",repo_empty:"The selected branch has no commits on GitHub. Push at least one commit, or pick a different branch, then retry.",repo_not_accessible:"Anonymous GitHub cannot access this repository. Verify the repository exists and that Anonymous GitHub has been authorized for the owning organization.",repository_archived:"This repository has been archived and its files are no longer available.",repository_expired:"The repository is expired.",invalid_status:"This action cannot be performed while the resource is in its current state.",repository_not_ready:"Anonymous GitHub is still processing the repository, it can take several minutes.",repository_not_accessible:"This repository is currently not accessible.",repo_is_updating:"Anonymous GitHub is still processing the repository, it can take several minutes.",invalid_repo:"The provided repository is not valid.",invalid_source_repository:"The repository source name is invalid; expected the form 'owner/name'.",repoId_not_defined:"A repository ID must be provided.",repoUrl_not_defined:"The repository URL needs to be defined.",source_not_provided:"A repository source must be provided.",github_rate_limit_exceeded:"GitHub temporarily blocked the request because we hit its API rate limit. Wait a few minutes and try again. If the problem persists and you contact GitHub Support, include the request ID and timestamp shown in GitHub's response (the 'X-GitHub-Request-Id' header).",rate_limited:"GitHub API rate limit reached. The repository will be available shortly \u2014 please wait a moment and refresh.",repoId_already_used:"The repository ID is already used.",invalid_repoId:"The format of the repository ID is invalid.",unsupported_source:"The repository source type is not supported.",branch_not_specified:"The branch is not specified.",branch_not_found:"The branch of the repository cannot be found.",commit_not_specified:"A commit must be specified.",commit_not_found:"The configured commit no longer exists in the source repository. It may have been force-pushed, rebased, or removed.",repo_renamed:"The source repository appears to have been renamed or moved on GitHub. Please refresh and try again \u2014 the cached name has been updated.",invalid_commit_format:"The commit hash format is invalid. It must be a hexadecimal string.",pull_request_not_found:"The requested pull request could not be found.",pull_request_expired:"This pull request has expired and is no longer available.",pull_request_no
Line truncated
|
||||
`)}var Qn={VIEWER_ERRORS:{title:"Content could not be loaded",access_title:"GitHub access needs attention",reader_help:"Reading this repository? You do not need to sign in. Try again after the owner restores access, or let them know this anonymous link is unavailable.",owner_help:"Own this repository? If your GitHub account was suspended or recently recovered, sign in to Anonymous GitHub again and check the GitHub connection and repository permissions in your dashboard. Then retry this page. Keep the existing anonymous URL; do not delete the repository to restore access.",retry:"Try again",dashboard:"Open owner dashboard"},ERRORS:{cache_busy:"Downloads are busy. Please try again shortly.",cache_miss:"This file is not cached yet. Please try again.",invalid_sort:"The selected sort order is invalid.",invalid_cursor:"This project page is no longer valid. Reload the list.",repository_changed:"The repository changed while processing. Please retry.",repository_job_cancelled:"The repository changed or was removed while processing.",storage_delete_failed:"Unable to remove cached files. Please try again later.",unknown_error:"We could not load this content. Try again. If it still fails, contact support with the anonymous URL and the time of the error.",unreachable:"The service could not complete this request. Wait a moment and try again.",request_error:"The connection was interrupted. Check your internet connection and try again.",not_found:"The requested resource could not be found.",not_connected:"You must be logged in to perform this action.",not_authorized:"You do not have permission to perform this action.",unable_to_connect_user:"Unable to connect your account. Please try again later.",user_not_found:"The requested user could not be found.",user_banned:"Your account has been banned. Contact the admin for more information.",repo_access_limited:"GitHub blocked access because the repository's organization restricts third-party OAuth apps. Ask an org owner to approve Anonymous GitHub under Settings \u2192 Third-party Access \u2192 OAuth app policy, or anonymize a personal fork instead.",repo_saml_enforcement:"The repository's organization enforces SAML single sign-on. Authorize your token for that organization (GitHub \u2192 Settings \u2192 Applications, or re-run the org's SSO sign-in), then retry. Alternatively, anonymize a personal fork.",repo_not_found:"Anonymous GitHub cannot access the source repository on GitHub. It may be private, unavailable, or require the owner to reconnect GitHub.",repo_empty:"The selected branch has no commits on GitHub. Push at least one commit, or pick a different branch, then retry.",repo_not_accessible:"Anonymous GitHub cannot access this repository. Verify the repository exists and that Anonymous GitHub has been authorized for the owning organization.",repository_archived:"This repository has been archived and its files are no longer available.",repository_expired:"The repository is expired.",invalid_status:"This action cannot be performed while the resource is in its current state.",repository_not_ready:"Anonymous GitHub is still processing the repository, it can take several minutes.",repository_not_accessible:"This repository is currently not accessible.",repo_is_updating:"Anonymous GitHub is still processing the repository, it can take several minutes.",invalid_repo:"The provided repository is not valid.",invalid_source_repository:"The repository source name is invalid; expected the form 'owner/name'.",repoId_not_defined:"A repository ID must be provided.",repoUrl_not_defined:"The repository URL needs to be defined.",source_not_provided:"A repository source must be provided.",github_rate_limit_exceeded:"GitHub temporarily blocked the request because we hit its API rate limit. Wait a few minutes and try again. If the problem persists and you contact GitHub Support, include the request ID and timestamp shown in GitHub's response (the 'X-GitHub-Request-Id' header).",rate_limited:"GitHub API rate limit reached. The repository will be available shortly \u2014 please wait a moment and refresh.",repoId_already_used:"The repository ID is already used.",invalid_repoId:"The format of the repository ID is invalid.",unsupported_source:"The repository source type is not supported.",branch_not_specified:"The branch is not specified.",branch_not_found:"The branch of the repository cannot be found.",commit_not_specified:"A commit must be specified.",commit_not_found:"The configured commit no longer exists in the source repository. It may have been force-pushed, rebased, or removed.",repo_renamed:"The source repository appears to have been renamed or moved on GitHub. Please refresh and try again \u2014 the cached name has been updated.",invalid_commit_format:"The commit hash format is invalid. It must be a hexadecimal string.",pull_request_not_found:"The requested pull request could not be found.",pull_request_expired:"This pull request has expired and is no longer available.",pull_request_no
Line truncated
|
||||
`)),e.options=Object.assign({},e.options,y.options),f.restore()})}c();let v=null;e.saveDefault=h=>{if(h&&h.preventDefault&&h.preventDefault(),e.saving)return;let y=f.checkpoint(),g={terms:e.terms.split(`
|
||||
`).map(C=>C.trim()).filter(C=>C.length>0),options:e.options};e.saving=!0,e.error=null,t.post("/api/user/default",g).then(()=>{f.accept(y),e.saving=!1,e.message=e.unsavedChanges?null:"Saved",v&&i.cancel(v),v=i(()=>{e.message=null},2500)},C=>{e.saving=!1;let w=C&&C.data&&C.data.error,S="Unable to save your defaults. Please try again.";Promise.all([s("ERRORS."+w),s("ERRORS.unknown_error")]).then(([N,b])=>{e.error=w&&N!==b?N:S},()=>{e.error=S})})},e.deleteAccount=()=>{e.deletingAccount||!e.confirmDeleteAccount||e.deleteUsername!==e.user?.username||(e.deletingAccount=!0,t.delete("/api/user").then(()=>{window.location.href="/"},()=>{e.deletingAccount=!1,e.deleteError="Unable to delete the account. Please try again."}))}},xc=function(e,t,s){e.repoId=null,e.repoUrl=null,e.claim=()=>{t.post("/api/repo/claim",{repoId:e.repoId,repoUrl:e.repoUrl}).then(i=>{s.url("/dashboard")},i=>{e.error=i.data,e.claimForm.repoUrl.setValidity("not_found",!1),e.claimForm.repoId.setValidity("not_found",!1)})}},ep=function(e,t,s,i,o){e.user&&!e.user.status&&s.url("/dashboard"),e.watch("user.status",()=>{e.user&&!e.user.status&&s.url("/dashboard")}),e.features=[{key:"anonymize",num:"01",eyebrow:"Anonymize",title:"Double-anonymous,",accent:"your rules.",text:"Choose what reviewers may see: links, images, PDFs, notebooks, GitHub Pages. Add your own terms, with regex if you need it, and pick the expiration date.",cta:"Start an anonymization",href:"/anonymize",url:"anonymous.4open.science/anonymize",img:"/imgs/anonymize.png",alt:"The anonymize form: source repository, terms to redact, options and a live README preview"},{key:"review",num:"02",eyebrow:"Review",title:"Reviewers browse",accent:"the real thing.",text:"Highlighted source code, rendered PDFs, images, and notebooks, in a familiar file explorer. GitHub Pages is also supported.",cta:"Open the example",href:"https://anonymous.4open.science/r/840c8c57-3c32-451e-bf12-0e20be300389/",target:"_self",url:"anonymous.4open.science/r/840c8c57-\u2026",img:"/imgs/explorer.png",alt:"The repository explorer with a file tree and a rendered README"},{key:"manage",num:"03",eyebrow:"Manage",title:"One dashboard,",accent:"until the decision.",text:"Monitor views, edit configuration, remove or update your repository. Program chairs can group submissions under a conference with one shared expiry.",cta:"Open the dashboard",href:"/dashboard",needsUser:!0,url:"anonymous.4open.science/dashboard",img:"/imgs/dashboard.png",alt:"The dashboard listing anonymized repositories with status, views and expiry"}],e.feature=e.features[0].key,e.selectFeature=function(f){e.feature=f},e.featureHref=function(f){return f.needsUser&&!e.user?"/signin":f.href},e.featureTarget=function(f){return f.needsUser&&!e.user?"_self":f.target||void 0},e.featureKeydown=function(f,c){let v={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:"first",End:"last"}[f.key];if(v===void 0)return;f.preventDefault();let h=e.features.length,y=v==="first"?0:v==="last"?h-1:(c+v+h)%h;e.feature=e.features[y].key,o(()=>{let g=i.document.getElementById("feature-tab-"+e.feature);g&&g.focus()})},e.demoText=`# DeepLearnUtils
|
||||
Developed by Jane Smith at MIT CSAIL.
|
||||
|
||||
+19
-27
@@ -59,14 +59,16 @@ function defaultMaskCandidateRegex(value: string): RegExp {
|
||||
// generic 404. Without this, a corrupt cache, a 5xx from the streamer, an
|
||||
// LFS pointer issue, and a missing file all surface to the user as the
|
||||
// same `file_not_found` — which makes incidents impossible to triage.
|
||||
// The request's handleError logs the result once. When the streamer answered,
|
||||
// it already logged its side under the same requestId.
|
||||
function streamerErrorToAnonymous(
|
||||
err: Error & { response?: { statusCode?: number; body?: unknown } },
|
||||
context: { repoId: string; filePath: string }
|
||||
err: Error & { response?: { statusCode?: number; body?: unknown } }
|
||||
): { error: AnonymousError; upstreamStatus?: number; upstreamBody?: string } {
|
||||
const upstreamStatus = err?.response?.statusCode;
|
||||
let errCode = "file_not_found";
|
||||
let httpStatus = 404;
|
||||
let upstreamBody: string | undefined;
|
||||
let streamerCode = false;
|
||||
|
||||
if (err?.response?.body != null) {
|
||||
try {
|
||||
@@ -84,6 +86,7 @@ function streamerErrorToAnonymous(
|
||||
const parsed = JSON.parse(upstreamBody);
|
||||
if (parsed && typeof parsed.error === "string") {
|
||||
errCode = parsed.error;
|
||||
streamerCode = true;
|
||||
}
|
||||
} catch {
|
||||
// body wasn't JSON — keep the default code
|
||||
@@ -97,6 +100,12 @@ function streamerErrorToAnonymous(
|
||||
httpStatus = upstreamStatus >= 500 ? 502 : upstreamStatus;
|
||||
if (upstreamStatus >= 500 && errCode === "file_not_found") {
|
||||
errCode = "streamer_upstream_error";
|
||||
} else if (!streamerCode) {
|
||||
// The streamer's handleError always sends a code. An uncoded 4xx came
|
||||
// from something in front of it (body-size limit, ingress, wrong
|
||||
// entrypoint), which is a fault, not a missing file.
|
||||
errCode = "streamer_unexpected_response";
|
||||
httpStatus = 502;
|
||||
}
|
||||
} else if (errCode === "file_not_found") {
|
||||
// No HTTP response at all (connection refused, timeout, DNS) — that's
|
||||
@@ -105,27 +114,14 @@ function streamerErrorToAnonymous(
|
||||
httpStatus = 502;
|
||||
}
|
||||
|
||||
logger.warn("streamer fetch failed", {
|
||||
code: errCode,
|
||||
const error = new AnonymousError(errCode, {
|
||||
httpStatus,
|
||||
repoId: context.repoId,
|
||||
filePath: context.filePath,
|
||||
upstreamStatus,
|
||||
upstreamBody: upstreamBody?.slice(0, 500),
|
||||
url: config.STREAMER_ENTRYPOINT
|
||||
? join(config.STREAMER_ENTRYPOINT, "api")
|
||||
: undefined,
|
||||
err: serializeError(err),
|
||||
cause: err,
|
||||
});
|
||||
|
||||
return {
|
||||
error: new AnonymousError(errCode, {
|
||||
httpStatus,
|
||||
cause: err,
|
||||
}),
|
||||
upstreamStatus,
|
||||
upstreamBody,
|
||||
};
|
||||
error.upstreamStatus = upstreamStatus;
|
||||
// A coded body comes from the streamer's handleError, which logged it.
|
||||
error.upstreamLogged = streamerCode && typeof upstreamStatus === "number";
|
||||
return { error, upstreamStatus, upstreamBody };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -434,7 +430,7 @@ export default class AnonymizedFile {
|
||||
},
|
||||
}));
|
||||
content.on("error", err => {
|
||||
const { error } = streamerErrorToAnonymous(err, { repoId: this.repository.repoId, filePath: this.anonymizedPath });
|
||||
const { error } = streamerErrorToAnonymous(err);
|
||||
void notifyOwnerAccessProblem(this.repository.owner.id, error, { kind: "repository", id: String(this.repository.model._id) });
|
||||
});
|
||||
return content;
|
||||
@@ -493,7 +489,7 @@ export default class AnonymizedFile {
|
||||
headersDone(true);
|
||||
const { error } = streamerErrorToAnonymous(err as Error & {
|
||||
response?: { statusCode?: number; body?: unknown };
|
||||
}, { repoId: this.repository.repoId, filePath: this.anonymizedPath });
|
||||
});
|
||||
void notifyOwnerAccessProblem(this.repository.owner.id, error, { kind: "repository", id: String(this.repository.model._id) });
|
||||
error.value = this;
|
||||
throw error;
|
||||
@@ -540,10 +536,6 @@ export default class AnonymizedFile {
|
||||
const { error } = streamerErrorToAnonymous(
|
||||
err as Error & {
|
||||
response?: { statusCode?: number; body?: unknown };
|
||||
},
|
||||
{
|
||||
repoId: this.repository.repoId,
|
||||
filePath: this.anonymizedPath,
|
||||
}
|
||||
);
|
||||
void notifyOwnerAccessProblem(this.repository.owner.id, error, { kind: "repository", id: String(this.repository.model._id) });
|
||||
|
||||
@@ -12,6 +12,10 @@ export default class AnonymousError extends CustomError {
|
||||
value?: unknown;
|
||||
httpStatus?: number;
|
||||
cause?: Error;
|
||||
/** Status of the internal service response this error relays. */
|
||||
upstreamStatus?: number;
|
||||
/** The internal service that answered already logged this failure. */
|
||||
upstreamLogged?: boolean;
|
||||
private explicitUrl?: string;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -2677,6 +2677,7 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
|
||||
"src/server/routes/route-utils.ts": [
|
||||
"<anonymous>",
|
||||
"ensureUrl",
|
||||
"errorLogLevel",
|
||||
"explicitErrorStatus",
|
||||
"extendExpirationDate",
|
||||
"getGist",
|
||||
@@ -2694,6 +2695,7 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
|
||||
"build/server/routes/route-utils.js": [
|
||||
"<anonymous>",
|
||||
"ensureUrl",
|
||||
"errorLogLevel",
|
||||
"explicitErrorStatus",
|
||||
"extendExpirationDate",
|
||||
"getGist",
|
||||
@@ -2972,13 +2974,15 @@ export const LOG_SOURCE_FUNCTIONS: Record<string, readonly string[]> = {
|
||||
],
|
||||
"src/streamer/route.ts": [
|
||||
"<anonymous>",
|
||||
"handleStreamError"
|
||||
"handleStreamError",
|
||||
"replyError"
|
||||
],
|
||||
"build/streamer/route.js": [
|
||||
"<anonymous>",
|
||||
"handleStreamError"
|
||||
"handleStreamError",
|
||||
"replyError"
|
||||
]
|
||||
};
|
||||
export const LOG_ERROR_TYPES = ["Error","TypeError","RangeError","ReferenceError","SyntaxError","URIError","EvalError","AggregateError","AnonymousError","HTTPError","RequestError","MongoServerError","MongoNetworkError","MongoServerSelectionError","ValidationError","TimeoutError","AbortError","UnknownError"];
|
||||
export const LOG_ROUTES = ["/","other","/dashboard","/anonymize","/healthcheck","/api/healthcheck","/api","/api/download","/api/stat","/api/stat/history","/api/options","/api/message","/api/user","/api/user/quota","/api/user/dashboard","/api/repo","/api/anonymize-preview","/api/admin/overview","/api/admin/performance","/api/admin/errors","/api/admin/errors/stats","/api/admin/queues","/api/admin/queues/metrics","/github/app/webhook","/api/repo/:repoId","/api/repo/:repoId/file/:path","/api/repo/:repoId/files","/api/repo/:repoId/files/counts","/api/repo/:repoId/files/search","/api/repo/:repoId/zip","/api/repo/:repoId/options","/api/repo/:repoId/refresh","/api/repo/:repoId/coauthors","/api/repo/:repoId/extend","/api/repo/:owner/:repo","/api/repo/:owner/:repo/tree","/api/repo/:owner/:repo/file","/api/repo/:owner/:repo/readme","/api/repo/:owner/:repo/branches","/w/:repoId/:path","/r/:repoId/:path","/api/pr/:id/:path","/api/gist/:id/:path","/assets/:path","/github/:action","/api/admin/:action","/api/user/:action","/api/repo/:id/file/:path","/api/repo/:id/files/counts","/api/repo/:id/files/search","/api/repo/:id/files","/api/repo/:id/zip","/api/repo/:id","/viewer/:id/:path","/api/billing","/api/billing/draft","/api/billing/draft/:id","/api/billing/checkout","/api/billing/portal","/api/billing/refresh","/api/billing/webhook","/api/conferences/plans","/profile","/conference/:id"];
|
||||
export const LOG_THROWN_ERROR_CODES = ["another_login_required","billing_address_missing","billing_already_paid","billing_busy","billing_checkout_disabled","billing_checkout_in_progress","billing_city_missing","billing_country_missing","billing_customer_mismatch","billing_draft_not_found","billing_email_missing","billing_invalid_conference","billing_invalid_draft","billing_invalid_purchase","billing_invalid_repository_size","billing_invalid_review_window","billing_missing","billing_name_missing","billing_plan_change_not_supported","billing_plan_unavailable","billing_price_misconfigured","billing_recovery_required","billing_review_window_locked","billing_subscription_exists","billing_unavailable","billing_zip_missing","branch_not_found","branch_not_specified","cache_busy","cache_miss","cannot_coauthor_self","commit_not_found","commit_not_specified","conf_end_date_invalid","conf_end_date_missing","conf_id_missing","conf_id_used","conf_name_missing","conf_not_activated","conf_not_found","conf_start_date_invalid","conf_start_date_missing","conference_not_found","conference_payment_required","connection_changed","download_not_enabled","expiration_limit_reached","file_listing_too_large","file_not_accessible","file_not_found","file_not_supported","file_too_big","folder_not_supported","gistId_already_used","gistId_not_specified","gist_expired","gist_not_available","gist_not_found","gist_not_ready","github_app_access_required","github_app_authorization_cancelled","github_app_disabled","github_app_permissions_invalid","github_app_reconnect_required","github_app_refresh_busy","github_grant_revocation_failed","github_identity_mismatch","github_oauth_required","github_rate_limit_exceeded","github_unavailable","github_user_not_found","invalid_auth_state","invalid_billing_expiration","invalid_commit_format","invalid_connection","invalid_cursor","invalid_gistId","invalid_github_path","invalid_path","invalid_plan","invalid_preserve_files_format","invalid_project_name","invalid_pullRequestId","invalid_repo","invalid_repoId","invalid_request","invalid_settings","invalid_sort","invalid_status","invalid_terms_format","invalid_token_id","invalid_token_options","is_removed","not_authorized","not_connected","not_owner","oauth_resources_remaining","options_not_provided","page_not_activated","page_not_supported_on_different_branch","path_not_defined","path_not_specified","pullRequestId_already_used","pullRequestId_is_not_a_number","pullRequestId_not_specified","pull_request_expired","pull_request_not_available","pull_request_not_found","pull_request_not_ready","quota_exceeded","quota_repository_limit","quota_storage_limit","rate_limited","readme_not_available","repoId_already_used","repoId_not_defined","repoUrl_not_defined","repo_access_limited","repo_empty","repo_not_accessible","repo_not_found","repo_saml_enforcement","repository_archived","repository_busy","repository_changed","repository_expired","repository_job_cancelled","repository_not_accessible","repository_not_ready","repository_not_specified","repository_tree_incomplete","repository_tree_too_large","s3_config_not_provided","source_not_provided","storage_delete_failed","storage_write_size_mismatch","streamer_unreachable","streamer_upstream_error","submodule_not_available","subscription_required_for_never_expiration","sync_failed","terms_not_specified","token_expired","token_limit_reached","unable_to_connect_user","unable_to_download","upstream_error","user_banned","user_not_found","username_not_defined","zip_not_available","zip_unsafe_entry_path"];
|
||||
export const LOG_THROWN_ERROR_CODES = ["another_login_required","billing_address_missing","billing_already_paid","billing_busy","billing_checkout_disabled","billing_checkout_in_progress","billing_city_missing","billing_country_missing","billing_customer_mismatch","billing_draft_not_found","billing_email_missing","billing_invalid_conference","billing_invalid_draft","billing_invalid_purchase","billing_invalid_repository_size","billing_invalid_review_window","billing_missing","billing_name_missing","billing_plan_change_not_supported","billing_plan_unavailable","billing_price_misconfigured","billing_recovery_required","billing_review_window_locked","billing_subscription_exists","billing_unavailable","billing_zip_missing","branch_not_found","branch_not_specified","cache_busy","cache_miss","cannot_coauthor_self","commit_not_found","commit_not_specified","conf_end_date_invalid","conf_end_date_missing","conf_id_missing","conf_id_used","conf_name_missing","conf_not_activated","conf_not_found","conf_start_date_invalid","conf_start_date_missing","conference_not_found","conference_payment_required","connection_changed","download_not_enabled","expiration_limit_reached","file_listing_too_large","file_not_accessible","file_not_found","file_not_supported","file_too_big","folder_not_supported","gistId_already_used","gistId_not_specified","gist_expired","gist_not_available","gist_not_found","gist_not_ready","github_app_access_required","github_app_authorization_cancelled","github_app_disabled","github_app_permissions_invalid","github_app_reconnect_required","github_app_refresh_busy","github_grant_revocation_failed","github_identity_mismatch","github_oauth_required","github_rate_limit_exceeded","github_unavailable","github_user_not_found","invalid_auth_state","invalid_billing_expiration","invalid_commit_format","invalid_connection","invalid_cursor","invalid_file_path","invalid_gistId","invalid_github_path","invalid_path","invalid_plan","invalid_preserve_files_format","invalid_project_name","invalid_pullRequestId","invalid_repo","invalid_repoId","invalid_request","invalid_settings","invalid_sort","invalid_status","invalid_terms_format","invalid_token_id","invalid_token_options","is_removed","not_authorized","not_connected","not_owner","oauth_resources_remaining","options_not_provided","page_not_activated","page_not_supported_on_different_branch","path_not_defined","path_not_specified","pullRequestId_already_used","pullRequestId_is_not_a_number","pullRequestId_not_specified","pull_request_expired","pull_request_not_available","pull_request_not_found","pull_request_not_ready","quota_exceeded","quota_repository_limit","quota_storage_limit","rate_limited","readme_not_available","repoId_already_used","repoId_not_defined","repoUrl_not_defined","repo_access_limited","repo_empty","repo_not_accessible","repo_not_found","repo_saml_enforcement","repository_archived","repository_busy","repository_changed","repository_expired","repository_job_cancelled","repository_not_accessible","repository_not_ready","repository_not_specified","repository_tree_incomplete","repository_tree_too_large","s3_config_not_provided","source_not_provided","storage_delete_failed","storage_write_size_mismatch","streamer_route_not_found","streamer_unexpected_response","streamer_unreachable","streamer_upstream_error","submodule_not_available","subscription_required_for_never_expiration","sync_failed","terms_not_specified","token_expired","token_limit_reached","unable_to_connect_user","unable_to_download","upstream_error","user_banned","user_not_found","username_not_defined","zip_not_available","zip_unsafe_entry_path"];
|
||||
@@ -325,6 +325,7 @@ type ErrorLike = {
|
||||
stack?: string;
|
||||
status?: number;
|
||||
httpStatus?: number;
|
||||
upstreamStatus?: number;
|
||||
code?: string | number;
|
||||
cause?: unknown;
|
||||
request?: { url?: string; method?: string };
|
||||
@@ -353,6 +354,7 @@ export function serializeError(err: unknown, seen = new WeakSet<object>(), depth
|
||||
|
||||
// AnonymousError carries an httpStatus and an inner cause.
|
||||
if (typeof e.httpStatus === "number") out.httpStatus = e.httpStatus;
|
||||
if (typeof e.upstreamStatus === "number") out.upstreamStatus = e.upstreamStatus;
|
||||
// Octokit's deprecated `code` getter emits a stack on every read. Only
|
||||
// inspect data properties so logging never invokes that getter.
|
||||
const code = Object.getOwnPropertyDescriptor(e, "code")?.value;
|
||||
|
||||
@@ -17,13 +17,10 @@ import { RepositoryStatus } from "../../core/types";
|
||||
import User from "../../core/User";
|
||||
import { streamAnonymizedZip } from "../../core/zipStream";
|
||||
import FileModel from "../../core/model/files/files.model";
|
||||
import { createLogger, serializeError } from "../../core/logger";
|
||||
import { githubTokenForStreamer } from "../../core/github-token-context";
|
||||
import gh = require("parse-github-url");
|
||||
import { requestHeaders, startStage } from "../../core/request-monitoring";
|
||||
|
||||
const logger = createLogger("repository-public");
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
router.get(
|
||||
@@ -94,6 +91,7 @@ router.get(
|
||||
headersDone(true);
|
||||
const upstreamStatus = err?.response?.statusCode;
|
||||
let upstreamBody: string | undefined;
|
||||
let streamerCode = false;
|
||||
let errCode = "zip_not_available";
|
||||
let httpStatus = 502;
|
||||
if (err?.response?.body != null) {
|
||||
@@ -112,6 +110,7 @@ router.get(
|
||||
const parsed = JSON.parse(upstreamBody);
|
||||
if (parsed && typeof parsed.error === "string") {
|
||||
errCode = parsed.error;
|
||||
streamerCode = true;
|
||||
}
|
||||
} catch {
|
||||
/* not JSON */
|
||||
@@ -121,26 +120,17 @@ router.get(
|
||||
if (typeof upstreamStatus === "number") {
|
||||
httpStatus = upstreamStatus >= 500 ? 502 : upstreamStatus;
|
||||
}
|
||||
logger.warn("streamer zip fetch failed", {
|
||||
code: errCode,
|
||||
httpStatus,
|
||||
repoId: repo.repoId,
|
||||
upstreamStatus,
|
||||
upstreamBody: upstreamBody?.slice(0, 500),
|
||||
url: config.STREAMER_ENTRYPOINT
|
||||
? join(config.STREAMER_ENTRYPOINT, "api/download")
|
||||
: undefined,
|
||||
err: serializeError(err),
|
||||
});
|
||||
const streaming = res.headersSent;
|
||||
handleError(
|
||||
new AnonymousError(errCode, {
|
||||
url: req.originalUrl,
|
||||
httpStatus,
|
||||
cause: err,
|
||||
}),
|
||||
res
|
||||
);
|
||||
const error = new AnonymousError(errCode, {
|
||||
url: req.originalUrl,
|
||||
httpStatus,
|
||||
cause: err,
|
||||
});
|
||||
error.upstreamStatus = upstreamStatus;
|
||||
// A coded body comes from the streamer's handleError, which
|
||||
// already logged this failure under the same requestId.
|
||||
error.upstreamLogged = streamerCode && typeof upstreamStatus === "number";
|
||||
handleError(error, res);
|
||||
// Once ZIP bytes have been sent, handleError cannot send JSON.
|
||||
// Terminate the truncated response so the client reports failure
|
||||
// instead of waiting forever for the ZIP's central directory.
|
||||
|
||||
@@ -184,8 +184,44 @@ export function explicitErrorStatus(error: unknown): number | undefined {
|
||||
.find(status => Number.isInteger(status) && status! >= 400 && status! <= 599);
|
||||
}
|
||||
|
||||
// Request end states that need no operator action: the visitor asked for
|
||||
// something that is gone, expired, unsupported or not theirs. They are logged
|
||||
// at info so the admin Errors page (warn and error) keeps to faults. Rate
|
||||
// limits, expired owner tokens and upstream failures are left out on purpose.
|
||||
export const EXPECTED_CLIENT_ERRORS: ReadonlySet<string> = new Set([
|
||||
"repo_not_found", "repository_not_found", "commit_not_found", "branch_not_found",
|
||||
"file_not_found", "folder_not_supported", "file_not_supported", "file_too_big",
|
||||
"readme_not_available", "submodule_not_available",
|
||||
"repository_expired", "repository_archived", "repository_not_ready", "is_removed",
|
||||
"github_app_access_required", "not_connected", "not_authorized",
|
||||
"page_not_activated", "page_not_supported_on_different_branch", "download_not_enabled",
|
||||
"gist_not_found", "gist_expired", "gist_not_ready",
|
||||
"pull_request_not_found", "pull_request_expired", "pull_request_not_ready",
|
||||
"conf_not_found", "conference_not_found", "repoId_already_used", "invalid_repoId",
|
||||
]);
|
||||
|
||||
export type ErrorLogOptions = {
|
||||
/** The reply goes to another service that logs the request's end state. */
|
||||
internal?: boolean;
|
||||
};
|
||||
|
||||
type LogLevel = "debug" | "info" | "warn" | "error";
|
||||
|
||||
/** One record per failed request, at a level that matches who has to act. */
|
||||
export function errorLogLevel(error: unknown, options: ErrorLogOptions = {}): LogLevel {
|
||||
const status = explicitErrorStatus(error);
|
||||
let level: LogLevel = status !== undefined && status < 500 ? "warn" : "error";
|
||||
if (error instanceof AnonymousError) {
|
||||
// The internal service that answered logged the failure at its own level.
|
||||
if (error.upstreamLogged) level = "info";
|
||||
else if (level === "warn" && EXPECTED_CLIENT_ERRORS.has(error.message)) level = "info";
|
||||
}
|
||||
return level === "info" && options.internal ? "debug" : level;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function printError(error: any, req?: express.Request) {
|
||||
function printError(error: any, req?: express.Request, options: ErrorLogOptions = {}) {
|
||||
const level = errorLogLevel(error, options);
|
||||
if (error instanceof AnonymousError) {
|
||||
if (req?.originalUrl === "/api/repo/undefined/options") return;
|
||||
const payload: Record<string, unknown> = serializeError(error);
|
||||
@@ -194,20 +230,11 @@ function printError(error: any, req?: express.Request) {
|
||||
// Errors page surfaces something meaningful (e.g. "repoId_already_used")
|
||||
// instead of a generic "anonymous error" wrapper.
|
||||
const summary = error.message || error.name || "AnonymousError";
|
||||
// 4xx are expected client errors (not_found, expired, not_connected) —
|
||||
// route them to warn so the admin Errors page can split server faults
|
||||
// (5xx) from client misuse (4xx) cleanly.
|
||||
const status = explicitErrorStatus(error);
|
||||
if (typeof status === "number" && status >= 400 && status < 500) {
|
||||
logger.warn(summary, payload);
|
||||
} else {
|
||||
logger.error(summary, payload);
|
||||
}
|
||||
logger[level](summary, payload);
|
||||
} else if (error instanceof HTTPError) {
|
||||
const payload: Record<string, unknown> = serializeError(error);
|
||||
ensureUrl(payload, req);
|
||||
const status = explicitErrorStatus(error);
|
||||
logger[status && status < 500 ? "warn" : "error"](error.code || error.name || "HTTPError", payload);
|
||||
logger[level](error.code || error.name || "HTTPError", payload);
|
||||
} else {
|
||||
// Unhandled errors: use the error class name (SyntaxError, TypeError,
|
||||
// RangeError, ...) as the summary so the admin page shows
|
||||
@@ -225,8 +252,7 @@ function printError(error: any, req?: express.Request) {
|
||||
((error as { name?: string }).name ||
|
||||
(error as { message?: string }).message)) ||
|
||||
"UnhandledError";
|
||||
const status = explicitErrorStatus(error);
|
||||
logger[status && status < 500 ? "warn" : "error"](summary, serialized);
|
||||
logger[level](summary, serialized);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,10 +260,11 @@ export function handleError(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
error: any,
|
||||
res?: express.Response,
|
||||
req?: express.Request
|
||||
req?: express.Request,
|
||||
options?: ErrorLogOptions
|
||||
) {
|
||||
if (isResponseCancellation(error, res)) return;
|
||||
printError(error, req);
|
||||
printError(error, req, options);
|
||||
let errorCode = error;
|
||||
if (error instanceof Error) {
|
||||
errorCode = error.message;
|
||||
|
||||
@@ -43,7 +43,8 @@ app.get("/healthcheck", async (_, res) => {
|
||||
|
||||
app.all("/{*path}", (req, res) => {
|
||||
handleError(
|
||||
new AnonymousError("file_not_found", {
|
||||
// Callers only use known routes; reaching here is a misconfiguration.
|
||||
new AnonymousError("streamer_route_not_found", {
|
||||
httpStatus: 404,
|
||||
url: req.originalUrl,
|
||||
}),
|
||||
|
||||
+13
-6
@@ -6,10 +6,17 @@ import {
|
||||
AnonymizeTransformer,
|
||||
isTextFile,
|
||||
} from "../core/anonymize-utils";
|
||||
import AnonymousError from "../core/AnonymousError";
|
||||
import { handleError } from "../server/routes/route-utils";
|
||||
import { lookup } from "mime-types";
|
||||
import { streamAnonymizedZip } from "../core/zipStream";
|
||||
|
||||
// The API relays these replies and logs each request's end state, so expected
|
||||
// outcomes are only debug here. Faults keep their level and streamer stack.
|
||||
function replyError(error: unknown, res: express.Response) {
|
||||
handleError(error, res, undefined, { internal: true });
|
||||
}
|
||||
|
||||
export const router = express.Router();
|
||||
|
||||
router.post(
|
||||
@@ -18,7 +25,7 @@ router.post(
|
||||
req.body = req.body || {};
|
||||
const token: string = req.body.token;
|
||||
if (typeof req.body.repoFullName !== "string" || typeof token !== "string") {
|
||||
return res.status(400).json({ error: "invalid_request" });
|
||||
return replyError(new AnonymousError("invalid_request", { httpStatus: 400 }), res);
|
||||
}
|
||||
const repoFullName = req.body.repoFullName.split("/");
|
||||
const repoId = req.body.repoId;
|
||||
@@ -42,7 +49,7 @@ router.post(
|
||||
);
|
||||
} catch (error) {
|
||||
const streaming = res.headersSent;
|
||||
handleError(error, res);
|
||||
replyError(error, res);
|
||||
if (streaming && !res.writableEnded) res.destroy();
|
||||
}
|
||||
}
|
||||
@@ -51,7 +58,7 @@ router.post("/", async (req: express.Request, res: express.Response) => {
|
||||
req.body = req.body || {};
|
||||
const token: string = req.body.token;
|
||||
if (typeof req.body.repoFullName !== "string" || typeof token !== "string") {
|
||||
return res.status(400).json({ error: "invalid_request" });
|
||||
return replyError(new AnonymousError("invalid_request", { httpStatus: 400 }), res);
|
||||
}
|
||||
const repoFullName = req.body.repoFullName.split("/");
|
||||
const repoId = req.body.repoId;
|
||||
@@ -77,7 +84,7 @@ router.post("/", async (req: express.Request, res: express.Response) => {
|
||||
.split(/[\\/]/)
|
||||
.some((segment) => segment === ".." || segment === "")
|
||||
) {
|
||||
return res.status(400).json({ error: "invalid_file_path" });
|
||||
return replyError(new AnonymousError("invalid_file_path", { httpStatus: 400 }), res);
|
||||
}
|
||||
|
||||
const source = new GitHubStream({
|
||||
@@ -123,7 +130,7 @@ router.post("/", async (req: express.Request, res: express.Response) => {
|
||||
content.destroy();
|
||||
}
|
||||
const streaming = res.headersSent;
|
||||
handleError(error, res);
|
||||
replyError(error, res);
|
||||
if (streaming && !res.writableEnded) res.destroy();
|
||||
anonymizer.destroy();
|
||||
}
|
||||
@@ -146,7 +153,7 @@ router.post("/", async (req: express.Request, res: express.Response) => {
|
||||
res.status(409).end();
|
||||
return;
|
||||
}
|
||||
handleError(error, res);
|
||||
replyError(error, res);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
const { strict: assert } = require("node:assert");
|
||||
const { setTimeout } = require("node:timers");
|
||||
const express = require("express");
|
||||
require("ts-node/register/transpile-only");
|
||||
const config = require("../src/config").default;
|
||||
const AnonymousError = require("../src/core/AnonymousError").default;
|
||||
const File = require("../src/core/AnonymizedFile").default;
|
||||
const GitHubStream = require("../src/core/source/GitHubStream").default;
|
||||
const { AnonymizeTransformer } = require("../src/core/anonymize-utils");
|
||||
const { errorLogLevel, handleError } = require("../src/server/routes/route-utils");
|
||||
const streamer = require("../src/streamer/route").default;
|
||||
const got = require("got");
|
||||
|
||||
const error = (code, httpStatus, extra = {}) => Object.assign(new AnonymousError(code, { httpStatus }), extra);
|
||||
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
|
||||
/** Collect the structured records written to stdout while `run` executes. */
|
||||
async function captureLogs(run) {
|
||||
const records = [];
|
||||
const write = process.stdout.write;
|
||||
process.stdout.write = function (chunk, ...rest) {
|
||||
for (const line of String(chunk).split("\n")) {
|
||||
try { const record = JSON.parse(line); if (record && record.severity) { records.push(record); continue; } } catch { /* not a record */ }
|
||||
if (line) write.call(process.stdout, line + "\n");
|
||||
}
|
||||
const callback = rest.find((arg) => typeof arg === "function");
|
||||
if (callback) callback();
|
||||
return true;
|
||||
};
|
||||
try { await run(); } finally { process.stdout.write = write; }
|
||||
return records;
|
||||
}
|
||||
|
||||
describe("error log levels", () => {
|
||||
it("logs expected client outcomes at info and faults at warn or error", () => {
|
||||
for (const [code, status] of [["repo_not_found", 404], ["repository_expired", 410], ["file_not_found", 404],
|
||||
["github_app_access_required", 403], ["repository_archived", 410], ["folder_not_supported", 404], ["is_removed", 410]]) {
|
||||
assert.equal(errorLogLevel(error(code, status)), "info", code);
|
||||
}
|
||||
assert.equal(errorLogLevel(error("token_expired", 401)), "warn");
|
||||
assert.equal(errorLogLevel(error("rate_limited", 429)), "warn");
|
||||
assert.equal(errorLogLevel(error("github_rate_limit_exceeded", 429)), "warn");
|
||||
assert.equal(errorLogLevel(error("invalid_file_path", 400)), "warn");
|
||||
assert.equal(errorLogLevel(error("upstream_error", 502)), "error");
|
||||
assert.equal(errorLogLevel(error("streamer_unreachable", 502)), "error");
|
||||
assert.equal(errorLogLevel(new Error("boom")), "error");
|
||||
// A known code with a server status is still a fault.
|
||||
assert.equal(errorLogLevel(error("file_not_found", 500)), "error");
|
||||
});
|
||||
|
||||
it("leaves a relayed failure to the service that logged it", () => {
|
||||
assert.equal(errorLogLevel(error("upstream_error", 502, { upstreamStatus: 502, upstreamLogged: true })), "info");
|
||||
assert.equal(errorLogLevel(error("streamer_upstream_error", 502, { upstreamStatus: 502 })), "error");
|
||||
});
|
||||
|
||||
it("drops expected outcomes to debug when another service logs the end state", () => {
|
||||
assert.equal(errorLogLevel(error("repo_not_found", 404), { internal: true }), "debug");
|
||||
assert.equal(errorLogLevel(error("token_expired", 401), { internal: true }), "warn");
|
||||
assert.equal(errorLogLevel(error("upstream_error", 502), { internal: true }), "error");
|
||||
});
|
||||
});
|
||||
|
||||
describe("streamer file failures", function () {
|
||||
this.timeout(10000);
|
||||
let old, original, streamerServer, apiServer, base;
|
||||
beforeEach(async () => {
|
||||
old = { ...config };
|
||||
original = GitHubStream.prototype.getFileContentCache;
|
||||
const streamerApp = express(); streamerApp.use(express.json()); streamerApp.use("/api", streamer);
|
||||
streamerServer = await new Promise((resolve) => { const s = streamerApp.listen(0, "127.0.0.1", () => resolve(s)); });
|
||||
Object.assign(config, { STREAMER_ENTRYPOINT: `http://127.0.0.1:${streamerServer.address().port}/`, SHARED_CACHE_ENABLED: false });
|
||||
const api = express();
|
||||
api.get("/file", async (req, res) => {
|
||||
const file = new File({ repository: {
|
||||
repoId: "anon", owner: { id: "507f1f77bcf86cd799439011" }, options: { terms: [] },
|
||||
model: { _id: "507f1f77bcf86cd799439012", source: { repositoryName: "owner/gone" } },
|
||||
getToken: async () => "token",
|
||||
generateAnonymizeTransformer: (filePath) => new AnonymizeTransformer({ terms: [], filePath }),
|
||||
}, anonymizedPath: "README.md" });
|
||||
file._file = { name: "README.md", path: "", sha: "sha", size: 10 };
|
||||
try { await file.send(res); } catch (failure) { handleError(failure, res, req); }
|
||||
});
|
||||
apiServer = await new Promise((resolve) => { const s = api.listen(0, "127.0.0.1", () => resolve(s)); });
|
||||
base = `http://127.0.0.1:${apiServer.address().port}`;
|
||||
});
|
||||
afterEach(async () => {
|
||||
GitHubStream.prototype.getFileContentCache = original;
|
||||
await new Promise((resolve) => apiServer.close(resolve));
|
||||
await new Promise((resolve) => streamerServer.close(resolve));
|
||||
Object.assign(config, old);
|
||||
});
|
||||
|
||||
const request = async (failure) => {
|
||||
GitHubStream.prototype.getFileContentCache = async () => { throw failure; };
|
||||
let response;
|
||||
const records = await captureLogs(async () => {
|
||||
response = await got(`${base}/file`, { throwHttpErrors: false, retry: 0 });
|
||||
await wait(50);
|
||||
});
|
||||
return { response, records: records.filter((record) => record.severity !== "debug") };
|
||||
};
|
||||
|
||||
it("logs a missing source repository once, at info", async () => {
|
||||
const { response, records } = await request(new AnonymousError("repo_not_found", { httpStatus: 404 }));
|
||||
assert.equal(response.statusCode, 404);
|
||||
assert.equal(records.length, 1, JSON.stringify(records));
|
||||
assert.equal(records[0].severity, "info");
|
||||
assert.equal(records[0].errorCode, "repo_not_found");
|
||||
assert.equal(records[0].upstreamStatus, 404);
|
||||
});
|
||||
|
||||
it("keeps a single fault record from the streamer", async () => {
|
||||
const { response, records } = await request(new AnonymousError("upstream_error", { httpStatus: 502 }));
|
||||
assert.equal(response.statusCode, 502);
|
||||
const faults = records.filter((record) => record.severity === "warn" || record.severity === "error");
|
||||
assert.equal(faults.length, 1, JSON.stringify(records));
|
||||
assert.equal(faults[0].errorCode, "upstream_error");
|
||||
// The streamer's own record, not the API relay (which carries upstreamStatus).
|
||||
assert.equal(faults[0].upstreamStatus, undefined);
|
||||
assert.equal(records.filter((record) => record.upstreamStatus === 502).length, 1);
|
||||
});
|
||||
|
||||
it("reports an uncoded 4xx from in front of the streamer as a fault", async () => {
|
||||
// e.g. a body-size limit or an ingress 404: nothing logged it upstream.
|
||||
const proxy = await new Promise((resolve) => {
|
||||
const s = require("node:http").createServer((req, res) => {
|
||||
req.resume();
|
||||
res.writeHead(413, { "content-type": "text/html" }).end("<h1>Payload Too Large</h1>");
|
||||
}).listen(0, "127.0.0.1", () => resolve(s));
|
||||
});
|
||||
config.STREAMER_ENTRYPOINT = `http://127.0.0.1:${proxy.address().port}/`;
|
||||
try {
|
||||
const { response, records } = await request(new Error("unused"));
|
||||
assert.equal(response.statusCode, 502);
|
||||
assert.equal(records.length, 1, JSON.stringify(records));
|
||||
assert.equal(records[0].severity, "error");
|
||||
assert.equal(records[0].errorCode, "streamer_unexpected_response");
|
||||
assert.equal(records[0].upstreamStatus, 413);
|
||||
} finally {
|
||||
await new Promise((resolve) => proxy.close(resolve));
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user