ArchyRWS architecture
Menu
Search Archy…

Search Archy

Docs / Confluence references

Confluence reference library

Archy can read a bounded Confluence page tree or explicitly selected space as a separate reference library. It does not convert those pages into RWS-ARCH notes or write back to Confluence. The local reader opens private files; an optional deployment cache serves signed-in main-site and enabled preview readers. Confluence remains the source; the authored Markdown vault and its published search index are unchanged.

Import and read

Use the repository's pinned Node runtime and installed dependencies. Choose a root page ID you are authorized to copy locally. The importer reads that page and its descendants through the Confluence Data Center API. It never searches or imports a whole space implicitly.

On an MIT workstation, inspect the public profile contract and deliver only the Confluence profile to the importer:

mit-secrets describe rws-confluence-architecture --json
mit-secrets run --profile rws-confluence-architecture -- \
  node scripts/confluence-import.mjs --root ROOT_PAGE_ID --max-pages 100

Replace ROOT_PAGE_ID with the decimal page ID from the Confluence page URL. The command needs CONFLUENCE_BASE_URL (HTTPS, including any context path) and CONFLUENCE_TOKEN in its process environment. Use command-scoped delivery; never put the token in arguments, source, an .env file or a snapshot. The equivalent npm entry point is npm run confluence:import -- --root ROOT_PAGE_ID. The MIT delivery command above runs Node directly so credentials are delivered to the process making the requests.

The default page cap is 100, including the root; --max-pages accepts 1–2000. Exceeding the cap fails the import rather than silently truncating the tree. To acquire all current pages in an explicitly selected space, add --space KEY. For the selected INFRAARCH library, the command is:

mit-secrets run --profile rws-confluence-architecture -- \
  node scripts/confluence-import.mjs --root 167514855 --space INFRAARCH --max-pages 2000

Here the root selects the landing page. The library retains other top-level pages in that space, instead of pretending they are descendants of the landing page. Trashed and other non-current results are excluded. The page cap also bounds the search inventory, including discarded results. The importer writes a private file at ~/.cache/archy/confluence/ROOT_PAGE_ID.json, outside the checkout and website. A failed import preserves the previous snapshot. Re-run the command to refresh the complete tree, including removals. Concurrent imports of the same root are refused. Read any failure before retrying; no background worker is running. If replacement succeeds but removing the import lock fails, the command reports success with a separate warning: the new snapshot is already committed. Verify no import is running before removing that root's lock and refreshing again. Space imports with more than one batch compare the acquired page ID and status inventory with a second metadata-only scan. A mismatch triggers one retry within the original request and time budgets. Refresh keeps the committed snapshot if the inventories still disagree. Requests have a 15-second timeout and a shared five-minute overall acquisition limit checked across HTTP requests, raster validation, image staging and before commit (optional attachment requests stop earlier to reserve commit time for acquired page text, and already-started filesystem writes or syncs cannot be interrupted mid-operation); each response is capped at 8 MiB, total transfer at 64 MiB, page storage at 1 MiB and the final JSON at 32 MiB. An oversized page listing retries at the same offset with a smaller batch. Downloaded bytes still count toward the transfer cap. A stopped process may leave a ROOT_PAGE_ID.lock file in the cache. Verify no import is running before removing that lock and retrying; never remove a live import's lock.

npm run dev

Open http://localhost:4321/confluence/, choose Open reference snapshot and select that JSON file. Its page tree appears directly beneath Confluence in the main menu. Expand or collapse branches to browse; the tree has no separate search field. Use the site's Search Archy control (Ctrl/Command-K) to search the loaded references' titles, spaces and rendered text alongside published notes. In the Type filter, choose All content, Confluence only, Authored notes only, or a specific note type. A reference result opens in the current reader and reveals its parent branches. The selected page is marked and its parent branches open when following a reference link. On narrow screens, open Menu to browse; selecting a page closes the menu and focuses the reader. Clicking the Confluence destination returns to the snapshot root without reloading the file. Use Open original in Confluence to check the current source. Local page links resolve by page ID or an unambiguous title within its space. An unresolved link is marked explicitly. Choosing Close snapshot in the local reader, or reloading, removes the open content from page memory, including its search projection, results and query. Reference queries stay in the search dialog. Fresh queries entered under Authored notes only or a specific note kind can open the catalogue with their query and filters. Text used in mixed or Confluence mode remains private when filters change; clear it before starting a new authored handoff. The local file is searchable while it is open in the reader. Reference content stays out of browser storage and the published search index.

