Files
progcode/docs/rebuild-v2/reviews/programmer-final-candidate.md
T

74 lines
11 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Programmer expert — V2 candidate code review
Reviewer: `/root/programmer_expert`. Reviewed Git `69607c52fd5bd27a873515d9811148b312f4aa99` against `7b3f497`. Candidate source `401f0b06436f6eeeabe2635a32e6467cc5b9ff34de7fedfbe4badb7c7ac414f7`; declared build `bc774f70f86b9d0b9ab25631e2457da0451827c1e7fc6204243bc289301e756f`. Read-only inspection of application; this report is the only changed artifact.
Frozen generated output inspected directly: `/tmp/progcode-v2-frozen-401f0b06436f`; its `build-identity.json` contains the same source hash and 14 articles. Local candidate recorded at `http://127.0.0.1:64524` (PID 28007). I inspected source/output and recorded browser evidence rather than claiming a new independent live browser run.
## Verdict
**One small, real code block remains: unknown WordPress shortlink IDs can resolve inherited object properties.** Everything else reviewed below is acceptable for this measured candidate. Fix the shortlink guard and test it before calling the candidate code-accepted; regenerate source/build identity and identify the replacement candidate. This is not a demand to deploy before code acceptance.
The mandatory expanded archive research issue `webprogcode-v2.6` remains open. A code review cannot turn partial Semrush evidence (174 reported / 100 observed, plus 13 known dated leads) into complete restoration. No full-site PASS is issued.
## V2-PE-4: restrict shortlink lookup to own validated entries (P2, blocking candidate code acceptance)
File: `web/app/Shortlinks.jsx:4`.
Current predicate `if(id&&links[id])` accepts inherited properties of the imported JSON object. The values for `constructor`, `toString` and `__proto__` are truthy even though none is a recovered WordPress ID. `location.replace` then coerces the function/object to a URL and navigates away from the home page, usually to a nonsensical relative path and 404. This is a concrete routing error, not an asserted open-redirect vulnerability.
Reproduced without mutating source:
```js
const links = JSON.parse(await readFile('web/data/shortlinks.json'));
for (const id of ['constructor', 'toString', '__proto__', 'missing']) {
console.log(id, Object.hasOwn(links,id), Boolean(id && links[id]), typeof links[id]);
}
// constructor false true function
// toString false true function
// __proto__ false true object
// missing false false undefined
```
Compromise: keep the static client redirect for the 14 verified IDs. Require an own property and a string local article path (or numeric ID plus own-property lookup). Do not invent redirects for unknown values.
Removal criteria: all 14 known IDs resolve to their exact existing article paths; `constructor`, `toString`, `__proto__`, an unknown number and malformed ID stay on the requested home URL with no redirect. Exercise at least the prototype cases in the actual built browser. Then repeat source/build identity and limited frozen-candidate regression checks.
## What was read and independently checked
- Entire `web/scripts/publication-sanitizer.mjs:1-9` and `prepare-publication.mjs:1-43`; `web/package.json` build runs preparation before Next export. Parser-based allowlist removes active tags, handlers and unsafe link schemes; image publication is limited to local `/visuals/`. The hostile fixture executes assertions on the actual sanitizer; I additionally called it directly for script/event/protocol-relative/remote-image input and escaped code. Escaped `<script>` example text remains code. Raw captures do not flow directly into the trusted sink.
- Entire `web/app/articles/[slug]/page.jsx:1-7`, `web/lib/articles.js:1-6`, catchall route `web/app/[...path]/page.jsx:1-12`, `Shortlinks.jsx`, `archive-routes.json`, `shortlinks.json`. Sink receives build-generated sanitized publication JSON. Titles/excerpts/TOC are React text. Canonical article metadata is preserved. 60 historical routes and 14 explicit shortlinks are data-driven; unknown routes use the branded 404.
- All final `contentHtml` bodies were parsed/count-inspected; substantive bodies remain distinct. Input edits, figures, TOC and preparation assertions were read. This technical review does not substitute for content-manager reading and source checking.
- Read full URL inventory/coverage, editorial ledger structure and purpose decisions, `audit-outbound.py`, discovery/fetch/reconciliation code, `crawl-v2.py`, outbound HTTP records. Both formerly omitted standalone paths now have explicitly documented meaningful equivalents, and taxonomy/date/author indexes are generated. Known historical article corpus reconciliation is addressed. Expanded research is still explicitly unresolved.
- Parsed **all 81 frozen HTML files** independently: **91 external href/src/action occurrences, 41 unique external URLs**, all present in the reviewed ledger; **no unledgered external destination**, no on* attributes and no javascript:/data:text/html URL attributes. Full ledger has **481 occurrences and zero unreviewed**, computed again from actual `editorialReviewed` fields: edited body37 / raw226 / template9 / build91 / DOM54 / bundled script64. Raw exclusion decisions do not mean raw ads were republished. Bundled runtime URL strings are separated from actual request evidence; `behaviour.json` reports no external requests.
- Read frozen candidate `manifest.json`, `behaviour.json`, DOM-link record and full-crawl report. Recorded full crawl is 81 HTML / 117 internal targets / 78 nonexcluded inventory rows / 14 canonical bodies, no missing or suspicious records, branded 404. Browser evidence includes positive/negative JSON, compact/copy, search3, D-filter6, keyboard focus and code/table scrolling, known shortlink, TOC and empty/error states. Prototype shortlinks were not covered, hence PE-4.
- Read native D version/results and code fixtures: LDC1.43.0 / DMD2.113.0 results report module unittests passing. PHP fixture results report seven branches with PHP8.3 via `@php-wasm/node3.1.60`; the runner and contract explicitly do not claim real Bitrix/database execution. These recorded tests substantiate fixture behavior, not full live CMS compatibility.
- Read full Dockerfile, `.dockerignore`, production workflow and stack. Diff excludes docs/raw/tracker from image context, preserves static runtime and introduces branded 404 configuration. Manager/user configuration fails closed; image tags and OCI revision retain commit identity. No new global infrastructure mutation is required.
## Disposition of initial findings and release check
- PE-1: known CDX corpus/legacy omissions are now reconciled in inventory and generated routes; expanded Semrush scope remains mandatory open under `webprogcode-v2.6`.
- PE-2: reproducible build sanitization and per-occurrence outbound ledger now exist; independently scanned frozen output reconciles with that ledger. Acceptable for this candidate, subject to preserving the same boundary after PE-4 fix.
- PE-3: **release verification still needed after authorized V2 deployment**. Code acceptance is a prerequisite for deployment, not dependent on already having deployed. Once the candidate fix and the mandatory restoration/review gates are satisfied, deploy through the existing site-specific Gitea/Swarm path, then inspect exact reviewed OCI commit/image digest, source/build identity, healthy service, HTTPS/TLS and deployed representative content/legacy/404/static paths. Until those real checks occur, production acceptance remains pending. Old V1 health evidence cannot close it.
No other blocking application-code defect was found in this inspection. Do not describe this conditional result as completed restoration, completed production, or full-site PASS.
## PE-4 follow-up — candidate 0524a74 (2026-10-26)
Reviewed exact diff `69607c5..0524a74` for `web/app/Shortlinks.jsx:4-9`. The new implementation requires `Object.hasOwn(links,id)` before access, a string target and `/articles/` prefix. Unknown prototype properties no longer reach `location.replace`. This resolves the reported source-code defect.
Replacement identity: Git `0524a74`; source `656da6da3e89c1b5c48d320b192838f3e6e897b31d78a0a420fc99786d9ac31f`; declared build `81a4845cd8a03bc7e2c7dc94e83a3eaf63ca63e104252b0d582846e657db2257`; frozen root `/tmp/progcode-v2-frozen-656da6da3e89`, local `http://127.0.0.1:58132`, PID90713. Read the frozen `build-identity.json` and verified its source identity; inspected the actual compiled chunk `_next/static/chunks/0nimocrvoruuf.js`, which contains the own-property guard and article path constraint.
Independent read-only condition test passed: all14 own shortlink keys return their exact configured target; `constructor`, `toString`, `__proto__`, `hasOwnProperty`, `99999999`, empty ID, external-looking ID and arbitrary path produce no redirect target. New complete crawl report identifies local58132 with81 HTML /117 targets /14 canonical bodies, no missing/suspicious findings. Current outbound ledger remains481 rows/0 unreviewed.
**Code verdict: ACCEPTED for the measured candidate. No remaining application source-code block identified.** The requested actual-browser regression artifact `docs/rebuild-v2/evidence/candidate-656da6da3e89/shortlink-regression.json` was still absent during this follow-up; the implementer's in-progress claim is not recorded as completed evidence. Its final browser check remains a verification gate before final acceptance, rather than a request for another source change. The earlier code-block verdict above describes the superseded401f candidate.
Release remains pending: mandatory expanded research `webprogcode-v2.6`, completed new-candidate browser evidence and post-authorized-deployment health/revision/TLS checks. NoV2 production evidence was supplied or implied. This code acceptance does not authorize bypassing an automatic-review rejection or certify upload success; the coordinator must report the actual access/upload state. It also does not make incomplete Semrush coverage a completed restoration.
## PE-4 browser verification completed — exact656da6 candidate
Read and validated actual `evidence/candidate-656da6da3e89/shortlink-regression.json`: sourceHash matches reviewed656da6da3e89 candidate; all14 configured own IDs reach their exact article path and render nonempty full body (305–21627 recorded characters); all5 unknown/prototype IDs (`constructor`, `toString`, `__proto__`, `hasOwnProperty`, `99999999`) record no redirect after verified hydration. Independently asserted the JSON targets against `web/data/shortlinks.json`, source identity, result counts and no-redirect/hydration fields. This closes the previously pending PE-4 browser regression gate. The initial harness failure was corrected in the harness; no additional product-code change was represented by that correction.
**Final candidate code verdict: ACCEPTED, PE-4 fully verified closed.** No remaining application code or shortlink-verification block identified for0524a74 / source656da6da3e89 / build81a4845cd8a0. This supersedes the pending-regression wording immediately above.
Mandatory expanded restoration research `webprogcode-v2.6` remains open; release still requires actual authorized V2 deployment followed by source/revision/digest, health, public TLS and content checks. Reviewed upload-preflight's recorded original-human authorization evidence, but this report makes no claim that upload/deploy has succeeded and does not authorize circumventing an automatic-review rejection. No full-site restoration or production PASS.