Skip to content

Superseded: pure lineage contract prototype - #993

Closed
jeffhuber wants to merge 1 commit into
mainfrom
claude/990-pure-lineage-contract
Closed

jeffhuber wants to merge 1 commit into
mainfrom
claude/990-pure-lineage-contract

Conversation

@jeffhuber

@jeffhuber jeffhuber commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

This unaccepted prototype is superseded by fresh Codex-source PR #994 for #990. Refs #963; it must not close either outcome or satisfy release prerequisites.

Preserved head: fb22be35d74583be4d4332e5f5c87d5836175c47. The complete independent audit is BLOCKED on three P2s: surviving falsey-history convenience paths, noncanonical direct episode storage, and renderer chains lacking one immutable target. Its passing focused/full tests and CI do not override that verdict. Source is clean/quiescent, writer exited, and the broker lease was released with absent readback.

The replacement uses a deliberately small typed core with no legacy optional-context, generic composer or REST-history convenience APIs. Stage #990 remains additive with no live activation; #991 trusted publication and #992 atomic consumer activation follow only after independent acceptance. #915 retains candidate and published-artifact qualification.

This PR closes without merge. Historical source, reviews, discarded findings and complete-coverage evidence remain preserved. No new hosted Devin create allowance.

@jeffhuber jeffhuber added needs-codex-audit builder:claude Code Mower generated label labels Sep 15, 2026
@jeffhuber

Copy link
Copy Markdown
Contributor Author

Code Mower preflight at ff403388f6f111a438ee2893e8a9c955206f0dbc ran 155 focused unittest cases and found one constructor-validation failure plus four vendored-loader harness errors. Ruff, privacy, package workflow guard, readiness and canonical regenerated-manifest equality passed.

Root authorized one same-Claude repair for the two causes: reject zero/bool/invalid PR numbers in the pure episode constructor, and correctly register the standalone dataclass module during the vendored import tests. The scope stays pure, within 15 files / 250 KB; no live adapter or consumer activation. Source cap: $5 / 15 minutes. Fresh focused checks precede broader tests and independent review. This PR remains draft and unqualified.

@jeffhuber
jeffhuber force-pushed the claude/990-pure-lineage-contract branch from ff40338 to fe45c12 Compare September 15, 2026 06:04
@jeffhuber

Copy link
Copy Markdown
Contributor Author

Codex audit (merge-authority lane)

Head SHA: fe45c1226bfdc6aedde48c09bee9417ae9a33702
Findings: P0=0, P1=0, P2=6, P3=0 (blocker policy: any P0/P1/P2 → BLOCKED)

Codex Audit: BLOCKED

Summary:

Independent Code Mower Codex static review of the complete 219,026-byte stage-1 diff against db4506d confirmed six P2 contract defects. All 19 indexed diff parts were read in full across 12 changed files, with byte-for-byte read coverage verified. The review is limited to the pure contract, tests and required package support; it does not require deferred publication or consumer activation. No repository code or tests were executed by this audit.

Findings:

  • [P2] Invalid exact targets discard supplied evidence -- src/code_mower/builder_lineage.py:824
    Finding ID: codex:063cdb3c5e665935e20b
    The identity-only fallback runs whenever the head, repository or PR number is unusable, even when episode evidence was supplied. A matched ordinary identity can therefore replace a supplied takeover when the head is abbreviated or the PR number is a boolean, and the returned Lineage can admit a contributor omitted by that fallback. Keep intentional identity-only/no-context use explicit; an evidence-bearing exact-target request must refuse invalid binding.
  • [P2] Missing branch bypasses immutable target binding -- src/code_mower/builder_lineage.py:590
    Finding ID: codex:2d39bf3f4d2600443180
    Branch equality is checked only when target_branch is nonempty, while target validation does not validate the branch. A valid episode chain consequently resolves with branch="", without proving one of its required target fields. Require a valid branch for evidence-bearing exact-target resolution; keep explicit identity-only compatibility separate.
  • [P2] Normalized identity aliases produce different pure decisions -- src/code_mower/builder_lineage.py:782
    Finding ID: codex:f09816628b54c0178d43
    Conflicting equal-length branch aliases such as CODEX/ and codex/ are selected by insertion order, and trimming a padded prefix loses the original value lookup. The author-map comprehension at line 755 also overwrites conflicting normalized account aliases, although the reviewer-floor API rejects those aliases. Normalize and reconcile once before lookup so the complete resolver and reviewer API refuse the same ambiguity and preserve configured branch policy.
  • [P2] Malformed supplied history is converted to empty evidence -- src/code_mower/builder_lineage.py:1189
    Finding ID: codex:543b315ed4a4db4c6d56
    lineage_context passes comments or () to published_episodes, whose loop repeats that coercion at line 1108. Explicit malformed falsey histories such as False, {} or an empty string therefore become absent evidence before record validation; matched ordinary identity can then resolve successfully. Validate supplied histories at the pure evidence boundary. This finding excludes the context signature's intentional optional None behavior, which needs an explicit compatibility contract.
  • [P2] Evidence composition bypasses the raw-arrival limit -- src/code_mower/builder_lineage.py:1136
    Finding ID: codex:cf7b3dc22d91df1aed5e
    merge_episodes/combine_evidence can collapse 561 identical incoming episodes into one before the resolver sees them, bypassing the promised 560-arrival limit. published_episodes also collects all parsed arrivals at line 1115 before a bound applies. Enforce finite input and working-state limits during evidence ingress/composition, while preserving all 32 cumulative snapshots plus the overlapping private chain (528 + 32 arrivals).
  • [P2] Marker rendering silently drops conflicting evidence -- src/code_mower/builder_lineage.py:1018
    Finding ID: codex:6d3a5eec56b663532f62
    The renderer serializes the supplied sequence and then slices it to 32 episodes. A valid 32-link chain followed by a contradictory duplicate is rendered as only the valid prefix; parsing and resolving that marker no longer sees the conflict. Render only a validated bounded chain, or reject oversized/conflicting input; do not silently truncate evidence.