The hosted /confluence/ page removes local file controls. Without the optional shared cache it reports that the library is unavailable. Only the exact loopback hostnames localhost, 127.0.0.1 and ::1 enable it. Use Archy's local server, keep it on loopback and stop it with npm run dev:stop when finished. Loading a file sends no file contents to a server. The page still loads Archy's own scripts and fonts normally.

Shared deployment cache and CI

The agreed shared audience is signed-in Archy readers, with the explicit CI machine-read exception below. Anonymous reading of authored notes grants no cache access. This is application-reader admission, not equivalent Confluence page restrictions: the selected library must be suitable for every admitted reader.

Preview verification can use the dedicated Keycloak automation reader described in preview verification. Its short-lived preview token supports real browser checks without an interactive human login. The trusted manual CI workflow keeps its credential outside PR-built browser code and reports no private page content. Main's machine JSON credential remains separate.

The owner explicitly trusts all Archy previews and their browser code and dependencies with this library (2026-11-18). On an enabled preview, scripts can read the full cache through a signed-in reader's session; this is intended data access, not an isolation guarantee. Cookie stripping and Pod separation protect server-side credentials, not snapshot data from that browser code. Site activation remains a GitOps choice, and reader sign-in is still mandatory.

The source runtime is tooling/confluence/cache.mjs; trusted deployment inputs belong to Intellium/argo, openshift/mit/apps/archy. A separate one-replica, Recreate worker owns the upstream token and a dedicated 1 GiB RWX cache PVC. Its code and npm lockfile come from reviewed GitOps ConfigMaps. A credential-free init container copies the cache files and installs the pinned production dependencies with lifecycle scripts disabled into the worker's read-only runtime. The cache uses Sharp to decode JPEG and WebP within its byte and pixel limits, and the same named-entity decoder as the reader. Keep the code projection and lockfile in one rollout. Builds and ordinary publication volumes receive neither the cache nor its credentials. An ingress NetworkPolicy admits explicitly enabled serving Pods to the cache Service; there is no public worker Ingress. Enabled previews read this same service rather than acquiring a second copy.

When explicitly enabled in OIDC mode, the host gateway sends exact GET /api/confluence/snapshot requests through actual OAuth2 Proxy reader-session admission. Missing/invalid sessions receive 401; an unavailable gateway cannot fall back to anonymous content. CI uses the separate exact /api/confluence/ci-snapshot endpoint with a dedicated bearer read token. Browser cookies and the ordinary status Basic password do not grant machine access, and that token does not create a browser session. The machine endpoint is enabled on main only. Cached raster images use the separate reader-only route described below; general attachments and Confluence write operations are not enabled. The snapshot paths return no-store JSON.

On enabled HTTPS main and PR previews, signed-in readers can open Search Archy from any page to search the shared library alongside published notes. Search loads the library on demand and matches titles, spaces and rendered text in the page. Use Confluence only or Authored notes only to narrow the results. Opening a reference from another page takes you to its page ID fragment in the reader. Published-note search remains available if the reference library is unavailable.

