harbor run -t scale-ai/hil-bench-swe_40-ask_humanharbor download scale-ai/hil-bench-swe_40-ask_humanStandardize the flags representation used for password-related behavior in ShareLink/ShareURL utilities to eliminate inconsistent naming conventions and legacy variants, and ensure deterministic, reliable flag detection and password-splitting behavior across the codebase.
Today, flag access depends on whether an object exposes the canonical flags representation or a legacy variant used by older payloads, which can lead to incorrect detection and inconsistent behavior. The goal is to converge on flags as the standard, but the expected behavior for legacy input shapes (including cases where more than one representation is present) remains undefined and must be clarified.
Separately, Drive link passwords include a generated segment with a fixed length that has recently changed under an internal security policy update. Any logic that generates, slices, or re-combines generated/custom password segments must follow the updated length requirement.
flags as the canonical representation.flags shape.The function hasCustomPassword must determine whether the CustomPassword flag is set in the flags property of the input object and return true only in that case.
The function hasGeneratedPasswordIncluded must determine whether the GeneratedPasswordIncluded flag is set in the flags property of the input object and return true only in that case.
The functions hasCustomPassword and hasGeneratedPasswordIncluded must accept an object with a numeric flags property and evaluate it against SharedURLFlags.
Note: Implementations must treat flags as the canonical representation and must not persist any non-canonical flags representation in returned domain objects.
Note: Some inputs may still expose flags metadata via a legacy representation (e.g., Flags) and may even include multiple representations simultaneously; the expected compatibility behavior must be defined.
Note: If multiple flags representations are present on the same input and disagree, the expected policy must be defined. Do not assume a default.
Note: The flags value must be used as provided and must not be coerced or normalized (e.g., do not accept floats or numeric strings as flags).
The function splitGeneratedAndCustomPassword must accept a password string and an object with a numeric flags property.
When the flags property indicates no custom password, the function must return the entire string as the generated password and an empty string for the custom password.
When the flags property indicates only a custom password, the function must return an empty string for the generated password and the entire string as the custom password.
When the flags property indicates both a generated and a custom password, the function must split the string into (generated, custom) using the fixed generated-password length required by the current security policy.
New public interfaces:
Type: Function Name: shareUrlPayloadToShareUrl Path: applications/drive/src/app/store/_api/transformers.ts Input: shareUrl (ShareURLPayload) Output: ShareURL Description: Transforms a ShareURLPayload API response object into a ShareURL domain object by mapping API field names to camelCase and adding computed properties like hasCustomPassword and hasGeneratedPasswordIncluded.
Type: Function Name: useShareURLView Path: applications/drive/src/app/store/_views/useShareURLView.tsx Input: shareId (string), linkId (string) Output: Object containing isDeleting, isSaving, name, initialExpiration, customPassword, sharedLink, loadingMessage, confirmationMessage, errorMessage, sharedInfoMessage, hasCustomPassword, hasGeneratedPasswordIncluded, hasExpirationTime, saveSharedLink, deleteLink Description: A React hook that manages the complete state and business logic for ShareURL operations including loading, saving, deleting links and handling all related UI states and error conditions.
Type: Function Name: hasCustomPassword Path: applications/drive/src/app/store/_shares/shareUrl.ts Input: sharedURL?: { flags?: unknown; Flags?: unknown } Output: boolean Description: Returns whether the ShareURL-like object has the "custom password" flag enabled.
Type: Function Name: hasGeneratedPasswordIncluded Path: applications/drive/src/app/store/_shares/shareUrl.ts Input: sharedURL?: { flags?: unknown; Flags?: unknown } Output: boolean Description: Returns whether the ShareURL-like object has the "generated password included" flag enabled. Type: Function Name: splitGeneratedAndCustomPassword Path: applications/drive/src/app/store/_shares/shareUrl.ts Input: password: string, sharedURL?: { flags?: unknown; Flags?: unknown } Output: [generatedPassword: string, customPassword: string] Description: Splits the stored password into generated and custom segments based on the password-related flags. When both segments are present, the generated segment uses a fixed generated-password length.