◐ Off-By-One · answer catalog

docs-legacy-store-reconciliation

2 answer(s)godockergodocker

WARNING: this file is the LEGACY store and is NON-CANONICAL.

📦 Source in repository (JSON)

Answer 1

Problem (MP-GAP-003..006): my-project had two task stores — legacy tasks.md and canonical fixtures.jsonl/schema.sql — that disagreed, README counts were stale hard numbers, the SQL seed had drifted from the fixtures, and docs/skills referenced tasks.md without flagging it. Resolution built at ~/my-project:

1. Keep tasks.md but mark it legacy/non-canonical (MP-GAP-003) — banner at top; canonical role documented in AGENTS.md + README.md:

# Task List — LEGACY, NON-CANONICAL
> **WARNING: this file is the LEGACY store and is NON-CANONICAL.**
> It is kept for historical reference only (MP-GAP-003..006).
> The canonical store is `fixtures.jsonl` (seed mirrored in `schema.sql`).

2. README counts date-anchored (MP-GAP-004) — HTML anchor instead of bare numbers, so counts can never be mistaken for current:

Tracks work items for the my-project codebase. <!-- counts-as-of: 2026-08-12 -->
As of 2026-08-12 the canonical store `fixtures.jsonl` tracks **4 tasks**:
2 done, 1 in progress, 1 todo. ... refresh the anchor when they change.

3. schema.sql seed mirrors fixtures.jsonl (MP-GAP-005) — one INSERT per fixture row, verified by scripts/check_fixture_parity.py.

4. Every doc/skill tasks.md reference marked (MP-GAP-006) — enforced by a block-aware grep gate (scripts/check_legacy_refs.py), the core fix. A naive per-line check is wrong for wrapped sentences: it false-fails a correctly marked doc whose marker sits on a continuation line, and it cannot detect the real miss — an unmarked tasks.md on a continuation line whose marker was never written anywhere. The gate scans paragraph blocks (blank-line delimited) and requires a marker (legacy|non-canonical|deprecated|superseded|archival|historical) within the block, then asserts unmarked-hit count = 0:

MARKER = re.compile(r"\b(legacy|non[- ]?canonical|deprecated|superseded|archival|historical)\b", re.IGNORECASE)
HIT    = re.compile(r"tasks\.md")

def scan(path, per_line):
    findings = []
    if per_line:                                   # naive mode (for comparison only)
        for i, line in enumerate(text.splitlines(), 1):
            if HIT.search(line) and not MARKER.search(line):
                findings.append((str(path), i, line.strip()))
        return findings
    for start, lines in blocks(text):              # block-aware: marker may be
        hits = [(start+k, l.strip()) for k, l in enumerate(lines) if HIT.search(l)]
        if hits and not any(MARKER.search(l) for l in lines):
            findings.extend((str(path), ln, lt) for ln, lt in hits)
    return findings

This is what caught the continuation-line miss: in docs/skills/triage-skill.md the reference sits alone on line 7 while the markers live one line up:

The old task list is legacy and non-canonical — do not trust it. For historical
reference, see
`tasks.md`.

Evidence & signatures

All gates pass; every negative test fails exactly as designed (exit codes shown):

| # | Test | Result |
|---|------|--------|
| 1 | `make check` → legacy-refs gate | `PASS: unmarked-hit count = 0` |
| 2 | `make check` → fixture-parity gate | `PASS: schema.sql seed mirrors fixtures.jsonl (4 rows)` |
| 3 | `make check` → README gate | `PASS: README date anchor present (<!-- counts-as-of: 2026-08-12 -->)` |
| 4 | Inject unmarked `tasks.md` on a continuation line | `FAIL: docs/scratch.md:5` — caught, count=1 |
| 5 | Marker present but in a *different* block (missed-marker case) | `FAIL: docs/scratch.md:5` — caught, count=1 |
| 6 | Change one fixture status (seed desync) | `FAIL: T-003 blocked vs in_progress` — caught |
| 7 | Strip README anchor | `FAIL: missing date anchor` — caught |

Edge cases exercised: continuation-line wraps (marker 1–2 lines from hit → passes), case/whitespace variants (`non-canonical`, `NON-CANONICAL`), `tasks.md` inside backticks/bullets, canonical references (`fixtures.jsonl`, `schema.sql`) never flagged, line numbers accurate after fixing an off-by-one in block start tracking, and no leftover scratch files (tree verified). The naive per-line mode was run for comparison: it false-fails correctly marked `triage-skill.md:7` and `AGENTS.md:13`, proving why the block-aware gate is required.
{"model": "deepseek-v4-flash", "problem_class": "docs-legacy-store-reconciliation", "result": "passed", "tests": 7}

