Introducing a new way to review your PRs.

Read the announcement

calicastle / cali.so

Personal website for Cali Castle

View on GitHub

21 documents · Updated Sep 21, 2026

docs / private-resume-access-and-rendering

Private resume access and rendering

The private resume is an invitation-only document flow for English and Chinese readers. It checks a server session before it renders resume content, then assembles the selected language, contact links, document controls, and print-ready layout. For the wider product context, see Private resume experience; the public-site relationship is covered in Public site experience.

Access boundary

The access boundary keeps private resume copy out of an unauthorised HTML response, React Server Components response, browser cache, and search index. Both language routes use the same server check, so changing the language does not create a second access path.

Session access

The session uses a configured passphrase and a separate session secret. A successful check creates a short-lived signed cali-resume cookie that is HTTP-only and scoped to the site. Credential changes replace the signing basis and make earlier sessions invalid.

The server accepts a session only when it has the expected shape, has not expired, and has a valid signature. The access helper also limits concurrent passphrase work so repeated hostile requests cannot consume all available crypto work.

References: lib/…/access.ts• L5-17 lib/…/access.ts• L29-37 lib/…/access.ts• L40-84 lib/…/server.ts• L14-17

Response privacy

Resume pages and access responses use private, non-storing cache rules. They also send no-index and same-origin referrer rules. This combination limits storage, search discovery, and accidental forwarding of the private page URL.

The page checks access before it loads or renders the protected document. The browser tests cover both normal HTML and RSC requests, and also check that resume paths stay out of the sitemap, LLM file, and robots file.

References: lib/…/access.ts• L86-92 app/…/resume-page.tsx• L21-27 app/…/resume-document.tsx• L8-14 tests/…/resume.spec.ts• L6-25

Entry routes

The English route is /en/resume and the Chinese route is /resume. Each route selects its language and passes control to one shared page flow, while its language layout supplies the same private document shell and metadata.

Protected route behavior

Direct entry waits for the server access check before rendering the document. Without a valid session, the route renders only a language-specific gate with a native form. This keeps the first response useful without JavaScript while preventing private content from appearing during direct navigation or browser history restoration.

After access succeeds, the same route renders the full document. The language link keeps the session while moving between /en/resume and /resume, so both editions share one access state.

References: app/…/page.tsx• L3-9 app/…/page.tsx• L3-7 app/…/resume-page.tsx• L21-37 app/…/resume-document.tsx• L16-35

Unlock and lock flow

The unlock and lock APIs are form-oriented endpoints. They return a redirect to the correct language route, which lets the gate show a local result and also supports a browser with JavaScript disabled.

The following flow shows how a browser request becomes either an authorised document view or a safe error state.

flowchart LR
    A[Resume route] --> B{Valid server session?}
    B -- Yes --> C[Render localized document]
    B -- No --> D[Render passphrase gate]
    D --> E[POST unlock form]
    E --> F[Browser request check]
    F --> G[Rate limit]
    G --> H[Verify passphrase]
    H -- Correct --> I[Set signed HTTP-only session cookie]
    I --> J[Redirect to language route]
    H -- Incorrect or limited --> K[Redirect with local error]
    C --> L[POST lock form]
    L --> M[Clear session cookie]
    M --> D

Unlock request

The unlock endpoint rejects unsafe browser mutation requests before it compares a passphrase. It then applies the shared request limit, accepts only a small URL-encoded form, and verifies the passphrase against the configured credentials. A correct value creates the session cookie; a wrong value returns the gate with an incorrect-passphrase message.

Missing credentials and temporary service problems produce an unavailable state instead of exposing configuration details. Excess attempts produce a limited state and carry the retry time to the browser.

References: app/…/route.ts• L1-13 lib/…/http.ts• L24-90 lib/…/server.ts• L19-35 components/resume-controls.tsx• L7-64

Lock request

The lock endpoint uses the same browser request check and form size rule as unlock. It clears the session cookie and redirects to the selected language route, where the protected document is replaced by the gate.

The current resume document does not show a lock control after entry. The endpoint remains a separate access operation for callers that need to end the session.

References: app/…/route.ts• L1-13 lib/…/http.ts• L93-102 tests/…/resume.spec.ts• L49-60

Localized document assembly

The document has one shared shell and two language-specific content views. The shell provides navigation and language switching; the content view supplies the resume data and labels for the selected edition.

Content sources

The English edition reads localized data from the server configuration named RESUME_EN_CONTENT_BASE64. The Chinese edition uses RESUME_ZH_CONTENT_BASE64. Each source is decoded and checked against a bounded schema before the view uses it. Invalid configuration stops the private content load with a generic server error rather than returning private parser details.

The two schemas reflect different editions. English work entries use one period or a list of periods and require bullet content. Chinese entries can use a description instead of bullets and can include several periods, project engagements, open-source work, and education notes. If detailed configuration is absent, the page still uses selected published facts as a limited draft fallback after the access check.

Resume copy supports only the small emphasis forms needed by the document. The views render the remaining values as text, which keeps configuration from becoming executable markup.

References: lib/…/content.ts• L5-59 lib/…/content-zh.ts• L5-60 app/…/resume-content.tsx• L23-35 app/…/resume-content-en.tsx• L5-18 app/…/resume-content-zh.tsx• L10-24

Document views

The shared resume view builds the hero area from the person’s name, role, summary, and contact data. It then selects the English or Chinese section view, followed by a footer with a print or PDF control.

The English view presents experience, selected products and engagements, open-source work, capabilities, and education when those groups have data. The Chinese view presents the same broad resume areas with Chinese labels and its own period and description rules. Both views use the same section structure so language changes preserve the document’s main reading order.

