Skip to content

Latest commit

 

History

History
113 lines (81 loc) · 4.59 KB

inbound.md

File metadata and controls

113 lines (81 loc) · 4.59 KB

inbound.py

Revision: 1 Last modified: 2026-12-04T19:00:00Z

Overview

inbound.py handles inbound intake (C7) and DB-vs-tracker reconcile for the Issues mirror (anchor §11.4.300; operator decisions 2026-11-25).

Its two governing rules are both safety properties:

  1. The DB wins. A tracker edit is never silently applied over the workable-items database.
  2. Everything here is READ-ONLY toward both trackers and the DB.

Instead of writing, it emits proposal files at docs/issues_sync/inbound/<id>.md. Those proposals are adopted only through the normal workable-item procedure — by a human, or by an independently reviewed change. Nothing here calls workable-items. So a hostile or mistaken tracker edit cannot become a tracker-side write to the database; the worst it can do is produce a document a reviewer must read.

Tracker text is UNTRUSTED DATA

An issue body is written by anyone with comment access on the upstream. Treating it as anything other than data is prompt injection with extra steps. So inbound text is:

  • normalised;
  • secret-scanned — a single hit withholds the whole text, it is not partially redacted;
  • length-capped;
  • placed only inside a code fence longer than any backtick run it contains, so the text cannot close the fence and escape into the surrounding document;
  • never executed, never interpolated into a command, never followed as an instruction.

Withholding the entire text on a secret hit is the conservative choice on purpose: a partially redacted body invites the reader to trust the parts that were left.

Prerequisites

  • python3.
  • Read access to the configured tracker(s) and to the workable-items DB.
  • A writable docs/issues_sync/inbound/ directory for proposals.
  • Tokens read by variable name elsewhere; nothing here prints a credential.

Usage examples

# collect inbound proposals for review (writes proposal files only)
python3 -m issue_sync.pipeline pull

# compare the DB against the tracker state
python3 -m issue_sync.pipeline reconcile

Each proposal lands at docs/issues_sync/inbound/<id>.md.

Exported surface

The module provides inbound intake and reconcile entry points used by pipeline.py and cli.py. It is a library: it has no CLI of its own. Its contract-level behaviour is:

Behaviour Guarantee
Tracker reads Read-only.
DB access Read-only.
Output Proposal files under docs/issues_sync/inbound/.
Adoption Only via the normal workable-item procedure, externally.

Exit codes

As a library, results surface through the caller (pipeline.py / cli.py), which use the three-valued convention:

Code Meaning
0 OK.
1 Drift or conflict reported.
2 Cannot determine — never a pass.

Edge cases

  • A tracker edit that conflicts with the DB. Reported, and its text is preserved as a proposal — never applied, never overwritten.
  • A body containing a secret. The whole text is withheld from the proposal; the rest of the metadata still records that a proposal exists.
  • A body containing backtick fences. Fenced with a longer run, so it cannot escape its block.
  • A very long body. Length-capped rather than truncated into something that reads as complete.
  • An item with no upstream issue. Nothing inbound to reconcile.
  • A body instructing the reader to do something. It is data in a fence, never an instruction.
  • An unreachable tracker during reconcile. Reported as cannot-determine (2) for that leg, never as "in sync".

Internal behaviour

  1. Reads the configured trackers (read-only).
  2. For each relevant issue, extracts the body and metadata.
  3. Normalises the text, then scans for secrets; a hit withholds the entire body.
  4. Length-caps the text and wraps it in a code fence longer than any backtick run it holds.
  5. Writes a proposal file under docs/issues_sync/inbound/<id>.md.
  6. For reconcile, compares DB content hashes against the tracker and reports drift without writing.

Related scripts

Called by pipeline.py (pull, reconcile) and cli.py.

Related: payload.py (outbound allowlist and hashing — the mirror-image guard), redact.py (the shared redaction primitives), store.py (read-only DB access).

See also docs/scripts/pipeline.md, docs/scripts/payload.md, docs/scripts/redact.md and docs/scripts/store.md.

Last verified

2026-12-04 — python3 -c "import ast;ast.parse(open('scripts/issue_sync/inbound.py').read())" → exit 0. The module exposes no CLI entry point (it is a library), so there is no --help to run.