Answer 2

Problem (MP-GAP-003..006): my-project had two task stores — legacy tasks.md and canonical fixtures.jsonl/schema.sql — that disagreed, README counts were stale hard numbers, the SQL seed had drifted from the fixtures, and docs/skills referenced tasks.md without flagging it. Resolution built at ~/my-project:

1. Keep tasks.md but mark it legacy/non-canonical (MP-GAP-003) — banner at top; canonical role documented in AGENTS.md + README.md:

# Task List — LEGACY, NON-CANONICAL
> **WARNING: this file is the LEGACY store and is NON-CANONICAL.**
> It is kept for historical reference only (MP-GAP-003..006).
> The canonical store is `fixtures.jsonl` (seed mirrored in `schema.sql`).

2. README counts date-anchored (MP-GAP-004) — HTML anchor instead of bare numbers, so counts can never be mistaken for current:

Tracks work items for the my-project codebase. <!-- counts-as-of: 2026-08-12 -->
As of 2026-08-12 the canonical store `fixtures.jsonl` tracks **4 tasks**:
2 done, 1 in progress, 1 todo. ... refresh the anchor when they change.

3. schema.sql seed mirrors fixtures.jsonl (MP-GAP-005) — one INSERT per fixture row, verified by scripts/check_fixture_parity.py.

4. Every doc/skill tasks.md reference marked (MP-GAP-006) — enforced by a block-aware grep gate (scripts/check_legacy_refs.py), the core fix. A naive per-line check is wrong for wrapped sentences: it false-fails a correctly marked doc whose marker sits on a continuation line, and it cannot detect the real miss — an unmarked tasks.md on a continuation line whose marker was never written anywhere. The gate scans paragraph blocks (blank-line delimited) and requires a marker (legacy|non-canonical|deprecated|superseded|archival|historical) within the block, then asserts unmarked-hit count = 0:

MARKER = re.compile(r"\b(legacy|non[- ]?canonical|deprecated|superseded|archival|historical)\b", re.IGNORECASE)
HIT    = re.compile(r"tasks\.md")

def scan(path, per_line):
    findings = []
    if per_line:                                   # naive mode (for comparison only)
        for i, line in enumerate(text.splitlines(), 1):
            if HIT.search(line) and not MARKER.search(line):
                findings.append((str(path), i, line.strip()))
        return findings
    for start, lines in blocks(text):              # block-aware: marker may be
        hits = [(start+k, l.strip()) for k, l in enumerate(lines) if HIT.search(l)]
        if hits and not any(MARKER.search(l) for l in lines):
            findings.extend((str(path), ln, lt) for ln, lt in hits)
    return findings

This is what caught the continuation-line miss: in docs/skills/triage-skill.md the reference sits alone on line 7 while the markers live one line up:

The old task list is legacy and non-canonical — do not trust it. For historical
reference, see
`tasks.md`.

Evidence & signatures

All gates pass; every negative test fails exactly as designed (exit codes shown):

| # | Test | Result |
|---|------|--------|
| 1 | `make check` → legacy-refs gate | `PASS: unmarked-hit count = 0` |
| 2 | `make check` → fixture-parity gate | `PASS: schema.sql seed mirrors fixtures.jsonl (4 rows)` |
| 3 | `make check` → README gate | `PASS: README date anchor present (<!-- counts-as-of: 2026-08-12 -->)` |
| 4 | Inject unmarked `tasks.md` on a continuation line | `FAIL: docs/scratch.md:5` — caught, count=1 |
| 5 | Marker present but in a *different* block (missed-marker case) | `FAIL: docs/scratch.md:5` — caught, count=1 |
| 6 | Change one fixture status (seed desync) | `FAIL: T-003 blocked vs in_progress` — caught |
| 7 | Strip README anchor | `FAIL: missing date anchor` — caught |

Edge cases exercised: continuation-line wraps (marker 1–2 lines from hit → passes), case/whitespace variants (`non-canonical`, `NON-CANONICAL`), `tasks.md` inside backticks/bullets, canonical references (`fixtures.jsonl`, `schema.sql`) never flagged, line numbers accurate after fixing an off-by-one in block start tracking, and no leftover scratch files (tree verified). The naive per-line mode was run for comparison: it false-fails correctly marked `triage-skill.md:7` and `AGENTS.md:13`, proving why the block-aware gate is required.
{"model": "deepseek-v4-flash", "problem_class": "docs-legacy-store-reconciliation", "result": "passed", "tests": 7}
Generated from the verified corpus · MIT licensedBack to the catalog