: asapien/signet

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 
72 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 
128 
129 
130 
131 
132 
133 
134 
135 
136 
137 
138 
139 
140 
141 
142 
143 
144 
145 
146 
147 
148 
# Ticket20: parent admission gate rejected (2026-11-18)

**No product repair retained. Ticket20 is OPEN.** Work remains in the durable
integration worktree named by `~/.local/var/signet-work/current-integration`.
All47 product inputs again match `parser-window-product.sha256` (final22).
Only diagnostic test changes and these notes survive this session. Do not
recover/install the rejected gate merely because its first fixture passed.

## Reproduction and rejected candidate

Baseline replay of `.scratch/parser-window.md` reached61812KiB (63295488 bytes),
with35001 held fields, resumed404, live qpdf and exact RGB/font bytes. The
restored baseline repeat reached63112KiB (64626688 bytes), again with every
content/admission assertion passing. This is still an actual red diagnostic.

A candidate used a persistent `.workload.lock` inode in `data_dir`, shared
POSIX record locks for API parent parse/prune and exclusive locks before worker
jobs/DB transactions. Public kcgi control-fd readiness was checked with pselect
before taking admission, never holding it during idle FastCGI or handler SQL
waits. A two-byte turnstile prevented new readers bypassing a queued worker.
Private native regressions covered group-write mode despite umask077, shared
readers, exclusion, turnstile ordering, SIGKILL release, idle/contended SIGTERM,
parse-error cleanup and symlink refusal. Prune allocation failure kept admission
until the request was freed. No dependency/config/capacity/renderer change.

The held-parent diagnostic was adapted to require an actual worker kernel lock
wait in `/proc/locks`, verify that rendering remained pending while the parser
was stopped, resume the parser, then REQUIRE observed qpdf and exact output.
This passed48868KiB on r2 and51224KiB on r3. The r3 matched preload control
passed55352KiB, original retained-upload fixture55600KiB, full E2E all passed.
These passes did NOT establish that admission began early enough.

## Reverse order exposes the missing coverage

The worker-first diagnostic starts the owned worker with a private PATH qpdf
wrapper, holding it immediately before real qpdf while it owns admission. It
then sends the SAME1120212-byte/35001-field PIM request. A test-only preload
pselect observer records that the ready API parent is retrying admission;
`/proc/locks` confirms the worker owns WRITE, and no parent parse-complete
marker exists yet. The fixture releases the wrapper to exec unchanged real
`/usr/bin/qpdf`, requires proof completion and live-qpdf sampling, resumes the
later completed PIM parse, requires404 and exact RGB/font bytes. No root test
helper is counted in app RSS; the worker's wrapper/helpers ARE counted.

Both warm reverse samples FAIL:59136KiB (60555264 bytes), then59296KiB (60719104
bytes). Optional per-process sampler output in the second run shows live qpdf
33816KiB, PIM child3368KiB, PIM parent2148KiB and worker2804KiB, along with
normal warm API/lighttpd/kcgi cohorts. This is not merely two unrelated peaks
added by hand, nor a green timeout/unobserved-qpdf result. A final reverse
replay after full container restart, also exercising the final wrapper-free
worker restoration, sampled58036KiB (59428864 bytes) and passed. That colder
sample does NOT invalidate the two warm failures or make this candidate safe.
See phase `final-cleanup-replay.log`.

kcgi0.13.4 `child.c:kworker_fcgi_child()` reads the FastCGI body into its own
buffers BEFORE it notifies the control process of readiness. Its child then
transcribes fields over IPC and can block behind a parent that has not entered
parse. Polling `khttp_fcgi_getfd()` and delaying the parent cannot prevent those
child allocations. Inspect the preserved upstream child.c around1999–2273 and
fcgi.c around250–300/636–706; evidence paths are in `parser-window.md`.

**Decision:** reject the parent-only gate. Its complete candidate, native tests
and build staging are preserved privately, but this session's product edits
and E2E additions were restored selectively from the pre-session archive.
All prior dirty work is preserved. No reset/checkout/commit or whole-tree diff
application was used. Native test files for the rejected gate were removed
from the live tree after being archived; production needs no new lock file.

## Retained diagnostic interfaces

