Almanack technical audit — 8 September 2026
Almanack builds successfully, and the selected site and membership tests pass. Those checks nevertheless miss several paths that can lose paid credits, replace membership data, publish the wrong content, or leave returning readers running old JavaScript. Repair accounting, recovery, publication validation, and verification before undertaking a broad structural rewrite.
This report covers the technical problems found in the current working tree, including unresolved findings from the July critique. It distinguishes observed failures from source findings and conditions that still need operational verification. It is a point-in-time audit, not a claim that every possible defect has been discovered. It records 57 findings across membership, operations, content generation, browser behavior, and tooling. No application fixes are included.
Baseline: 29a57323225c8740dff802868e7f5031b0c501fc. The existing editorial
working-tree edit and local agent configuration were left untouched. Source
locations below are repository-relative and refer to that baseline.
System and trust boundaries
The publishing application uses Django as an editorial database and static
renderer. sync_with_repo imports filesystem content into SQLite;
build_with_distill renders routes and copies assets into web/. Caddy serves
that output. The manual is also published from doc/. Pandoc exports constitute
a separate rendering and asset-copying path.
The membership service is a separate FastAPI/SQLModel application with its own SQLite database. Browser identities sign requests with Ed25519. Stripe webhooks credit balances; visits debit them. Shell scripts and Make targets deploy both systems, back up databases, and switch between hosts.
flowchart LR
E[Editorial files] --> S[Sync command]
S --> D[Django SQLite]
D --> B[Static build]
M[Manual and shared assets] --> B
B --> W[web directory]
W --> C[Caddy]
E --> P[Pandoc export]
R[Reader browser] --> C
R --> A[Membership API]
T[Stripe webhooks] --> A
A --> Q[Membership SQLite]
Q --> F[Backup and replica scripts]
Editorial HTML and figure modules intentionally execute with the site’s
authority. Their use of raw HTML or innerHTML is not, by itself, an XSS
finding. The figure capability declarations do not sandbox JavaScript. Django
development routes are distinct from the public static site; findings about
those routes do not establish an exploit against production Caddy.
Evidence and coverage
| Check | Result |
|---|---|
bin/a-test --suite unit,api-unit |
204 passing assertions; no skips |
bin/a-test --suite doc |
101 passing TAP records, exit zero; see O4 for limitations |
ruff check src api --output-format concise |
Seven findings, all in tests: unused imports/locals and import ordering |
Django check |
No issues reported |
makemigrations --check --dry-run |
No model/migration drift reported |
| Full static build from a read-only snapshot of the working Django database | Succeeded in a temporary root; 125 HTML files and 1,723 collected static files |
| Local-reference inspection of that artifact | Seven missing URL targets, eight references; 228 unversioned static references across four URLs |
| Chromium smoke against that artifact | Seven pages at 1280px and 390px; no uncaught page errors; mobile overflow and missing dynamic image requests observed |
| Synthetic Django probes | Twenty cases covering paths, sync, dates, routing, ranges, feeds, and event export |
| Membership HTTP probes | Six cases using temporary WAL SQLite, actual Ed25519 verification, and synthetic Stripe HMAC signatures |
| Frontend/operations probes | Node VTT/module tests, Chromium scene-selector test, TAP failure and replica-restart failure injection |
| Standalone export | Synthetic article exported successfully; private _source asset was copied |
The build used the existing database snapshot rather than resyncing real inbox
content. Sync behavior was exercised with synthetic editorial fixtures and an
in-memory database. Browser requests were fulfilled from temporary build files;
external page requests were blocked. The working database and web/ were not
rebuilt in place. Tests of destructive production scripts used logging stubs;
no production SQL, deployments, DNS changes, payments, or messages were sent.
Live servers, actual Stripe destination versions, CI enforcement, real backup recoverability, private records, encrypted editorial bodies, and vendor-library internals were outside this audit. The full container, checkout, browser, regression, and mobile pytest suites were not run. The Chromium smoke is not an iOS Safari or assistive-technology certification. Dependency review verified the locked Django version and deployment manifests, not every transitive CVE.
Priority: P1 means repair before relying on the affected payment, publication, or recovery operation. P2 means a substantial correctness, accessibility, reliability, or maintenance defect. P3 means a smaller repair. Evidence: “Reproduced” means an isolated behavioral check; “source” means the consequence follows from inspected code; “conditional” identifies an additional trigger or external configuration that was not observed live.
Membership and payments
A1 · P1 · A concurrent visit can erase a paid credit
Evidence: reproduced. api/main.py:200, :226, :242, :425, :457.
Visit and payment handlers load a balance and later assign an absolute value.
Unique visit/event constraints do not protect two different valid operations
from overwriting each other.
The HTTP probe paused a visit after its member read, credited 5,000 through a valid webhook, then resumed the visit. Both returned 200. The stored balance was −50, with a +5,000 transaction and one visit recorded; it should have been 4,950. Retrying the payment cannot repair it because its receipt is already committed. This interleaving is possible with the supplied Uvicorn configuration: synchronous visits and the async webhook run separately.
Use database arithmetic for balance changes, within the transaction that claims the business operation. Protect last-visit/streak changes too. Test independent sessions against a temporary file database with a controlled interleaving; reconcile balances against payment and visit history.
A2 · P1 · A second monthly subscription loses the mapping for the first
Evidence: reproduced. api/models.py:15; api/main.py:293, :329,
:428, :452. Recurring checkout can create another subscription, but a
member stores only one subscription ID. Completing the second replaces the
first mapping while the first subscription can continue charging.
Two completed subscription checkouts followed by a renewal of the first produced HTTP 200 and a quarantined invoice, without credit. Store every subscription’s member association and lifecycle. If only one is allowed, enforce that at checkout with a concurrency-safe reservation. Provide a subscription management/cancellation route and test replacement, cancellation, late invoices, and concurrent checkout attempts.
A3 · P1, conditional · Current Stripe invoice schemas are incompatible
Evidence: reproduced with the documented schema; production version
unverified. api/main.py:448; api/tests/test_webhook.py:28. The renewal
handler reads only invoice.subscription. Stripe removed that field in
2025-03-31.basil; it moved to
invoice.parent.subscription_details.subscription.
Stripe’s migration notice
documents the change.
A correctly signed invoice using the replacement structure was quarantined as missing a subscription ID despite a valid member mapping. An endpoint pinned to an older schema may still work; upgrading the SDK alone does not change a webhook destination’s version. Record the supported destination version, handle its schema, and use realistic versioned fixtures. Reconcile already-quarantined invoices after repair.
A4 · P2 · Duplicate business events can credit the same payment twice
Evidence: reproduced. api/models.py:19, :36; api/main.py:368,
:435, :462. Uniqueness covers Stripe event IDs, not Checkout Session or
Invoice IDs. Two valid events with different IDs and the same checkout object
credited 1,000 twice. Stripe explicitly describes this possibility in its
duplicate-event guidance.
Keep delivery receipts, and add a unique credit-operation key based on the paid object and operation type. Test both repeated delivery of one event and different event objects for the same payment. This is not a claim that clients can forge Stripe signatures.
A5 · P2 · Registration bypasses authenticated profile reads
Evidence: reproduced. api/main.py:145, :156, :176;
assets/js/identity.js:78. /me requires a signature, but an unsigned
/register request for an existing public member ID returns the same
name/balance/streak profile. Its signing public key can be obtained from the
self-certifying public ID; supplying it does not prove secret-key possession.
No account mutation or takeover was demonstrated. Decide whether these fields
are public. If they are private, return a minimal registration acknowledgment
and require authenticated /me for the profile, or authenticate the existing
member branch. Document and test the chosen contract.
A6 · P3 · Timezone-free timestamps produce HTTP 500
Evidence: reproduced. api/main.py:40, :45.
datetime.fromisoformat() accepts a naive timestamp, then subtraction from
timezone-aware now raises an uncaught TypeError before signature checking.
An ISO timestamp without an offset produced HTTP 500.
Require an explicit timezone and return a controlled validation/authentication error. Test naive, invalid, expired, and future timestamps. This is malformed input handling, not an observed authentication bypass.
A7 · P2 · Quarantine has no implemented reconciliation operation
Evidence: source. api/main.py:368, :380, :389.
Persisting rejected webhooks is a useful July improvement, but there is no
review/reprocess command or endpoint in this tree. Receipted quarantined
events are acknowledged on replay before processing; a later code or member
mapping fix therefore does not make a Stripe resend apply the credit. Stored
payloads are truncated to 4,000 characters (api/main.py:476), so recovery
may require retrieving the original event by ID rather than parsing that field.
Add an operator-visible reconciliation queue and an idempotent repair operation that records who applied which correction and why. Distinguish transient failures from permanently malformed events. A durable row and a log entry are not yet an operational process for returning missing credit to a member.
Deployment, backup, and verification
O1 · P1 · Failover does not preserve the active database’s writes
Evidence: source; conditional on using the documented replica job.
bin/a-db-sync:13, :64; bin/a-failover:106;
doc/03-website/01-setup.md:291, :323. The documented/default replica job copies the primary
database onto the secondary. Failover changes DNS/Caddy without disabling or
redirecting that job. Once the original primary is reachable, replication can
overwrite registrations, visits, and paid credits accepted on the promoted
secondary. Failback also switches traffic without first transferring those
writes back.
Use an explicit active-writer role, prevent replication toward it, fence writes during promotion, and transfer/validate the latest authoritative state before failback. Test failover → payment → replication → failback. Existing outgoing snapshots may aid manual recovery; they do not automatically reconcile payments. No actual live data loss was observed.
O2 · P1 · API deployment deletes history without a backup and removes service too early
Evidence: source. Makefile:390, :400;
api/migrations/001_unique_indexes.sql:13. Every deploy removes the running
container, executes bulk deduplication DELETEs, and then builds its replacement.
No backup precedes the DELETEs. A migration/build failure leaves the old API
removed. Deduplication retains one row per event/day without reconciling the
member balance; deleting duplicate evidence cannot establish correct accounting.
Build and test the replacement image first. Back up, inspect duplicates, and obtain scoped approval for destructive reconciliation. Use versioned, transaction-controlled migrations and retain a restart/rollback route to the known-good image. The audit did not execute this migration against real data.
O3 · P1 · Missing or empty restore input can replace production with an empty database
Evidence: source and SQLite semantics; live restore not attempted.
Makefile:445, :459. Restore stops the API before checking that DB_FILE
exists, is nonempty, and has the expected schema. The remote side accepts
the upload on PRAGMA integrity_check alone; an empty SQLite database can
pass that check. A failed local cat can be noticed by pipefail after the
remote side has already promoted the empty incoming file. The error message
then incorrectly says the database was unchanged.
Validate input locally, upload completely, and validate schema/integrity before stopping or swapping. Separate transfer from promotion and track whether the swap happened. The existing server-side pre-restore backup helps recovery but does not prevent this outage.
O4 · P1 · The release gate can accept failed TAP assertions
Evidence: reproduced. bin/a-test:172, :286;
src/tests/doc-check-links:23; bin/a-verify:36. The runner forwards not ok
but determines success only from the child process exit status. The doc checker
ends with jq, which can emit failing TAP records and exit zero. The release
gate calls this runner without a TAP evaluator.
A child that printed not ok 1 - broken link and exited zero made
run_suite_streaming() return (1, 0). Treat failing assertions and bailouts
as failures independently of exit status, and have link checkers fail explicitly.
On this checkout the doc runner printed 101 successes, while its underlying
whole-directory lychee scan reported 31 errors in HTML demo files: those files
are omitted from the Markdown-only TAP list. Report the check’s actual scope.
O5 · P1 · Hook installation removes Git LFS’s upload hook
Evidence: source. bin/a-install-hooks:9; .gitattributes:5;
Makefile:125. Installation overwrites pre-push with verification alone,
without preserving the existing hook or invoking git lfs pre-push. Binary
formats are LFS-tracked. A developer can push pointer commits without uploading
the new objects, while verification passes against materialized local files.
Install a dispatcher that preserves hooks and passes LFS its arguments and stdin. Test a new asset through a disposable remote. CI checkout also needs explicit LFS materialization and a check that required files are not pointers. Do not repeat the older “all videos are ordinary Git blobs” diagnosis: LFS attributes are now present; their integration is the defect.
O6 · P2 · A rejected replica snapshot leaves the API stopped
Evidence: reproduced with logging stubs. bin/a-db-sync:64;
bin/a-db-swap:21. After stopping the destination container, a swap error
under set -e exits before the restart. Injecting swap exit 23 into the real
script recorded a stop and no start; no network or database operation ran.
Validate before shutdown where possible. Install recovery handling before stopping the service, preserve its initial state, and check its health after restart. Test the complete sync operation under validation, disk, transfer, and startup failures, rather than only the swap helper.
O7 · P2 · Backup commands can report success for unusable or overwritten backups
Evidence: source and harmless shell reproduction. bin/a-list-backup:13;
Makefile:438. Remote pg_dump | gzip has no remote pipefail. A failed dump
can produce an empty compressed file and a success message; the shell analogue
returned zero and a 20-byte gzip. Local pipefail does not fix a remote pipeline.
Both backup naming schemes have only hour precision and write directly to the
final path, allowing a second attempt to overwrite a good backup.
Use remote failure propagation, unique temporary filenames, verification,
and an atomic final rename. Define retention and exercise isolated restores.
bin/a-list-export:15 similarly treats curl/JSON failures as end of pagination
and can return successful partial output; distinguish errors from exhaustion.
O8 · P2, conditional · Outgoing SQLite backups can omit committed WAL data
Evidence: source; uncheckpointed/crashed-database condition not reproduced.
api/db.py:24; bin/a-db-swap:34, :39; Makefile:456, :462.
The API uses WAL, but outgoing/pre-restore backups copy only the main database
file, then remove WAL/SHM files. A normal clean shutdown can checkpoint the
database; an already crashed or forcibly stopped process may leave committed
frames in WAL. In that case the backup is incomplete and removing sidecars
discards recovery data.
Use SQLite’s backup facility or require and verify a successful checkpoint before copying. Test recovery with a deliberately uncheckpointed disposable database. This qualifies the existing backup improvement rather than claiming that every normal backup is corrupt.
O9 · P2 · Parallel Make can run verification, sync, and build against each other
Evidence: source. Makefile:368, :375; bin/a-verify:40.
The deploy prerequisites are siblings, not an ordered dependency chain.
make -j prod-deploy, including inherited MAKEFLAGS, can run sync, build,
and verification concurrently. Verification itself migrates, syncs, and builds
the same database/output. Waiting for all prerequisites before deployment does
not prevent races between them.
Express the required order and isolate verification’s database/output. Prevent two publication processes from sharing mutable staging directories. Keep finance regeneration and external astronomical-data acquisition separate from the critical release path so unrelated credentials or services cannot prevent an urgent code deployment.
O10 · P2 · The tested dependency set is not the deployed API image
Evidence: source. api/Dockerfile:1; api/requirements.txt:1;
pyproject.toml:11; bin/a-verify:28; Makefile:400.
The API image installs unpinned packages with pip, using neither uv.lock nor
api/requirements.txt. Unit tests use the locked project environment. Rebuilding
the same commit can therefore change framework and Stripe versions. Several
other compose images also use floating tags.
Build from one locked dependency manifest and identified base images, run the
meaningful API tests against that image, and associate its digest with the
release. Remote git pull plus a local gate does not prove the remote commit
is the one tested. Health-checking a build stamp against the remote checkout
detects staleness relative to that checkout, not equivalence to local tests.
O11 · P2 · “All tests” and release checks omit important regression coverage
Evidence: source. Makefile:207; bin/a-test:109;
bin/a-verify:35; .forgejo/workflows/verify.yml:10.
test-all omits api-unit, the main payment/auth suite, and permits container
smoke skips unless strict mode is set. The release gate runs no browser,
mobile, web-link, or regression suite. Moving a fixed bug’s test into the
regression marker removes it from ordinary release verification.
Include API unit tests in test-all and make required environments fail
explicitly. Add meaningful publication, security, and browser regression gates.
The existing operations tests often assert source strings rather than execute
failure transitions (src/tests/test_deploy_loop_hardening.py:20). Also,
src/tests/web-check-links:7 checks a development server, not built web/,
and skips if that server is absent; it cannot establish artifact integrity.
O12 · P2 · Health checks do not reliably validate the destination being promoted
Evidence: source; actual remote responses unobserved.
bin/a-failover:140; bin/a-web-deploy:35;
assets/system/docker-compose.yml:10. Failover changes routing before testing
the destination, converts curl failures to text, and still reports completion.
Its probes disable TLS verification. Web deploy checks http://localhost/
through a proxy whose site route depends on the almnck.com host, rather than
the intended virtual host and new artifact.
Probe the destination’s actual host/SNI and API before promotion, verify an artifact/release identifier afterwards, and fail or roll back explicitly. Allow for DNS cache overlap when withdrawing the previous service.
O13 · P2 · IPFS deployment writes a different secret path from the secondary’s configuration
Evidence: source. Makefile:410;
assets/system/docker-compose.dallas.yml:94. The shared deploy writes an env
file inside the cluster directory; the secondary compose reads a differently
located env file outside it. Provisioning can fail, or a rotation can leave
the consumed secret unchanged.
Use one consistent location or explicit per-host configuration, then verify that the intended configuration was consumed. The audit did not inspect live host files or secret values.
O14 · P2 · Verification checks and mutates the current worktree, not the pushed revision
Evidence: source. bin/a-install-hooks:16; bin/a-verify:30, :40.
The hook ignores ref updates on stdin and verifies the current working tree.
A dirty tree can pass while the commit being pushed differs. Verification also
resolves the venv, migrates/syncs the normal Django database, and rebuilds
web/; it is not an isolated smoke test.
Verify a clean checkout of the actual release revision with separate state and outputs. The Forgejo workflow now exists, but repository files cannot prove runner registration or branch protection is enabled. Confirm a required check against a known commit. Define the runner’s LFS, lychee/jq, container, and astronomical-data prerequisites explicitly.
Content, Django, and static generation
C1 · P1 · Development asset URLs can read outside their asset directory
Evidence: reproduced. src/almnck/units/views.py:695, :795;
src/almnck/units/urls.py:115, :130. Asset handlers concatenate the supplied
path without resolving it and enforcing containment. A Django client request
to /audit-asset/assets/../local-only.txt returned the synthetic file outside
assets/ with HTTP 200. Draft asset serving has the same construction.
Resolve paths and require them to remain inside the allowed asset root, including after following symlinks. Restrict publishable asset names and test encoded traversal and draft routes. Exposure is conditional on access to the Django server; this is not a demonstrated traversal through production Caddy.
C2 · P1 · Content paths can make the build write or delete outside its output root
Evidence: reproduced for an out-of-root write; deletion is source-confirmed.
sync_with_repo.py:157 and build_with_distill.py:112, :117 under
src/almnck/units/management/commands/. Explicit frontmatter paths are trusted
and joined to the output directory. A fixture with /../escaped-output/
wrote an asset outside web/. If the resulting destination exists, the build
calls shutil.rmtree() on it before copying.
Validate canonical paths at ingestion, reject dot segments/reserved paths, and enforce resolved containment again at every filesystem write/delete. Trusted editors can still make path mistakes; this is a destructive build boundary even without an untrusted content author. The probe wrote only to its own temporary directory and did not exercise out-of-root deletion.
C3 · P1 · Sync can partly update, silently unpublish, or prune a partial content tree
Evidence: reproduced parser/error behavior; transaction/prune behavior from
source. sync_with_repo.py:31, :46, :55, :170, :245 under the command
directory. The zero-unit prune guard is useful, but a nonempty partial checkout
still permits deletion of all unseen units. The command applies per-unit
changes before establishing that the scan and all parses succeeded, without
one transaction for the complete proposed change.
A published fixture missing its date printed ERROR and returned success. Malformed YAML silently became empty metadata and produced a draft row; editing an existing published unit this way can remove it from publication. A later exception can leave earlier writes committed.
Parse and validate into a proposed change set, report errors as failure, check scan completeness and deletion scope, then apply atomically. Require an explicitly reviewed destructive prune with a recoverable database snapshot.
C4 · P1 for exposed Django · The lockfile pins unsupported Django 5.0
Evidence: installed version and lockfile verified. uv.lock:336;
pyproject.toml:12. Both the environment used for this audit and the lockfile
contain 5.0, not its final patch release. Django 5.0 support ended on
2 April 2025, according to the
Django support table.
Move the lock to a supported release series and current security patch, then exercise templates, migrations, distill, and the built site. A lower bound in pyproject does not update a frozen lock. Static Caddy pages do not expose the Django request stack, so this is chiefly a development/admin/runtime concern; the audit does not claim every past Django advisory is reachable here.
C5 · P2 · Frontmatter has no consistent schema or date normalization
Evidence: reproduced. sync_with_repo.py:140, :245, :274, :439;
src/almnck/core/citations.py:9; src/almnck/events/models.py:85.
An ordinary unquoted YAML date became datetime.date and crashed sync on
.startswith(). An unquoted margin-box starts date failed JSON serialization.
A YAML list instead of a mapping caused .get() to fail. Invalid calendar
values are accepted by multiple parsers: month 13 crashes display, while
2026-00-00 rendered “December 0th”; events accept (99, 99).
Create one typed parsing/normalization layer for metadata, statuses, dates, counts, weights, and list fields, with deliberate BCE and recurring-date semantics. Serialize normalized JSON values and reject malformed dates before database writes. Test YAML-native dates as well as quoted strings.
C6 · P2 · The editorial scanner descends into directories it says it skips
Evidence: reproduced. sync_with_repo.py:80, :104, :202.
Skipping a path yielded by rglob() does not prune that path’s descendants.
A fixture under articles/item/assets/nested/notes.md was discovered as a
unit. The broad “any Markdown or text file” fallback also makes checklist and
resource directories eligible; its first-file choice has no explicit ordering.
Traverse only the defined content roots and prune excluded subtrees before descending. Require an unambiguous primary file or a defined inbox convention. Report ambiguous units rather than selecting whichever filename is returned first. This also reduces the chance that an almost-empty scan evades C3’s guard.
C7 · P2 · Published output paths need uniqueness and reserved-route validation
Evidence: reproduced. src/almnck/units/models.py:27;
src/almnck/units/views.py:514; build_with_distill.py:143.
Two published units can share output_path; resolving that URL raised
MultipleObjectsReturned. Paths can also conflict with generated roots,
manual routes, date redirects, or other fixed routes. Same-day article
redirects are overwritten in queryset order rather than using an explicit
selection rule.
Validate nonempty published paths, uniqueness, reserved prefixes, and redirect collisions across the complete proposed build. Use a suitable conditional database constraint as a second check. Report conflicts before distill removes the previous artifact, and define the redirect policy for several articles on one almanac day.
C8 · P2 · Development and static page routes select different behavior
Evidence: reproduced resolver mismatch. src/almnck/units/urls.py:135;
src/almnck/units/views.py:510, :634. Two identical catch-all patterns exist.
The first calls article_detail, which does not restrict unit type, making
the page route unreachable through normal Django routing. /subscribe/
resolved to article_detail. Distill nevertheless invokes the separately
registered page view directly.
Page margin selection therefore differs between development and generation.
Use one dispatcher and one shared rendering path, and test through the URL
resolver and generated artifact. The old critique’s subscribe-confirmation
example needs qualification: the current page has client-side thanks=1
handling, so the unreachable Django context branch does not establish that
the visible confirmation is broken.
C9 · P2, conditional · Draft previews are not restricted to development or authenticated editors
Evidence: reproduced. src/almnck/units/urls.py:108;
src/almnck/units/views.py:713, :740; src/almnck/settings.py:9.
The comments say development-only, but the routes have no DEBUG or login
guard. With DEBUG=False, an unauthenticated request still returned the
synthetic draft body with HTTP 200. Default settings also use a development
secret and wildcard hosts in DEBUG mode.
Disable preview routes outside explicitly enabled local/editor environments or require editor authentication. Bind local servers appropriately and reject development secrets in any intentionally exposed Django deployment. Drafts are not currently distilled by those preview routes; do not confuse this finding with automatic public publication of all inbox content.
C10 · P2 · Static cache invalidation is inconsistent even before module loading
Evidence: built artifact and source.
src/almnck/templatetags/cdnstaticfiles.py:64;
src/almnck/units/views.py:30, :431, :438;
src/almnck/templates/base.html:10; assets/css/almanack.css:94, :103.
The artifact contained 112 unversioned font preloads, 112 favicon references,
three margin-box cover references, and one top-up stylesheet reference.
CSS-relative font URLs also lack content versions. These URLs are served under
the immutable static policy. Updating the file does not update a returning
reader’s cached representation. Fonts may be intentionally fixed under their
current filenames; that requires preserving those bytes or renaming changed
fonts, not overwriting an immutable resource.
DEBUG is on by default, so template tags use timestamps and prevent reproducible HTML; production tags use only Git HEAD, which misses uncommitted asset edits. The Markdown helper caches hashes for the process lifetime, so editing a file can leave its old tag in the development server. Use a single content-based asset manifest with deliberate development invalidation. B1 covers imported JavaScript dependencies that need the same treatment.
C11 · P2 · Adding or removing interactive margin code may not update metadata
Evidence: reproduced. sync_with_repo.py:397, :406, :428.
Margin interactivity is detected from assets/code.js, but the early return
hash includes only margin-box.md. Adding code to an already-synced box and
syncing again left interactive empty. Removing code can likewise leave a
stale module marker.
Include relevant asset existence/content in the dependency fingerprint, or recompute derived interactivity independently of the Markdown cache. Test adding and removing code without editing frontmatter. Source files should not need a meaningless text edit to make their runtime metadata current.
C12 · P2 · Byte-range handling returns wrong data or crashes on valid input shapes
Evidence: reproduced. src/almnck/units/views.py:59.
On a ten-byte fixture, Range: bytes=-3 returned 0123 instead of the last
three bytes. An out-of-bounds or backwards range raised ValueError from
read() rather than returning 416. The range path also reads the requested
data fully into memory instead of streaming it.
Implement suffix/open/closed range semantics, validate bounds and unsupported multi-range input, return correct headers, and stream bounded chunks. Prefer a maintained implementation if available in the chosen serving stack. Exercise video seeking against development serving as well as Caddy.
C13 · P2 · RSS selection uses the article’s subject date rather than publication date
Evidence: reproduced. src/almnck/units/views.py:902.
The feed orders and limits by almanac-day, while its pubDate comes from
frontpage appearances. With 21 later historical subject dates already present,
a newly published article about the year 1000 was absent from the 20-item feed.
Articles about future dates are excluded even when already published.
Choose and apply a publication-date policy consistently across RSS, chronology,
manifests, and the homepage. Preserve the almanac date as subject metadata.
Use timezone-aware feed timestamps rather than formatting a local now as
literal GMT (views.py:930). Add a newly published old-date article and a
future-subject article to feed tests.
C14 · P2 · Relative asset rewriting is incomplete
Evidence: source. src/almnck/units/views.py:465, :747.
Frontpage and draft rendering rewrite selected string forms of src="assets/
and poster="assets/. Download links, srcset, and URLs inside scripts/styles are not covered. An asset can work at the canonical
article URL and fail when the same article is displayed at / or in preview.
Define an explicit article asset base and use URL-aware HTML transformation for the supported attributes. Supply that base to figure modules rather than parsing or hardcoding it. Test one article, with images, downloads, video and responsive sources, at all three render locations.
C15 · P2 · Build failure can leave a partial artifact and strand preserved test directories
Evidence: source. build_with_distill.py:28, :31, :34, :218.
Distill replaces output in place. Test directories are copied aside, then
restored only after distill returns successfully; there is no finally for
failure. A failed build can leave partial web/ and temporary copies whose
location is not recorded for recovery. A later prod-push only checks for
index.html, which does not prove the entire build completed.
Build to a new staging directory, validate it, and promote it atomically with a completion manifest. Preserve the last good artifact for rollback. Handle temporary preservation in a guaranteed cleanup/recovery path. Test a failure after the homepage renders but before all routes/assets finish.
C16 · P1 for private export assets · Standalone exports ignore the private-asset rule
Evidence: reproduced. bin/standalone-article:104;
build_with_distill.py:96, :122. The website copy excludes underscore-prefixed
article assets, but standalone directory/CAR generation copies the complete
asset directory. A synthetic article exported with exit zero and included
assets/_source/private.txt. Margin-box asset copying also lacks the article
privacy filter and copies all box directories regardless of active status.
Share one explicit publication asset policy across website, standalone, and
margin exports. Exclude private source material at every level and test with
sentinel fixtures. Standalone generation also reads CSS/JS from an existing
web/, copies only one first-party JS entry point, and suppresses some copy
errors (bin/standalone-article:100, :104). Define and verify its supported interactive
dependencies rather than promising an offline export without checking them.
C17 · P2 · Manual links and companion assets do not survive publication consistently
Evidence: built artifact. src/almnck/manual/scanner.py:73;
src/almnck/manual/urls.py:9; build_with_distill.py:50.
The built manual had seven missing local URL targets: links rewritten outside
the manual tree, article-source links, and three companion image locations.
The renderer rewrites relative .md links into manual URLs without confirming
the target is a published manual page; it does not copy/rebase companion assets.
Files under the separate docs/ tree are not scanned as manual content.
Resolve links against a manifest of real published documents, distinguish source links from manual links, and copy/rewrite companion resources. Validate the generated manual and static site directly. Passing Markdown source-link checks does not show that their transformed URLs work.
C18 · P2 · Event backups and imports do not preserve the full database contract
Evidence: reproduced omitted relationship; other behavior from source.
src/almnck/events/management/commands/a_date.py:278, :330, :382, :468.
Both portable dump formats omit the article relationship. A fixture linked
to a unit exported no reference to it. Imports always create, do not upsert,
and have no enclosing transaction: an error or repeated slug can leave a
partial import that cannot simply be retried. Stub creation does not record
the resulting event-to-article association and accepts a partially matched
set of requested event references without rejecting the missing ones.
Specify whether exports are full backups or portable content exports. Preserve relationships by stable source path, validate all rows/references first, and offer atomic create/update semantics with an explicit conflict policy. Record stub associations and report unresolved requested events.
C19 · P2 · Event source tags can escape the export directory
Evidence: source. src/almnck/events/management/commands/a_date.py:150,
:161, :208. The value after source: is used directly as a filename.
A source containing ../ or an absolute path can write outside the requested
directory; tags are accepted through normal JSON/import paths. The manually
assembled YAML header also does not escape embedded quotes/backslashes reliably.
Validate or map source identifiers to safe filenames, enforce resolved directory containment, and use a YAML serializer for metadata. Preserve human-edited fields through parsing rather than interpolating strings. This is an import/export safety defect, not an observed malicious event source.
C20 · P2 · Django admin edits can diverge from the declared content source of truth
Evidence: source. src/almnck/units/admin.py:14;
sync_with_repo.py:130. Admin permits editing content, metadata, publication
status, and output paths, but does not write back to editorial files. A later
sync skips the row while its file hash is unchanged, preserving the admin
change; the next file edit can then overwrite it without a merge.
Make imported fields read-only, route edits through the editorial workflow, or implement explicit writeback and conflict detection. Define where emergency publication edits belong so operators do not rely on a temporary database change that Git cannot reproduce.
C21 · P2 · Decryption failure can be treated as successfully synced content
Evidence: source; no encrypted body decrypted for this audit.
sync_with_repo.py:217. If the identity is missing or md-age fails, the
reader reports a warning/error but returns the original ciphertext-bearing
text. Sync can then hash and save that as content. For a unit whose visible
metadata says published, this can replace previously usable content with an
encrypted block while the command still reports success.
Distinguish unreadable content from successful content. Leave the previous row unchanged and fail the publication check for affected published units; report intentional unavailable draft content separately. Test missing identity, decryption failure, and recovery with synthetic encrypted fixtures. Document that successful decryption creates plaintext in the local Django database and protect that database consistently with the preview routes.
Browser behavior and accessibility
B1 · P1 · Changed interactive modules can remain cached for a year
Evidence: source and Node URL-resolution probe.
assets/js/interactive-margin-boxes.js:28;
assets/js/figures/runtime.js:155, :265;
assets/js/figures/video-player.js:7;
assets/system/Caddyfile:10. Margin code imports have no cache tag. Video
runtime propagates its own tag to immediate modules, but that tag hashes only
runtime.js; editing a child does not change it. Nested relative imports of
VTT and Media Chrome have no tag at all. A parent query string is not inherited
by import './vtt.js'.
Fix the entire dependency graph with content-addressed names or a manifest, including margin code. A release tag works only if every dependency receives it. Test a child-only edit through two builds and a warm browser cache. This can prevent readers from receiving functional or security fixes after deploy.
B2 · P2 · Every margin reflow installs another scroll listener and timer
Evidence: source. assets/js/sidenotes.js:1299, :1599, :2298.
positionMarginBoxes() registers raw scroll handlers and minute intervals
each time it runs. Resize, injection, and layout invalidation call it again.
Each listener queries boxes and measures their geometry, so work grows during
a long reading session.
Register one listener/timer at initialization with one owner for teardown; make positioning update geometry only. Test repeated invalidation and assert handler/timer counts remain constant. Ordinary cross-document navigation resets the page, so this finding concerns repeated reflows within a document, not an imaginary continuing HTMX session.
B3 · P2 · Pen edits look saved when persistence failed
Evidence: source. assets/js/pen-marginalia.js:73, :181, :230.
Drawing and erasing update the visible SVG and stroke array before persistence.
The caller ignores saveStrokes() returning false after a storage exception
or the per-page size limit. New marks vanish on reload; erased marks return.
The only warning is in the console.
Persist a candidate state before accepting it visually, or roll back and show an accessible error. Test quota rejection and unavailable storage for both drawing and erasure. Also guard repeated script initialization if the public module contract continues to permit it.
B4 · P2 · Video chapter selection reopens its menu and excludes keyboard users
Evidence: Chromium reproduction and source.
assets/js/figures/video-player.js:382, :403.
An option’s click seeks and hides the dropdown, then bubbles to the parent
handler, which opens it again. The isolated browser probe sought to 12 seconds
and left the menu open. Options are nonfocusable divs with no listbox keyboard
navigation. The alternate scene list and annotations use click-only list
items/paragraphs (video-scenes.js:47; video-annotations.js:192).
Use native buttons or a fully implemented keyboard listbox, stop selection events before the parent toggle, and maintain focus, selection, and expanded state. Test mouse selection plus keyboard-only chapter and annotation use.
B5 · P2 · VTT input and fetch errors disable chapters/annotations
Evidence: Node reproduction. assets/js/figures/vtt.js:20, :59;
video-player.js:342, :360. The parser requires an hours field; a
00:01.000 --> 00:02.000 cue returned no cues, while its three-field
equivalent worked. On HTTP 404, the fetch helper returns an array and then
passes it to the string parser, raising text.replace is not a function.
The video callers lack useful rejection handling.
Parse optional hours and the supported WebVTT grammar deliberately. Return empty results at the correct boundary or reject with useful context, and handle errors in the player with an appropriate reader status. Include legal two-field cues and missing/malformed resources in parser and integration tests.
B6 · P2 · Footnote and image enhancement removes keyboard affordances
Evidence: source. assets/js/sidenotes.js:737, :748, :781, :2467;
src/almnck/templates/base.html:65. Sidenote conversion removes native
footnote return links and substitutes touch gestures on unfocusable elements.
Desktop footnote activation highlights without moving keyboard focus. Image
lightbox activation is click-only, and its dialog has no named close button.
Index search removes the input outline without a replacement
(assets/css/almanack.css:2343).
Preserve a usable jump/return path, focus targets, visible focus indication, and semantic controls. Give the lightbox keyboard activation, a named close control, and focus restoration. Validate actual keyboard and screen-reader flows rather than counting ARIA attributes.
B7 · P2 · Motion preferences and animation termination are incomplete
Evidence: source; runaway-loop trigger conditional.
assets/js/celestial.js:227, :1201;
assets/css/almanack.css:6, :136; assets/js/sidenotes.js:649.
A reduced-motion helper is defined but unused; the CSS has no corresponding
preference rule, and scrolling is unconditionally smooth. Separately,
trackResize() keeps scheduling animation frames until transitionend, with
no duration bound or transitioncancel handling.
Respect the preference across CSS and JS, and give animation loops explicit bounded lifetimes. Correct the old critique’s trigger: reduced-motion alone does not currently suppress these CSS transitions, so it does not itself prove the endless loop. Suppressed or cancelled transitions are the relevant unhandled conditions.
B8 · P2 · Figure URLs break when an article’s date or slug changes
Evidence: source.
editorial/articles/kropotkins-funeral/article.md:46,
editorial/articles/logiebair/article.md:182,
editorial/articles/regolith-with-latitude/article.md:59.
Figure loaders hardcode their canonical asset base. Rebuilding after changing
the date/slug relocates the files without updating those script constants.
Derive the base from the article’s emitted canonical-path metadata and use it at the front page and canonical URL. Test a moved article through the real build. Maintain explicit redirects separately for existing reader links.
B9 · P2 · Checkout can start twice, and signing errors bypass the error UI
Evidence: source. assets/js/topup.js:78;
api/main.py:345. Controls are disabled only after awaiting identity and
signing. Two clicks can both enter and create competing Checkout Sessions.
Signing is outside the request error handler. Identity initialization’s own
deduplication does not deduplicate checkout attempts.
Set a synchronous pending guard and disable controls before the first await; cover initialization/signing/fetch in one error/finally path. Use a stable per-attempt idempotency contract for retries. Test with deliberately delayed promises. Two sessions do not automatically mean two charges; the reader still has to complete payment. A2 covers two completed recurring purchases.
B10 · P2/P3, conditional · Figure reinitialization and multiple-player contracts are broken
Evidence: source; current one-shot pages limit exposure.
assets/js/figures/runtime.js:61, :234;
video-player.js:45, :555, :608.
Reinitialization removes direct children other than VIDEO/FIGCAPTION, but the
enhanced video has already moved inside MEDIA-CONTROLLER. Cleanup does not
unwrap it, so reinit deletes the video. Topic subscriptions lack disposers;
anonymous listeners and synthetic tracks also outlive the advertised cleanup.
Multiple-player behavior has separate assumptions: fullscreen handling consults
the global fullscreen element, same-type figures can receive duplicate IDs
(sidenotes.js:1833), and annotation lookup falls back from a sibling rather
than locating its own player (video-annotations.js:184).
Either enforce one-shot initialization or implement teardown preserving the original DOM and releasing subscriptions. Use unique stable per-figure IDs and scope events to the owning player. The old claim that annotation preferences never persist is too broad: only the timestamp-ID fallback has that problem; Sidenotes often supplies a stable ID first.
B11 · P2 · The masthead overflows a narrow viewport
Evidence: built-site Chromium reproduction.
assets/css/almanack.css:452, :1340;
src/almnck/templates/base.html:50. All seven inspected pages had a 405px
document width at a 390px viewport; desktop widths were correct. The shared
masthead children extended to approximately 405.19px. The navigation retains
an unwrapping flex row and white-space: nowrap in the narrow layout.
A temporary browser-only wrapping override reduced document width from 405px to 390px. Constrain and wrap the navigation so its minimum content width cannot enlarge the page. Retest long labels, larger default fonts, touch layouts, and Safari. This was a narrow Chromium viewport measurement, not a physical iPhone test; distinguish page overflow from intentionally scrollable article margins.
Tooling and maintenance
M1 · P2 · Installation and vendor updates are not reliably reproducible
Evidence: source. Makefile:145; bin/a-install-tools:40, :56;
bin/a-activate:20, :36. Tool/vendor downloads use moving URLs and write
directly to final executable/JS files without checksum or HTTP-failure checks.
An HTTP error body can replace a working file. Sourcing activation also invokes
installation logic, including potential prompts/downloads, and uses unquoted
paths in several places.
Separate installation from activation, pin releases and hashes, stage downloads, and verify before replacement. Keep a vendor manifest recording source, version, license, and update procedure. Test startup from checkout paths containing spaces, and in noninteractive/offline environments. Tool absence should produce a useful failure, not a surprise installer during a test command.
M2 · P3 · Setup instructions and suite descriptions disagree with the code
Evidence: source. doc/03-website/01-setup.md:7, :68, :190, :209;
pyproject.toml:1, :10; bin/a-test:241.
The setup guide says Python 3.10, and AGENTS.md also names uv_build, while
the package requires 3.11 and uses Hatchling; some setup instructions use unlocked pip installs. API
deployment examples bypass newer migration/health-check behavior. Compose naming
and secondary reload descriptions do not consistently match current files.
The test runner’s usage/help text still gives obsolete defaults; test-stress
refers to a test file absent from the tree.
Update instructions around actual supported commands and one dependency workflow.
Keep one authoritative manual tree: docs/ plans/specs are omitted by the
doc/ scanner and checker. Mark old proposals as historical and record which
designs were implemented. Seven Ruff findings remain in tests; fix them in a
small separate cleanup rather than confusing them with runtime defects.
M3 · P2/P3 · Duplicated domain rules have already diverged
Evidence: source and the failures above.
src/almnck/units/views.py contains rendering, file serving, feed policy,
calendar formatting, and selection logic; the sync command imports views.
Frontmatter readers and date parsers recur in sync, manual scanning,
bin/editorial-doctor, bin/update-index, bin/update-summary, and build.
They do not agree on accepted primary filenames, error handling, and date types.
Subscribe implementations and Django/Pandoc rendering also evolve separately.
Extract shared rules where the audit has demonstrated conflicting behavior: metadata validation, canonical URLs, publication dates, asset policy, and rendering context. Keep entry points thin. A wholesale framework replacement is not warranted by this evidence; the static design and small Python tools can remain. Remove unused HTMX-era lifecycle machinery and dependencies only after confirming callers, rather than maintaining comments for a removed navigation model.
M4 · P3 · Smaller rendering and command failures still need explicit handling
Evidence: source. src/almnck/units/views.py:211 handles rem through an
em suffix branch that slices the value incorrectly, losing SVG dimensions.
render_markdown()’s post-render footnote regex (views.py:413) runs across
the complete HTML string, including code examples, rather than text nodes
eligible for references. a-date prints several usage/import/stub errors and
returns success instead of raising CommandError.
Handle SVG units explicitly; transform only appropriate DOM text nodes; return
nonzero for unsuccessful command operations. The data-hide-on-page selector
hides only one following dd, so multi-description lists need a defined
grouping convention. These are small focused repairs with direct fixtures.
Findings from earlier reviews that are fixed or need qualification
| Earlier claim | Current assessment |
|---|---|
Undefined dateAnim prevents the masthead rendering |
Fixed; no remaining references. The artifact browser smoke had no uncaught page errors. |
| Public member ID exposes secret bytes | Fixed: the identifier derives from the Ed25519 public key. |
| Registration can bind an attacker’s key to an existing legacy account | Fixed by the self-derived identifier/registration checks. A5 is profile disclosure, not that takeover. |
| Signature can be replayed across different endpoint operations | V2 binds method/path; tests cover it. Body digests were deliberately rejected; single-use nonces deferred. |
| Removing cached profile loses the member’s public ID | Fixed: identity derives it from the secret. |
| Uncreditable handled webhooks are silently discarded | Durable quarantine and logging now exist; A7 covers the missing recovery operation. |
| Duplicate visits/events have no database uniqueness | Constraints and conflict handling exist. A1 and A4 concern different invariants. |
| An entirely empty content scan always prunes everything | Zero-result guards now exist. C3 concerns partial scans, errors, and atomicity. |
| No deterministic gate, CI workflow, or API unit-test entry point | All now exist. O4/O11/O14 concern fidelity and coverage, not total absence. |
| Pipeline failures necessarily disappear behind tapview; deploy ignores per-host failures | Bash pipefail and fail-fast host deployment were added. TAP assertion handling remains a separate gap. |
| Replica/restore replacement never takes a backup | Outgoing/pre-restore copies and validation were added. O3/O6/O8 identify remaining failure conditions. |
| All large binaries are ordinary Git blobs | LFS attributes and setup exist. O5 concerns upload-hook and checkout integration. |
| Justif spacing remains wholly unaddressed | Version 0.6.4, versioned imports, and margin exclusions are present; no fresh spacing blowout was established. |
| Subscribe confirmation necessarily differs visibly in development | The page has client-side query handling. The duplicate route remains wrong for page-specific rendering. |
| Annotation preferences can never persist | Stable IDs are often assigned first; timestamp fallback and duplicate-ID cases remain. |
| Missing dated celestial images necessarily break rendering | Existing generic-sun and phase-matched-moon fallbacks handle those requests (celestial.js:631). Adjacent-year manifests can be absent when empty. The observed 404s are not counted as active rendering defects. |
| Reduced-motion automatically triggers the endless resize loop | The current CSS does not suppress that transition for the preference. Cancellation/suppression remains unhandled. |
The accepted fresh start for old membership identities, permitted negative balances, and public static publication model are not listed as accidental bugs. Plaintext localStorage keys and executable editorial content share an origin by design. A CSP and stricter key custody would reduce the impact of a future injection, but this audit did not establish an attacker-controlled injection path; adding a policy requires deliberate work on inline scripts.
Suggested repair order and acceptance checks
- Accounting and recovery: fix A1/A2/A4 and the applicable Stripe schema; provide A7 reconciliation. Require ledger/balance agreement under concurrent visits, credits, retries, and multiple subscription histories.
- Safe operations: address O1–O8 before the affected failover, migration, or restore. Demonstrate rejected input leaves the service and recoverable data intact; simulate promotion and failback with writes in between.
- Publication boundaries: address C1–C7, C15/C16, and LFS integration. Require failed validation to leave the previous database/artifact intact, with no writes outside staging and no private sentinel in any export.
- Effective verification and assets: fix the TAP contract, verify the actual revision/image, cover critical regressions, and version the complete asset graph. Check a child-only edit with a warm cache and the built site’s real links/resources.
- Reader behavior and maintenance: fix the remaining feed, page routing, mobile, keyboard, video, and pen defects, then consolidate the domain rules and update the documentation to match the implemented system.
Outcome
This audit produced the report and isolated reproduction evidence. Application code, production services, editorial content, and the existing working database were not changed. The listed remedies are proposed work, not completed fixes.