Repository navigation
docs: define the opaque acquisition identifier contract - #124
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 32 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Parent triage and current validationI read the full independent report and accept its technical APPROVE for exact head Corrections and limits:
Full review follows with normalized links. Ignored receipt paths refer to retained local evidence. Independent Adversarial Review: PR #124 (
|
| Operation / Invariant | Path Lock Production Path | Semaphore Slot Production Path | Analysis & Parity Verification |
|---|---|---|---|
| CLI Validation | lib/110-release.sh#L21-L26lib/140-extend.sh#L20-L25 |
lib/170-semaphores.sh#L289-L294 |
Identical: Both call valid_holder "$2" || fail '--acquisition must be a nonempty UTF-8 line' 2. Rejects empty input, CR, LF, and invalid UTF-8 without store mutations. |
| Stored Blob Validation | lib/055-record-validation.sh#L68-L71 |
lib/055-record-validation.sh#L68-L71 |
Shared: Role lock and role slot both execute valid_holder "${R_FIELD["${oid} acquisition"]:-}". Any syntax violation marks the record invalid. |
| NUL Byte Detection | lib/050-the-snapshot.sh#L31-L37lib/005-utf8.sh#L4-L6 |
lib/050-the-snapshot.sh#L31-L37lib/005-utf8.sh#L4-L6 |
Shared: capture_text uses read -r -d '' to abort on embedded NULs from git cat-file --batch. valid_utf8 pattern range [\001-\177] strictly excludes byte 0x00. |
| Minting New Identifier | lib/090-claim-planning.sh#L141-L142 |
lib/170-semaphores.sh#L160 |
Identical: Both invoke new_acquisition (lib/080-families.sh#L80-L84), generating printf '%s-%05d-%05d%05d' "${at}" "$$" "${RANDOM}" "${RANDOM}". |
| Renewal / Refresh Preservation | lib/140-extend.sh#L38-L48 |
lib/170-semaphores.sh#L154-L165 |
Consistent semantics: In extend, acq is read from poid and written unchanged to the new record blob. In sem acquire, an active holder refresh keeps acq from own_oid (L157), whereas an expired slot triggers new_acquisition (L160). |
| Family Hierarchy Rewrites | lib/080-families.sh#L102,L111 |
N/A (Semaphores do not participate in family trees) | Verified: bump_parent increments family generation and creates a new blob OID, but carries acq="$(field "${poid}" acquisition)" forward unchanged. |
| Guard Matching & Stale Handling | lib/110-release.sh#L56-L62 |
lib/170-semaphores.sh#L216-L221 |
Exact Parity: Release checks [[ "${have_acq}" != "${acqs[${i}]}" ]] and [[ "${want_acquisition}" != "${own_acq}" ]]. Mismatches emit {"event":"nothing",...,"reason":"superseded"} with exit code 0. |
| Multi-Guard Orthogonality | lib/110-release.sh#L52-L61 |
lib/170-semaphores.sh#L218 |
Independent: Both compare --record and --acquisition independently. Evaluated as (want_record != own_oid) || (want_acquisition != own_acq). Neither overrides the other regardless of CLI flag order (honoring PR #123 invariants). |
| Offline Migration | lib/185-migrate.sh#L16-L19 |
lib/185-migrate.sh#L16-L19 |
Shared: cmd_migrate indexes existing blob OIDs directly into the state tree without inspecting or regenerating acquisition values. |
| Doctor / Integrity Auditing | lib/175-doctor.sh#L25-L29 |
lib/175-doctor.sh#L31-L48 |
Consistent: In case of invalid stored acquisition text, validate_record fails and doctor emits structured findings record-decodes (locks) or sem-record (semaphores) rather than crashing. |
Wrapper (with) Verification |
lib/160-with.sh#L374-L378 |
lib/160-with.sh#L374-L378 |
Shared: with_reason performs direct string comparison [[ "${acquired}" != "${W_ACQUISITION}" ]] during both admission verification and exit cleanup. |
3. Merges and History Audit
Inspection of git log from base 6735e52007ab86a37feda8b43b1d43742fdb5f94 to head 4bce816f19a3ee836b89bc34726cc4b6d6c20334:
* 4bce816 test: reject normalized aliases of acquisition guards
* 512fd4a test: verify opaque identities through migration and renewal
* d665170 docs: propose opaque acquisition identifier contract
- Merge Commits: Exactly 0 merge commits in this branch history (
git log --mergesreturned empty). The branch is a clean linear series of 3 commits. - Base Integrity (PR fix: enforce independent semaphore release guards #123): Base commit
6735e52007ab86a37feda8b43b1d43742fdb5f94integrates PR fix: enforce independent semaphore release guards #123 (commite7a31a021d90c753d37927d335d2d6be56dbdab3). The fix inlib/170-semaphores.sh#L218separating record and acquisition comparisons remains completely untouched and functional at HEAD.
4. No Trusted Claims: Evidence & Behavioral Verification
Every factual, behavioral, and compatibility assertion in the PR description, commit messages, and decision document was audited against raw code and recorded receipts:
-
Synthetic Opaque Identities Through Migration and Renewal:
- Doc Claim: Stored records with arbitrary nonnumeric ASCII and Unicode identifiers survive offline migration with identical root tree hash, survive renewal with new record OID, reject stale record guards, and reject NFC-normalized variants of decomposed characters.
- Code Audit:
test/acquisition-identity.pysynthesizes blobs withopaque-legacy-ownerandowner-e\u0301-雪(decomposede+U+0301). It verifies:assert root() == syntheticaftergit locks migrate --offline(line 63).assert current['acquisition'] == identityandassert current['record'] != recordafter extension/refresh (lines 68-69).assert stale['reason'] == 'superseded' and root() == renewedwhen providing old record OID (line 72).assert unicodedata.normalize('NFC', identity) != identitygeneratesowner-é-雪, which is rejected withreason: supersededwithout altering root state (lines 74-80).assert locks(*release, '--acquisition', identity)[0]['event'] == 'released'succeeds and modifies root (lines 81-82).
- Verdict: Fully verified against test implementation.
-
PR fix: enforce independent semaphore release guards #123 Regression Evidence:
- Doc Claim: "PR #123 corrected semaphore guard aliasing at this baseline. Its full guarded suite passed, including 31 release-guard cases. The four RED failures represented three distinct failure scenarios."
- Raw Evidence Check: Inspected
.test-results/semaphore-guards-evidence.jsonand.test-results/semaphore-guards-red-latest.log. Lines 26, 29, 30, and 31 show the 4 RED failures:- Failure 1 (
stale-record False): old record passed before matching acquisition released anyway. - Failure 2 (
stale-acquisition True): stale acquisition passed before matching record released anyway. - Failures 3 & 4 (
record-as-acquisition False&True): record OID passed to--acquisitionreleased anyway due to argument aliasing.
This precisely constitutes 3 distinct failure scenarios across 4 test cases.
- Failure 1 (
- Verdict: Fully verified against historical receipts.
-
Absence of Broken Links:
- Doc Check: Inspected
docs/decisions/acquisition-identifiers.md#L69-L75. Relative links target:../../lib/030-time-refs-records.sh../../lib/055-record-validation.sh../../lib/080-families.sh../../lib/110-release.sh,../../lib/140-extend.sh,../../lib/170-semaphores.sh../../lib/185-migrate.sh../../test/release-guards.py,../../test/state-coherence.py
All target files exist at the specified relative paths fromdocs/decisions/.
- References to GL-006 and GL-007 are non-link task identifiers; references to issue Output contract drift: the schema defines a sweep skipped line nothing emits, and the acquisition id has no grammar so release --acquisition garbage exits 0 #74 and PR fix: enforce independent semaphore release guards #123 use fully-qualified GitHub URLs. No broken links exist.
- Doc Check: Inspected
5. Constants & Resource Bounds Audit
Audited against .test-results/acquisition-contract-evidence.json and .test-results/acquisition-contract-full-launch.json:
| Metric / Parameter | Enforced Binding Limit | Measured Value in Evidence | Margin / Compliance |
|---|---|---|---|
| Subprocess Timeout | 10 seconds | 10s per command in test/acquisition-identity.py
|
Compliant; guards against deadlock |
| Suite Execution Timeout | 1800 seconds (30m) | Completed within single bounded run | Compliant |
| Host Disk Free Space |
|
717,054,595,072 bytes (667.8 GiB) | Well above floor ( |
| Docker VM Free Space |
|
681,437,782,016 bytes (634.6 GiB) | Well above floor ( |
| Generated Build Cache |
|
0 bytes generated | Well within budget |
| Peak Runtime Non-Object Storage |
|
6,070,272 bytes (5.79 MiB) | Well within budget |
| Runtime Log Budget |
|
71,269,792 bytes generated / 93,805 bytes stdout | Well within budget |
Tmpfs Mount: /work |
512 MiB quota | 3,235,840 bytes (3.09 MiB) | Peak |
Tmpfs Mount: /tmp |
512 MiB quota | 21,561,344 bytes (20.56 MiB) | Peak |
Tmpfs Mount: /evidence |
16 MiB quota | 3,448,832 bytes (3.29 MiB) | Peak |
| Container Constraints | 2 CPUs, 2 GiB RAM, 256 PIDs | Configured via host_config in isolation manifest |
Verified |
Worker state: Reused container git-locks-tests stopped cleanly; native host lock /var/folders/g7/h_9lmyb14gs68tfzv88dklt00000gn/T/git-locks-docker-tests.lock and workstation leases released.
6. Numeric Claims Audit
Cross-verified all numbers stated in PR description, documentation, and receipts:
-
Source SHA-256 Hashes:
-
Makefile:d0b1d1f64f68fc8d48ec0016f75c64d96d778e4b72fbd6363fe0c7e917ba8014(Verified byte-identical) -
docs/decisions/acquisition-identifiers.md:1347ff8e693a4c3892f5be68d4237b70556fc4c614d23b14c37912a256e427b4(Verified byte-identical) -
test/acquisition-identity.py:b561c60993b3ab1130fae38124e886fa1c1ab0b3dd22b6b507d4077be731c501(Verified byte-identical)
-
-
Test Checks:
-
4 synthetic identity cases: Checked in
test/acquisition-identity.py(path + semaphore$\times$ ASCII + Unicode) and confirmed in.test-results/acquisition-contract-full-latest.log#L494-L499. -
1,102 shell checks: Verified in log line:
1102 passed, 0 failedfromtest/test.sh. -
31 release-guard checks: Verified in log line 493:
31 passed; 0 failedfromtest/release-guards.py. -
760 capacity checks: Verified in log line 512:
capacity: 760 checks passed; seed 3507; 39 valid and 31 invalid inputs; 12 racers / 3 winners. -
240 literal path checks: Verified by counting 240
oklines intest/literal-paths.shrun (log lines 1615–1857).
-
4 synthetic identity cases: Checked in
7. State Machine Transitions, Errors, and Guard Outcomes
The Required Behavior matrix in docs/decisions/acquisition-identifiers.md#L39-L49 was systematically tested against the production state transitions:
stateDiagram-v2
[*] --> InputValidation
InputValidation --> UsageError : Empty / CR / LF / Invalid UTF-8
UsageError --> [*] : Exit 2 (No Mutation)
InputValidation --> Snapshot : Well-formed UTF-8 Line
Snapshot --> SnapshotRefusal : Stored NUL / Corrupt Stored Record
SnapshotRefusal --> [*] : Store Error Exit 2 / Doctor Finding
Snapshot --> StateEvaluation : Valid Snapshot
StateEvaluation --> AbsenceResult : Job / Slot Missing
AbsenceResult --> [*] : Exit 0 / Exit 1 (Documented Absence)
StateEvaluation --> GuardCheck : Job / Slot Exists
GuardCheck --> SupersededResult : Mismatched Acquisition / Stale Record
SupersededResult --> [*] : Release exits 0 ("nothing") / Renewal exits 1 ("refused")
GuardCheck --> ActionExecution : Matching Guards
ActionExecution --> ExpiredRenewalRefusal : Extend on Expired Lease
ActionExecution --> MutationCommit : Valid State & Clock
MutationCommit --> [*] : CAS Write Root Tree
- Usage Refusal (Exit 2): Tested in
test/release-guards.py. CLI rejects bad UTF-8 or newlines before snapshot or transaction planning. - Fail Closed on Stored Corruption: Tested via
test/doctor-findings.pyandtest/store-integrity.py. Bad records in state trigger snapshot read errors or doctor findings. - Absence Handling: Absent jobs produce documented absence objects without assuming whether the guard was previously valid.
- Exact Byte Identity: Prohibits Unicode canonical equivalence aliasing (e.g. NFD vs NFC), ensuring deterministic POSIX-level string comparisons.
8. Repository Standards & Decision Document Review
- Drafting Style:
- Adheres to requested Simplified Technical English (ASD-STE100) principles: short, unambiguous, declarative sentences with active verbs.
- Paragraphs are concise and focused on single requirements or rationale points.
- Scope Isolation:
- The document explicitly acknowledges that GL-007 retains ownership of schema definitions and event table updates.
- Frontmatter correctly pins
baseline_commit: "6735e52007ab86a37feda8b43b1d43742fdb5f94"and conforms toschema: "git-locks-decision/1".
- Makefile Integration:
Makefile#L44insertspython3 test/acquisition-identity.pyinto thetest-containertarget cleanly.- Shell scripts list
SCRIPTSis unchanged because the added test is Python, leavingshellcheckandshfmttargets clean.
9. Review Coverage Limitations & Operational Gaps
To maintain strict truth in review, the following limitations are recorded:
- Synthetic vs. Historical Store Evidence: As explicitly noted in the decision document and PR description, the tests synthesize records using
git hash-objectandgit update-index. While this proves that production decoders, migration scripts, and release guards accept opaque values, it does not constitute an empirical survey of real-world historical repository stores. - Hosted CI Execution: Hosted CI run
37297214775was reported as live during supervisor inspection and recorded as successful in the evidence file. In accordance with read-only/no-network instructions, no live network query was initiated; terminal verification will be enforced by the parent before merging. - Concurrency and Power Failure: Synthetic test execution operates sequentially in temporary repositories. It validates deterministic logic and CAS semantics, but does not simulate kernel crashes or physical host power interruption.
- Schema Alignment Deferred:
schema/git-locks.schema.jsoncurrently specifiesacquisitionwith"minLength": 1and does not yet declare regex constraints excluding CR/LF. This is not a defect of PR docs: define the opaque acquisition identifier contract #124, as GL-007 explicitly owns schema and event-contract alignment.
10. Mandatory Verification Checklist
- Every code path traced (file:line to file:line):
- Input validation:
lib/110-release.sh#L21-L26,lib/140-extend.sh#L20-L25,lib/170-semaphores.sh#L289-L294tolib/030-time-refs-records.sh#L48andlib/005-utf8.sh#L4-L6. - Stored validation:
lib/055-record-validation.sh#L68-L71tolib/050-the-snapshot.sh#L49-L53. - Generation:
lib/090-claim-planning.sh#L141-L142andlib/170-semaphores.sh#L160tolib/080-families.sh#L80-L84. - Renewal/refresh:
lib/140-extend.sh#L38-L48andlib/170-semaphores.sh#L154-L165. - Guard comparison:
lib/110-release.sh#L52-L62andlib/170-semaphores.sh#L216-L221. - Migration:
lib/185-migrate.sh#L16-L19. - Doctor auditing:
lib/175-doctor.sh#L25-L48. - Wrapper verification:
lib/160-with.sh#L374-L378.
- Input validation:
- Every merge audited: 0 merge commits between base
6735e52007ab86a37feda8b43b1d43742fdb5f94and head4bce816f19a3ee836b89bc34726cc4b6d6c20334. Linear history intact; PR fix: enforce independent semaphore release guards #123 independent guard invariants preserved. - Every constant and claim checked against evidence:
- Subprocess timeouts (10s), runtime timeout (1800s), memory (2 GiB), CPUs (2), PIDs (256).
- Storage budgets (20 GiB build, 4 GiB runtime, 128 MiB logs, 50 GiB disk floor) verified against
.test-results/acquisition-contract-full-launch.jsonand.test-results/acquisition-contract-full-resources.json. - PR fix: enforce independent semaphore release guards #123 4 RED failures across 3 modes verified against
.test-results/semaphore-guards-red-latest.log.
- Every doc and evidence figure checked:
- Source file SHA-256 hashes verified.
- 4 synthetic cases, 1,102 shell checks, 31 release guards, 760 capacity checks, 240 literal paths verified against
.test-results/acquisition-contract-full-latest.log.
- Raw evidence coordinates identified:
.test-results/acquisition-contract-evidence.jsonand associated files in/Users/j/git/git-locks/.test-results/. - Explicit coverage gaps documented: Synthetic data limitation, offline reviewer inspection status of hosted CI, and schema alignment deferral to GL-007 recorded.
- Checks executed vs inspected: Static file inspection and receipt analysis executed; no host commands modifying state, no test suite execution on host, and no network calls made.
11. Final Verdict
APPROVE
Propose an explicit acquisition-identifier contract: identifiers remain opaque nonempty UTF-8 lines, and callers compare the complete value without normalization. The current generator pattern does not become a stored-data restriction. This preserves existing reader and migration behavior while defining malformed, absent, stale, expired, and matching guard outcomes.
Add synthetic compatibility checks for path and semaphore identities through offline migration, record rewrites, and guarded release. Unicode cases include a decomposed character and require a distinct NFC-normalized guard to remain stale. These tests exercise existing behavior; production code does not change.
Part of GL-006 and #74. This does not close #74: schema, event-table, and output-contract implementation remains GL-007. The decision remains proposed until review and acceptance. Ready for review against main. Recorded acceptance and the task-card/evidence update remain follow-up work after roadmap #121 lands.
Validation:
4bce816f19a3ee836b89bc34726cc4b6d6c20334: four opaque-identity cases including normalized-guard refusal, 1,102 shell checks, 31 release-guard cases, 760 capacity checks, and the remaining suites..test-results/acquisition-contract-evidence.json. Hosted CI run 37297214775 passed on the same head.