The browser renders references inertly and keeps the open page and search projection in page memory. A harmless tab switch retains the selected page, open branches and scroll position. Protected content is shielded while hidden; on return the reader checks the same reader session before exposing it again. A temporary inability to check access keeps content hidden with a retry action, while confirmed admission loss or a changed identity discards private content. A periodic session check also runs while visible. Leaving the page clears its private in-memory copy. Reference queries stay out of URLs and browser storage. An already received copy cannot be recalled from a reader's device. The first cache sync is tracked separately from an initial snapshot download: returning to its tab retains polling after same-reader admission, while pending or unknown admission keeps its result withheld. Denial or identity change ends that reader's tracking; it does not cancel the worker's accepted operation.

On enabled hosts the signed-in reader opens the cached library automatically. There is no separate shared-library open or clear action. The page title leads, with observed creator, creation date, updater and update date directly beneath it. Page details contains source identity, version, cache time and available labels. The body uses the wider reading frame, with On this page section navigation beside it on desktop and an expandable navigation on narrow screens. The active section follows scrolling, and section links open enclosing details.

Choose Update cache inside Library cache to fetch the full configured INFRAARCH library for all readers. Refresh this page acquires only the selected page directly from Confluence. Exact same-origin JSON POST requests pass through reader-session admission; the CI token grants neither action. Only one operation runs at a time. The portal reports busy requests without joining another reader's operation. Accepted refreshes have unique operation IDs; only their matching completion and a read-back whose raw bytes match the completed snapshotSha256 can produce a success message. A missing or mismatched proof keeps the last admitted copy and offers Read latest library. That action reads the current admitted cache without claiming the earlier refresh succeeded. A transient download failure still offers Try again against the original proof. Completion confirmation requires the companion worker with completion-digest support; ordinary opening remains compatible with earlier workers. If another operation replaces the shared status before confirmation, the portal reports that it could not confirm the request and leaves retry available. The reader displays progress, preserves the selected page if it still exists, and updates its main-search projection after successful replacement. The open library and search remain available while a replacement is fetched, validated and indexed. If read-back fails while the reader is still admitted, Try again reopens the current selection. Explicit access denial, session loss and navigation still discard private data. A page refresh preserves the full library's sync timestamp; its completion message records that the individual page was checked. To reflect removals or changed scope, sync the library. These controls do not edit Confluence.

The worker imports on startup and hourly, with an explicit root and optional space key. Tree mode has a 100-page cap; explicit space mode has a 2000-result cap, with the same byte/time limits as the local importer. A cache-wide exclusive lock serializes acquisition and publication. Each page refresh reloads the committed snapshot while holding that lock, rechecks membership and version, and merges only into that generation. A replacement that encounters a startup writer reselects committed content on reads until it observes the writer's lock release, preserving readable last-good content during the refresh. Routing, method and machine bearer checks run before recovery reads, so rejected machine requests do not reopen or parse the snapshot. Image bytes live in private content-addressed sidecars under the worker's existing PVC. They are staged before the atomic manifest replacement. A page refresh replaces only that page's image manifest and metadata; a full update also removes deleted pages' references. Unreferenced blobs are swept only after the new manifest's parent-directory sync confirms durability. An uncertain post-rename sync reports an error and retains blobs for both possible post-crash generations. The next successful update reconciles them.

Image acquisition has its own 64 MiB transfer and committed-blob budgets, separate from the existing JSON transfer budget. Each image is limited to 4 MiB, 16 megapixels and an 8192-pixel side. A page has at most 32 cached filenames, and an acquisition has at most 512 attachment requests. Full sync checks pages with cached images first. A successful refresh includes only images verified during that refresh. Missing attachments (404 or 410), temporary failures (429, 5xx or transport errors), and exhausted attachment budgets omit the affected previews and keep the page text. An attachment authorization denial (401 or 403) or redirect aborts the refresh. A structurally invalid listing also aborts it. The worker retains the last complete snapshot until it expires. The worker admits four image reads at a time, with a bounded waiting queue. Image GET/HEAD requests require a reader session; the CI bearer grants no image access. The worker verifies current manifest membership and file integrity, then rechecks the selected generation before responding. Responses are private, no-store and restricted to same-origin embedding.