@jeffhuber

Copy link
Copy Markdown
Contributor Author

Root-authorized stage 1 API revision after the independent exact-head BLOCKED verdict.

The same Claude writer will make one coherent revision: separate strict exact-target/evidence resolution from explicit identity-only use; normalize identity aliases once; validate and bound raw evidence before a single resolver owns deduplication; reject invalid or excessive whole chains before marker rendering; and add actual isolated init-materialized import/parse/resolve proof with an unchanged compatibility-helper control.

Preserve 32 cumulative snapshots plus private overlap, ordinary explicit no-context controls, configured branch conflicts, all prior parser and identity-floor protections, canonical/tool parity, and the pure stage 1 boundary. The unused history selector compatibility and live adapters remain unchanged. The dedicated guard continues to enforce the deferred tools/decisions.py exclusion and the 15-file / 250,000-byte envelope. If a coherent revision cannot fit, stop before push for decomposition.

Bounded source authorization: $20 / 30 minutes, one writer and existing lease. No follow-up source round is automatically authorized. After clean delivery: focused unittest/guards and canonical manifest equality, then sole full unittest discovery and independent complete-artifact exact-head review. The PR stays draft; root owns merge.

@github-actions

Copy link
Copy Markdown

Code Mower notice: previously audited head fe45c1226bfd is no longer an ancestor of current head 329b37c9fb0d; commits may have been dropped. Only current-head audit verdicts count.

@jeffhuber

Copy link
Copy Markdown
Contributor Author

Root-authorized minimal same-Claude correction after canonical preflight on 329b37c9fb0d76430cf153360a9656059cc51e4a: the strict exact-target API requires a raw positive non-boolean bounded integer; the separate coercive mapping parser remains compatible. Correct that single mismatch and its owning regression, preserving the core/tool mirror and all prior invariants. The focused run executed 188 tests with one failure; Ruff, privacy, workflow guard, readiness and canonical manifest equality passed, including the actual isolated materialization proof.

Cap: $3 / 10 minutes, same writer and lease, no broader scope or follow-up round automatically authorized. Root separately authorized a byte-only 2 percent tolerance (255,000 bytes, still at most 15 files); the dedicated guard adjustment was recorded and the deferred-adapter exclusion remains intact. The current diff is below the original 250,000-byte cap. After clean delivery, rerun focused/guards/manifest before full unittest discovery and independent exact-head review. Keep draft.

A pull request can be built by more than one Code Mower builder lane. The
opener, the branch prefix and the single active `builder:*` label each
describe at most one of those lanes, so consumers that each composed those
signals slightly differently stopped agreeing about who wrote the current
diff -- and a lane was admitted to review its own work.

This stage ships only the shared decision, as a pure contract. Nothing
imports it yet; producers, stores, publication, reconciliation and consumer
activation are later stages, so accepted main behaviour is unchanged.

* `code_mower.builder_lineage` -- immutable contribution episodes bound to
  repository, pull request, branch, source lane, destination lane, expected
  head and resulting head; ordered handoff and same-writer continuation; one
  current writer and the full contributor set; exact-head resolution that
  waits rather than guessing; strict announced-marker grammar; raw comment,
  slurped-page and selected-history validation before any normalization.
* `code_mower.lineage_identity` -- the canonical own-reviewer label/account
  floor, the configured-authority marker trust predicate, and the bounded
  published-episode and admission contracts later stages consume.
* `tools/builder_lineage.py` -- the vendored copy a generated product gate
  imports, plus its materialization and package-manifest entries.

The API is organised around five invariants rather than per-call checks:

1. Exact-target resolution and reviewer admission require the complete
   repository, positive non-boolean bounded pull request number, nonempty
   valid branch and full head, through one `require_exact_target` contract.
   Incomplete target data is a `target_invalid` conflict, never a quiet
   downgrade to identity-only -- that downgrade skipped branch binding, so
   evidence from another branch resolved as evidence about this one.
   Identity-only is a route callers select on purpose
   (`resolve_configured_identity`, which takes no evidence argument), and a
   context that is partially populated or carries episodes is never absent.