References: app/…/resume-content.tsx• L25-95 app/…/resume-content-en.tsx• L30-122 app/…/resume-content-zh.tsx• L36-125 app/…/resume-content-zh.tsx• L165-207

Contact interface

The contact area gives an authorised reader direct paths to email, GitHub, and Zolplay. It adds a phone link only when the selected content provides a phone number, and it normalizes spaces and dashes for the telephone target while keeping the displayed number readable.

The access form uses the same language as the route. It supports password visibility, clear error messages, a pending state, and a native form submit. The print control invokes the browser print dialog and rechecks the server session when the browser restores a page from its back-forward cache.

References: app/…/resume-contact.tsx• L5-31 components/resume-controls.tsx• L7-64 components/resume-controls.tsx• L66-88

Layout and output modes

The resume has an independent visual system rather than inheriting the main site layout. It uses a wide grid for screen reading, adapts to narrow screens, follows the user’s dark-color preference, and switches to a compact A4-oriented form for print.

Screen layout

On a wide screen, the document aligns labels and section titles in a narrow column beside the main content. The page keeps a fixed reading width within the viewport, while long work entries and project groups follow a clear vertical order. On small screens, the grid becomes one column and the section labels move above their content.

The layout keeps touch targets and focus outlines visible for the navigation, contact links, form controls, and print action. Dark mode changes the page, text, rule, and form colors without changing the content order.

References: app/…/resume.css• L1-30 app/…/resume.css• L32-166 app/…/resume.css• L172-217

Print output removes navigation and interactive actions, sets a light paper palette, and compacts the type and spacing for A4 pages. It also avoids splitting key resume blocks across pages and keeps headings with the content that follows them.

The print control is therefore an output mode for the same authorised document, not a separate export path. The browser tests check both the hidden screen-only controls and the continued visibility of resume content in print media.

References: app/…/resume.css• L219-275 components/resume-controls.tsx• L66-88 tests/…/resume.spec.ts• L44-48 tests/…/resume.spec.ts• L71-74

Verification coverage

The browser suite verifies the access boundary as a user would experience it. It checks protected responses before unlock, successful entry in both languages, print behavior, session persistence, history restoration, no-JavaScript entry, narrow-screen behavior, and dark mode.

Browser guarantees

The main browser scenario confirms that an incorrect passphrase does not reveal protected copy, a correct passphrase reveals the full English document, and the same session can open the Chinese edition. It also confirms that clearing cookies returns the browser to the gate and that back navigation does not restore private content.

The no-JavaScript scenario confirms that the native form remains usable. The narrow dark viewport checks that the page does not overflow and that the main content columns remain aligned. These checks protect the core contract across both access states and both language views.

References: tests/…/resume.spec.ts• L6-88 tests/…/resume.spec.ts• L90-112

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the cookie name, expiry, signature rules, and server access check aligned. A mismatch can make a valid unlock appear to fail or leave an old session active.
  • Keep the locale field in the form aligned with redirect path handling. An incorrect value can send an English error or successful unlock to the Chinese route, or the reverse.
  • Keep the English and Chinese content schemas aligned with their render views. A valid configuration that the view does not expect can fail only after a user unlocks the resume.
  • Keep privacy headers on both access API responses and document responses. Removing them can make private copy cacheable or indexable even when the access check still works.
  • Keep print-only and screen-only selectors aligned with the controls. A layout change can leave navigation or actions in a PDF, or hide content needed for print.
  • Keep language links, route metadata, and document lang values aligned. These affect both language switching and how assistive tools read the document.

Important failure modes

TriggerConsequenceGuard
Missing or weak passphrase/session-secret configurationUnlock stays unavailable and no session is issuedCredential validation and the unavailable gate state
Wrong, expired, malformed, or old-secret session cookieThe route renders the gate instead of private contentSession shape, expiry, signature, and current-credential checks
Too many unlock attemptsThe user cannot try again during the rate windowShared request guard with a retry response
Unsafe mutation originLock or unlock is rejected without changing the sessionBrowser mutation request check
Invalid or oversized localized content configurationThe private content load fails without exposing parser detailsSize, canonical encoding, schema bounds, and generic configuration errors
Browser history restores an authorised document after the session endsStale private content could remain visiblePage-show session recheck and no-store response policy
Print or narrow-screen CSS hides or clips the documentThe resume is hard to read on paper or small screensBrowser checks for print visibility, width, dark mode, and column alignment

Key files

FileWhy to read it
app/…/resume-page.tsxShows the single server decision that selects the gate or the protected document.
lib/…/server.tsConnects the request handlers and the session check to server configuration and rate limiting.
lib/…/access.tsDefines credential checks, signed session behavior, expiry, and privacy response headers.
lib/…/http.tsDescribes the form contract and the unlock and lock response flow.
app/…/route.ts and app/…/route.tsExpose the two access operations as route handlers with temporary-failure handling.
app/…/resume-document.tsxDefines the shared language-aware document shell, metadata, and navigation.
app/…/resume-content.tsxCombines the shared hero and footer with the selected language view.
app/…/resume-content-en.tsx and app/…/resume-content-zh.tsxShow how the two localized editions turn resume data into document sections.
lib/…/content.ts and lib/…/content-zh.tsDefine the accepted private content shape for each edition.
app/…/resume.cssDefines screen, responsive, dark, and print behavior for the document.
tests/…/resume.spec.tsStates the end-to-end guarantees for privacy, unlock, localization, printing, and viewport behavior.