Original modes are unchanged. Inside an explicitly owned disposable stack:

```
SIGNET_RESOURCE_PROBE_DISPOSABLE=yes SIGNET_RESOURCE_PARSE_WINDOW=yes \
    sh /src/test/resource-image-probe.sh
```

Still red on current baseline. The original retained-upload/default and matched
`preload` control remain available.

Two candidate-specific modes require the rejected gate or an equivalent future
candidate; they are NOT expected to pass on the restored baseline:

```
SIGNET_RESOURCE_PROBE_DISPOSABLE=yes SIGNET_RESOURCE_PARSE_WINDOW=yes \
    SIGNET_RESOURCE_PARSE_EXCLUSION=yes sh /src/test/resource-image-probe.sh
SIGNET_RESOURCE_PROBE_DISPOSABLE=yes SIGNET_RESOURCE_PARSE_WINDOW=worker-first \
    sh /src/test/resource-image-probe.sh
```

The first requires the actual kernel lock wait on `.workload.lock`; the second
requires the admission retry pselect observer and worker WRITE lock. Adapt these
checks deliberately if a future mechanism differs. Missing markers/timeout is
an invalid test, NEVER a budget pass. `SIGNET_RSS_DETAIL=yes` optionally emits
PID/name/RSS cohorts for new qpdf-phase maxima to stderr; ordinary/default
sampler output stays compatible. Tests remain Linux disposable-stack only.

The worker-first wrapper never replaces `/usr/bin/qpdf`; its private PATH
wrapper and gate are removed on exit, the temporary PIM preload pool is restored,
and the owned worker is restarted without that PATH. Fixture flags are not
production configuration.

## Next repair boundary and permissions

A successful design must account for **already buffering kcgi children as well
as parent materialization**, in both request-first and worker-first order. Do
not lower admitted capacities, qpdf fidelity or concurrency merely to pass a
number. Parent-only locking plus another post-parse free is disproven here.
A web-server/transport admission solution or a narrowly scoped upstream kcgi
change needs further design. No third-party modification, replacement protocol
front end, dependency installation, native deployment or production service
change is authorized by this experiment. Ask before any required exception.
The existing public poll API is not a hook before child-body buffering.
Other20 catalogue/metadata/Redis/history/codecs/arbitrary-PDF/native gates remain
open regardless of this particular counterexample.

## Evidence and verification

Private phase directory (0700, private source/evidence):
`/Users/saikrupa/.local/var/signet-work/parser-repair-20261118/`.
`before/source.tar` plus status/diff preserve the starting tree;
`rejected-candidate.tar` preserves the gate and native tests; `build/` is its
private experimental build staging, NOT authoritative source. Rejected images
`signet-parser-repair-r2`/`-r3` are NOT previews and must not be installed.
Image r1 failed startup due private staging SQL file read permissions; r2 fixed
only image `/src` readability. Existing baseline image was reused for builds;
no package installation, host/VM clock or known_hosts change.

Logs alongside the phase directory are `parser-repair-{red-20261118,
exclusion-red-20261118,build-r1,build-r2,build-r3,window-r2,window-r3,
control-r3,retained-r3,worker-first-r3,worker-first-detail-r3,e2e-r3,
restored-e2e,restored-red}.log`. The phase archive contains the copies as well.
Original candidate-specific red first failed because the baseline has no gate;
only the ordinary baseline diagnostic's `budget_result=exceeded` establishes RSS.

Full E2E on the RESTORED baseline ends `all passed`; all47 current and baseline
image product hashes match the previous manifest. Shell syntax and diff checks
pass; sampler/preload compile cleanly under Alpine `-Wall -Wextra` during probes.
No product renderer/fitting change survives; no new browser/visual/native
acceptance is claimed. Candidate E2E pass is evidence about the rejected
experiment only, not a retained repair.

Owned cleanup checks verify trigger/function/holder counts0, both queue lengths0,
normal API/PIM process counts, no stopped processes, no fixture directories or
PIM preload environment. All session-owned service stacks were then stopped and
retained, exit0; failed startup r1 already exited1. See phase cleanup/stopped logs.
No preserved preview/shared/production service was changed or restarted. No
commit/push/PR. Source/evidence archives are not runtime user-data backups.