2. `canonical_identity` normalizes account aliases and branch prefixes once;
   lane naming, branch lookup, the complete resolver, the carried context and
   the reviewer floor all consume that one representation. Compatible
   spellings collapse and contradictory ones refuse regardless of insertion
   order, and longest-prefix matching now looks values up on the canonical
   key, so trimming a key no longer strands its lookup.
3. `bounded_arrivals` enforces the documented 560 raw-arrival budget (528
   cumulative public entries plus 32 private) while the input is walked, so
   an oversized source is never materialised and a lazy one is not consumed
   past the first refused arrival. Collectors and the composer preserve
   validated raw arrivals uncollapsed; only the owning resolver deduplicates,
   where it can also refuse a contradiction. Malformed members are the
   documented contract error, not an incidental attribute failure.
4. `lineage_comment_marker` validates the whole chain through the resolver's
   own walk and refuses zero, malformed, conflicting or unchained input.
   Slicing to the bound turned an over-long chain into a successful
   publication that had quietly lost its newest episodes.
5. The owning packaging test materializes a real product tree through `init`
   and runs a clean subprocess that can only see the generated `tools/`
   directory, asserting module origins and exercising marker parsing, exact
   resolution and an unchanged compatibility helper there.

tools/decisions.py is untouched; its environment-reading parity is stage 3.

Refs #963
Closes #990

Builder-Provider: claude
Builder-Executor: claude_cli
@jeffhuber
jeffhuber force-pushed the claude/990-pure-lineage-contract branch from 329b37c to fb22be3 Compare September 15, 2026 06:43
@github-actions

Copy link
Copy Markdown

Code Mower notice: previously audited head fe45c1226bfd is no longer an ancestor of current head fb22be35d745; commits may have been dropped. Only current-head audit verdicts count.

1 similar comment
@github-actions

Copy link
Copy Markdown

Code Mower notice: previously audited head fe45c1226bfd is no longer an ancestor of current head fb22be35d745; commits may have been dropped. Only current-head audit verdicts count.

@jeffhuber

Copy link
Copy Markdown
Contributor Author

Codex audit (merge-authority lane)

Head SHA: fb22be35d74583be4d4332e5f5c87d5836175c47
Findings: P0=0, P1=0, P2=3, P3=0 (blocker policy: any P0/P1/P2 → BLOCKED)

Codex Audit: BLOCKED

Summary:

Independent Code Mower Codex static review of the complete 252,278-byte stage-1 diff against db4506d confirmed three P2 contract defects. All 22 indexed diff parts were read in full across 12 changed files, with byte-for-byte read coverage verified. The review covers the pure contract and its owning tests/package support, including the isolated materialized import-and-call regression; no deferred publication or consumer activation is required. No repository code or tests were executed by this audit.

Findings:

  • [P2] Malformed histories still become absent evidence -- src/code_mower/builder_lineage.py:1356
    Finding ID: codex:71c187ad712dcc508928
    lineage_context still passes comments or () to published_episodes, whose loop repeats the coercion at line 1276. Explicit malformed falsey histories such as False, {} or an empty string therefore become absent evidence before validation. With a valid target and matched ordinary identity, context resolution can return resolved lineage despite unreadable supplied history. Validate present history at ingress. This finding excludes the signature's intentional optional None behavior, which must remain explicitly distinguished.
  • [P2] Direct episode construction can bypass contributor exclusion -- src/code_mower/builder_lineage.py:225
    Finding ID: codex:cdce40a6092765d6c162
    The direct ContributionEpisode constructor validates stripped lane values but stores the original strings. An otherwise valid handoff with source_lane=" codex " and destination_lane="claude" therefore retains " codex " in the resolved contributors. admission("codex") normalizes the candidate before membership testing and incorrectly admits that contributor. Mapping ingestion normalizes the same values. Normalize or reject noncanonical constructor fields so every accepted episode has the same identity invariant.
  • [P2] Rendering accepts chains spanning different immutable targets -- src/code_mower/builder_lineage.py:684
    Finding ID: codex:c432790fda02bc91f523
    require_episode_chain collects without an ExactTarget, and _order_episodes validates sequence, head continuity and lane continuity without checking one common repository, PR and branch. A handoff followed by a valid continuation naming a different immutable target can consequently render a successful marker, although exact-target resolution rejects that chain. Validate common repository/PR/branch binding across the entire chain before rendering; a validated marker must not represent a chain no target can resolve.

@jeffhuber jeffhuber changed the title Establish the pure builder lineage contract (stage 1 of #963) Superseded: pure lineage contract prototype Sep 15, 2026
@jeffhuber

Copy link
Copy Markdown
Contributor Author

Superseded without merge by #994. The final exact-head review remains BLOCKED; source and review evidence are preserved. #990/#963 remain open through independently accepted staged delivery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builder:claude Code Mower generated label codex-audit-blocked

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant