Every ticket as the root of its provenance graph — goal, patch, approval, runs and (as the ticket-class build lands) mandate, manifestations, guarantees, journey, artifacts and children. Rendered through the <<<TicketGraphList>>> tag.
Port route doc.record to Go, byte-identical JSON vs rest.php [go-port:db:route:doc.record]
goal
Port ONE unit of congruency to Go. ONE. This ticket is deliberately SMALL: porting a whole
layer at once is what #230 corrected (~130 units exist; a layer-sized tournament fails at
that size). Do not port anything outside this unit.
UNIT KEY : go-port:db:route:doc.record
(the decomposer's idempotency marker — it lives in this ticket's TITLE. Do not
edit the title, or the unit will be re-filed as a duplicate.)
LAYER : db — ticket #224 (pure-Go sqlite over the SAME schema + the data-driven api_routes engine)
PHP SOURCE: the `api_routes` row named doc.record (in the state db)
THE PHP ORIGINAL — the contract, read from this route's `api_routes` row:
route : doc.record
method : POST
auth : token
params : {"repo":"str","path":"str","kind":"str","body":"str"}
sql : INSERT INTO repo_docs (ts, repo, path, kind, body)
VALUES (strftime('%s','now'), :repo, :path, :kind, :body)
It replies {route, affected, rowid} (the sql is a write).
DEPENDS ON (build these first — they are their own unit tickets):
- go-port:db:helper:congruency_rest_route
THE BUILD — small, and ITERATIVE:
1. Implement ONLY this unit in the Go port.
2. Run the equivalence-diff below, PHP original vs Go port, over the SAME database.
3. If the diff is non-empty, fix the Go side and go back to 2. The PHP is the spec: when
they disagree, the Go port is wrong — never 'improve' the behaviour here. If the PHP
is genuinely defective, file a separate bug ticket and port the defect faithfully.
EQUIVALENCE-DIFF — this route WRITES. Never probe it against the live db:
cp /Users/stevenpeterson/code/installed/jazz-project/congruency/checkouts/current/state/congruency.sqlite /tmp/eq-php.sqlite && cp /Users/stevenpeterson/code/installed/jazz-project/congruency/checkouts/current/state/congruency.sqlite /tmp/eq-go.sqlite
boot the PHP original with CONGRUENCY_SQLITE=/tmp/eq-php.sqlite and the Go
port with CONGRUENCY_SQLITE=/tmp/eq-go.sqlite, POST the SAME body to each:
curl -s -H "X-Api-Key: $CONGRUENCY_API_KEY" -X POST -H 'Content-Type: application/json' \
-d '<the params above, as json>' 'http://127.0.0.1:8899/rest.php?route=doc.record'
(and the same against http://127.0.0.1:8900)
Two things must match: the JSON replies byte-for-byte, AND the rows the two
dbs now hold — compare the touched table in each, allowing ONLY the clock
columns (ts/updated, written by strftime('%s','now')) to differ.
PHP encodes these with json_encode(..., JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) and echoes a trailing "\n". Byte-identical therefore also means: 4-space PRETTY_PRINT indent, "/" left unescaped, PHP's key order, PHP's number formatting, and that final newline.
THE GATE (how this ticket settles): the diff above is EMPTY. Not 'equivalent', not 'looks
right' — empty. Paste the exact diff invocation you ran and its empty output as the
evidence. Anything less is not a settled unit.
Kind is `build` (a pair: coder + adversarial tester). This unit gets a tournament only if
someone judges it genuinely worth one — that is the exception on #230, not the default.
Filed mechanically by tools/go_port_decomposer.py under ticket #230.
patch
none
approval
unapproved
runs
no runs recorded
mandate (clauses)
not yet recorded — lands with the ticket-class build
manifestations
not yet recorded — lands with the ticket-class build
guarantees
not yet recorded — lands with the ticket-class build
journey (blunders & successes)
not yet recorded — lands with the ticket-class build
artifacts (forge)
not yet recorded — lands with the ticket-class build