Skip to content

t1k:unity:base:parity-port

FieldValue
Modulebase
Version5.116.6
Effortmedium
Tools—

Keywords: 1:1 port, catch parity, closure audit, closure mismatch, fix parity deviation, lambda deviation, parity audit, port to match the binary, reconstruction parity

/t1k:unity:base:parity-port
<AUDIT|PORT> <scope> evidence=<reference path> authorised=<owner|research>

Parity Port: Audit and Fix a 1:1 Reconstruction

Section titled “Parity Port: Audit and Fix a 1:1 Reconstruction”

A reconstructed port is correct only when each method, closure and catch matches the reference evidence. This skill is the procedure; the executor is agent t1k-unity-base-parity-porter. Decompiling an APK is apk-teardown; new features are t1k-unity-base-feature-implementer.

IntentPath
“Compare ported code to the reference, change nothing”AUDIT: Audit
“A deviation is confirmed, make the code match”PORT: Port
“Is this really a deviation?”AUDIT first; port only a CONFIRMED row
Brief lacks authorisation or evidence pathRefuse: Gate

Check before any read of reference material. Refuse and say why if either fails.

  1. Authorisation. The brief MUST state the work is owner-authorised or non-commercial research (the apk-teardown rule). Silence is a refusal; do not infer it from the repo.
  2. Identity hygiene. Never copy the original publisher’s identity into code, tests, docs, commit messages or reports: account/org/cloud-project ids, bundle ids, keystore aliases or passwords, API keys, service ids, hosts, remotes. Never read or print reports/identity_original.json. If a reference body contains such a literal, port the logic, replace the literal with a neutral placeholder, and name the location in the report as identity literal withheld.
  3. Hosts found in reference code are live servers of someone else. Use *.example.invalid.

The brief names the evidence root. Typical layout (confirm each path exists before relying on it):

EvidenceUse
Method map (Namespace.Type$$Member -> RVA)Locate the shipped method; RVAs come only from here, never guessed
Metadata dump (type layouts, field offsets, per-method RVA lines)Field order, defaults, optional-argument shape, signatures
Decompiler output per namespaceFirst read; it often fuses neighbouring tiny lambdas and cuts off at the first return/throw, so it HIDES try/catch
Disassembly helper (--rva)Authoritative body when pseudocode is fused or missing
Literal/slot resolverResolve string literals, type and method slots used by a body
Project porting docThe project’s own defect classes and method-port steps; read it first

Some decompiler shards print addresses offset from the real RVA; normalise before cross-referencing. Async/iterator bodies live in the compiler-generated state machine (MoveNext), not the kickoff method. Closures are <>c.<Method>b__N_M (lambdas) and DisplayClass (captures); locate them in the method map. Data, config and balance values come from the original before any design choice: original-first (references/original-first.md).

APK-port evidence (evidence-index lookup, method bundles, the single parity pass): apk-port-evidence (references/apk-port-evidence.md).

  1. Dropped field initialisers, parameterless constructors and static constructors (collections left null).
  2. A default lost in an attribute constructor (a bool that is true in the binary).
  3. Optional arguments dropped or defaulted at a call site (the binary passes an explicit value).
  4. A null guard present in the binary and missing in the port (it must survive).
  5. A try/catch in the binary missing in the port, or catching a different type, or not swallowing.
  6. Lambda bodies that are empty or only a provenance comment; comparison operator, operand order, field, constant or sort direction differing.
  7. Order of statements, event subscribe order, and execute-on-add flags.

The reverse also holds: a guard, log line, try/catch or “helpful” branch in the port that the binary lacks is a deviation. Remove it in PORT mode.

Read-only. No edits, no git writes, no Unity.

  1. List candidates in scope: grep -rn for lambda bodies that are empty or provenance-only, plus the methods the brief names. Use grep -r so .gitignore cannot hide files.
  2. For each, find the shipped body (method map, then decompiler, then disassembly when fused).
  3. Compare line by line against the defect classes above.
  4. Label each row CONFIRMED (both bodies read, difference reproducible with a quoted command or disassembly lines) or SUSPECTED (anything less). A SUSPECTED row is never ported.
  5. State the scope searched for every “no deviation” claim, with the exact command. A closure you did not locate is UNREAD, not “matches”.

A column or asset the original reads is a gap only if reachable with shipped data. Verdicts: MISSING-AND-REACHABLE, PARITY, DORMANT-BOTH. No referrer is not unwired (art loads by key from WarShipUIArtBank). Method: references/reachability-and-wiring-verdicts.md.

Deviation table (constant shape):

IDMethod / closurePort file:lineReference locator (RVA/file:line)DifferenceLabel

Edits only the named files, only CONFIRMED deviations. Re-verify each against the reference yourself before editing; skip and report any you cannot confirm.

  1. Lane. Work in the caller’s worktree lane. Never git switch/checkout, never git stash. Commit locally with a pathspec; never push or open a PR unless the brief explicitly says so.
  2. RED proof first. Write the parity test, run it through the gate command the brief names, see it FAIL for the right reason on the current code. No gate command: write the test, state not run: no gate command, label the assertion UNPROVEN.
  3. Port the body. Keep the signature, member order and attributes untouched. Match the binary, including its quirks. First line of the body is the provenance comment // from <Type>$$<Member> @ 0x<RVA> (RVA from the method map). Reuse the file’s own conventions.
  4. GREEN. Re-run the gate; the same test now passes. Then the syntax check the project names.
  5. No additions. Never add diagnostic logging, defensive null guards, try/catch, or “cleanup” to 1:1 code. The one exception is a seam the project docs explicitly sanction.
  6. Commit with fix(parity): ... via pathspec, then report.

Pinned Parity Test (inverts, never re-pins)

Section titled “Pinned Parity Test (inverts, never re-pins)”

A test that asserts a known-remaining deviation is a pinned baseline and owes a companion (rules/pinned-baseline-test-companion.md):

  • Assert by identity: name the closure or method, not a count.
  • Assert both directions: no new undocumented deviation, and no documented one silently fixed.
  • When a pin goes red because the gap closed, invert it to assert the healthy state. Never re-pin to whatever the run reported.
  • Prefer the healthy-state assertion (the sort comparator orders as the binary does; the handler swallows the exception) over a pin whenever you are fixing the deviation now.
  • Pin the player-visible state, not the report about it: references/reachability-and-wiring-verdicts.md.
  • Drive time and frames explicitly; no sleeps; no Assert.Pass.
  • Never run Unity unless the brief grants it; one editor per project, never kill a user-owned one.
  • -batchmode never raises WaitForEndOfFrame; play-mode checks need a windowed run (project docs).
  • Hand the verification ladder (compile, scene audit, smoke, EditMode, PlayMode) to the orchestrator unless the brief assigns it to you.
  • A newly found defect class gets a detector script, not hand fixes across instances.

t1k-unity-base-parity-porter runs both modes; the mode is picked from the brief. An orchestrator may run AUDIT inline when it needs the findings in its own context.

Constant-shape Parity Report (Mode, Deviations, Tests, Unverified, Commit): references/parity-report-template.md.