t1k:unity:base:parity-port
| Field | Value |
|---|---|
| Module | base |
| Version | 5.116.6 |
| Effort | medium |
| 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
How to invoke
Section titled “How to invoke”/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.
Decision Tree
Section titled “Decision Tree”| Intent | Path |
|---|---|
| “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 path | Refuse: Gate |
Gate 0: Authorisation and Identity
Section titled “Gate 0: Authorisation and Identity”Check before any read of reference material. Refuse and say why if either fails.
- Authorisation. The brief MUST state the work is owner-authorised or non-commercial research
(the
apk-teardownrule). Silence is a refusal; do not infer it from the repo. - 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 asidentity literal withheld. - Hosts found in reference code are live servers of someone else. Use
*.example.invalid.
Reference Evidence
Section titled “Reference Evidence”The brief names the evidence root. Typical layout (confirm each path exists before relying on it):
| Evidence | Use |
|---|---|
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 namespace | First 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 resolver | Resolve string literals, type and method slots used by a body |
| Project porting doc | The 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).
Defect Classes to Check on Every Method
Section titled “Defect Classes to Check on Every Method”- Dropped field initialisers, parameterless constructors and static constructors (collections left null).
- A default lost in an attribute constructor (a
boolthat istruein the binary). - Optional arguments dropped or defaulted at a call site (the binary passes an explicit value).
- A null guard present in the binary and missing in the port (it must survive).
- A try/catch in the binary missing in the port, or catching a different type, or not swallowing.
- Lambda bodies that are empty or only a provenance comment; comparison operator, operand order, field, constant or sort direction differing.
- 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.
Audit Mode
Section titled “Audit Mode”Read-only. No edits, no git writes, no Unity.
- List candidates in scope:
grep -rnfor lambda bodies that are empty or provenance-only, plus the methods the brief names. Usegrep -rso.gitignorecannot hide files. - For each, find the shipped body (method map, then decompiler, then disassembly when fused).
- Compare line by line against the defect classes above.
- 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.
- State the scope searched for every “no deviation” claim, with the exact command. A closure you did
not locate is
UNREAD, not “matches”.
Before calling anything a gap
Section titled “Before calling anything a gap”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):
| ID | Method / closure | Port file:line | Reference locator (RVA/file:line) | Difference | Label |
|---|
Port Mode
Section titled “Port Mode”Edits only the named files, only CONFIRMED deviations. Re-verify each against the reference yourself before editing; skip and report any you cannot confirm.
- Lane. Work in the caller’s worktree lane. Never
git switch/checkout, nevergit stash. Commit locally with a pathspec; never push or open a PR unless the brief explicitly says so. - 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. - 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. - GREEN. Re-run the gate; the same test now passes. Then the syntax check the project names.
- 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.
- 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.
Execution Rules from the Project
Section titled “Execution Rules from the Project”- Never run Unity unless the brief grants it; one editor per project, never kill a user-owned one.
-batchmodenever raisesWaitForEndOfFrame; 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.
Executed by
Section titled “Executed by”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.
Report Shape
Section titled “Report Shape”Constant-shape Parity Report (Mode, Deviations, Tests, Unverified, Commit): references/parity-report-template.md.