Interrupted locks at /cache/refresh.lock on the shared cache PVC require an operator to verify that no writer remains before removal: inspect the active cache worker Pod(s) in namespace archy (confirming no replacement or in-flight refresh process is running), remove /cache/refresh.lock on the PVC, and then trigger a fresh sync (POST /api/confluence/sync or the signed-in reader's Sync library action) and verify GET /api/confluence/status returns state: "ready" with a current importedAt timestamp and snapshotSha256. Graceful shutdown aborts active acquisition and awaits lock cleanup. Complete snapshots replace the persistent file atomically; failed refreshes retain the last complete snapshot. Copies older than 24 hours stop being served, including after restart. A full sync can rebuild a damaged manifest that meets the cache file's ownership, permissions and size checks. Existing image files stay in place until the replacement manifest is durable. Under the writer lock, recovery removes abandoned manifest and image staging files before rebuilding. Recovery can hold up to three generations of image files. If retained files fill that space, the worker commits validated pages with the images that fit. It then prunes unused files to make room for the next sync. Startup validates and normalizes the configured HTTPS base URL; warm and newly acquired snapshots must match that source URL, the root ID and configured space. A changed source or context path cannot reuse the previous source’s snapshot if refresh fails. This is a bounded stale-copy policy: removals/restrictions are reflected after a successful refresh, and upstream denial can leave the prior copy readable until expiry. Emergency withdrawal means disabling access and clearing the trusted cache through an authorized operation, not merely hiding navigation.

Required references, never values in Git:

Location Name/key Consumer
Namespace archy Secret archy-confluence / token Worker upstream GETs only
Same Secret archy-confluence / read-token Worker's CI endpoint only
Encrypted Forgejo Actions Secret CONFLUENCE_CACHE_READ_TOKEN Manual main-branch cache validation on the owner-selected shared runner

The read token must be a separately generated 43–128-character base64url token; it must not reuse the upstream Confluence token. Do not put either in repository variables. The manual Shared Confluence cache workflow checks out main, uses only that read credential, validates the deployed snapshot in memory and reports only its page count. It never calls Confluence, writes payload files, uploads artifacts or adds content to static output. The ordinary PR check job has no cache credential mapped into its environment.

The owner selected the existing shared docker runner for this workflow and confirmed it only runs their workloads. The runner and its scheduled jobs are therefore one trusted environment for the cache token and private snapshot. This explicitly includes the new cache read credential in the shared-runner operating decision; see the repository operations guide.

The host Docker socket permits jobs to access each other's data and credentials. A main checkout/ref guard selects the consumer's source; it does not prevent other jobs on that host from accessing the token or snapshot. Encrypted Actions secrets do not establish job isolation either. No isolated-runner guarantee is claimed or required by the selected trust model. Reassess this decision before allowing workloads the owner does not trust with the cache onto that runner.

Chart defaults stay disabled, with no root selected. The companion GitOps change selects INFRAARCH with landing page 167514855, OIDC main and PR #16 preview, and one shared cache. Activation needs provisioned Secret references and actual PVC/SCC/network/router acceptance. A private local acquisition on 2026-11-18 read 909 current pages, including 44 outside the homepage tree; this proves source acquisition, not deployed availability. The worker's private 600-mode persistent file requires a stable permitted workload UID across replacement Pods; validate that and cross-node volume behavior before activation. Disabling the feature may prune its disposable PVC; preserve needed evidence before an authorized rollback. Source preparation and local checks do not prove live activation. Deployment and its observed state are recorded separately.

Fidelity and freshness

The snapshot records the source base URL, root, page IDs, parent IDs, titles, spaces, observed page versions and import time. When Confluence supplies them, it also records creator and updater display names, creation and update dates, and a complete observed label list. Missing metadata remains unknown; the cache never infers an author or treats its own import time as a source update date. The tree is collected through multiple requests, not a transactional upstream snapshot. Import time is not an upstream modification date, architectural approval or proof of freshness. Check the original if pages changed during or after the import.

The viewer constructs inert text, headings, lists, tables and HTTPS links from storage XHTML. Layout containers retain their narrative in source order, and static info/note/warning/tip/panel/expand/section/column/excerpt/details macro bodies are shown with their source title when present, otherwise their macro name. Callouts, table captions and headers retain their reading context; expand macros become disclosure controls. Supported named XHTML entities are decoded in prose and attribute values, while CDATA and comments remain unchanged. Code/noformat and Markdown/wiki source blocks preserve their literal text. Status macros use Archy's badges. Unsupported wrappers retain safe child text; unsupported macros retain available static bodies and titles while marking unavailable live output. Malformed or overly complex XHTML falls back to literal source text. Source scripts, styles, active SVG and event handlers are never inserted into the reader. The shared cache also acquires same-page raster image attachments and available draw.io PNG previews. The reader displays only images named in the selected page's validated manifest. It requests them from Archy's same-origin, OIDC-protected image endpoint; source URLs never become browser image requests. Static PNG, JPEG and WebP must pass file-signature, structure, size and dimension checks. Source response types remain allowlisted; the served MIME type follows the verified raster bytes, so a mislabeled JPEG does not become a broken PNG. Attachment file size is an early admission check; the completed bounded download determines the recorded byte count, accommodating Confluence's JPEG transformations. HTML and SVG payloads are not accepted as raster images. Unsupported images and other attachments keep a named placeholder. Local JSON files contain no binary sidecars, so local-file viewing continues to show image placeholders.

The linkgraph macro displays directed links resolved from cached pages, with keyboard-accessible page nodes. Its diagram is limited to 16 pages, 32 edges and two levels in each enabled direction; the complete direct-link lists remain available. Parentage is not treated as a page link. Page trees, child lists and tables of contents use the snapshot too. Cached include and excerpt macros use only pages already in the library, with cycle, depth and node limits. Markdown and basic legacy wiki bodies render as inert text and formatting. Page-property reports support exact label, space and optional direct-parent conjunctions from the source, including parent = currentContent(), with at most 60 rows. They show observed cached properties; missing or ambiguous cells stay blank. Other filters remain explicit source fallbacks, rather than approximate query results. Those derived widgets are excluded from full-text indexing. Explicit and heading anchors navigate locally when present; missing sections are marked instead of silently redirected.

These views use Archy's existing colors, typography and table/callout styles. They do not reproduce every Confluence plugin or layout. Live Jira data and unsupported report queries still need the original. Do not treat the reference rendering as a complete archival copy. Other attachments and external pages are not downloaded. Opening an external link is an explicit navigation and uses the destination's own authentication.

Private-copy boundary

Acquisition sees what the supplied credential can read. This does not establish that another person may read or publish the copy. The viewer does not replicate Confluence restrictions or revoke offline files when access changes. Keep the snapshot private, refresh before relying on it, and delete the local JSON when it is no longer authorized or needed. Clearing the viewer does not delete it. Do not move snapshots into Git, RWS-ARCH, site assets, previews or PR attachments. The optional shared cache has a separately agreed audience; it does not replicate upstream per-page restrictions. Markdown conversion and Confluence publishing remain separate work.

Implementation and evidence

This is an independent implementation informed by a read-only inspection of rws-arch-wb at d224d15b83a46834560c3a3c7ecd3052ebc2b4f9. No code, content, configuration or assets were copied. It retains the useful separation of source references from authored architecture and last-good refresh behavior. The runtime cache is independently implemented with the same bounded importer. Omissions are explicit and page links resolve from the currently open snapshot.

Acquisition and browser tests use fixtures in the normal check suite, including denied reads, caps and failed refresh, hostile XHTML, file clearing, hosted-origin refusal and absence from authored search. These checks do not prove live service access, source rendering fidelity for every macro or deployed access control.