Skip to content

Add deprecate action and staleness check to BitLesson workflow#188

Open
LukeLIN-web wants to merge 2 commits into
PolyArch:devfrom
LukeLIN-web:bitlesson-deprecate-staleness
Open

Add deprecate action and staleness check to BitLesson workflow#188
LukeLIN-web wants to merge 2 commits into
PolyArch:devfrom
LukeLIN-web:bitlesson-deprecate-staleness

Conversation

@LukeLIN-web
Copy link
Copy Markdown

BitLesson's knowledge base was effectively append-only: the round stop gate validates only the Delta format, with no way to retire a superseded lesson and no check that an existing lesson's cited paths still resolve. After a refactor, entries silently rot, and a stale lesson handed to an implementer is worse than none.

deprecate:

  • bitlesson-validate-delta.sh accepts Action: deprecate, routed through the existing concrete-ID + Notes checks so it references a real entry.
  • Deprecation is a tombstone, not a delete: mark the entry Status: deprecated and keep it for history; bitlesson-select.sh never selects a deprecated entry.
  • Contract text updated across docs/bitlesson.md, commands/start-rlcr-loop.md, templates/bitlesson.md, setup-rlcr-loop.sh, loop-codex-stop-hook.sh, and the bitlesson-delta-{invalid,missing} block templates.

staleness:

  • New scripts/bitlesson-staleness.sh reports entries whose cited file references no longer resolve under the project root. Advisory by default, --strict exits non-zero, deprecated entries skipped.
  • Detection is extension-anchored for precision: it ignores prose slashes and ratios (GO/NO-GO, 248/275), fenced template blocks, and ellipses.

tests:

  • +4 validator cases (deprecate) and a new staleness suite (8 cases), both registered in run-all-tests.sh. Full suite: 2265 pass, 0 fail.

BitLesson's knowledge base was effectively append-only: the round stop
gate validates only the Delta format, with no way to retire a superseded
lesson and no check that an existing lesson's cited paths still resolve.
After a refactor, entries silently rot, and a stale lesson handed to an
implementer is worse than none.

deprecate:
- bitlesson-validate-delta.sh accepts `Action: deprecate`, routed through
  the existing concrete-ID + Notes checks so it references a real entry.
- Deprecation is a tombstone, not a delete: mark the entry
  `Status: deprecated` and keep it for history; bitlesson-select.sh never
  selects a deprecated entry.
- Contract text updated across docs/bitlesson.md, commands/start-rlcr-loop.md,
  templates/bitlesson.md, setup-rlcr-loop.sh, loop-codex-stop-hook.sh, and
  the bitlesson-delta-{invalid,missing} block templates.

staleness:
- New scripts/bitlesson-staleness.sh reports entries whose cited file
  references no longer resolve under the project root. Advisory by default,
  --strict exits non-zero, deprecated entries skipped.
- Detection is extension-anchored for precision: it ignores prose slashes
  and ratios (GO/NO-GO, 248/275), fenced template blocks, and ellipses.

tests:
- +4 validator cases (deprecate) and a new staleness suite (8 cases), both
  registered in run-all-tests.sh. Full suite: 2265 pass, 0 fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Behavior unchanged (same flags on the real KB, all 8 tests green); ~254 -> 132 lines.

- Drop guards now subsumed by extension-anchoring + the path charset
  (glob/special-char chain, URL `//`, ratio, leading-dash checks).
- Replace the per-token `find` + cache with a single repo scan: collect file
  basenames once, resolve bare filenames via membership test.
- Replace the report state machine with an ordered map printed at the end.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zevorn
Copy link
Copy Markdown
Contributor

zevorn commented Jun 3, 2026

@codex review this pr thoroughly

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 22df60ce91

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

BITLESSON_ACTION=$(echo "$BITLESSON_ACTION_CANDIDATES" | awk 'NF{print; exit}')

if [[ "$BITLESSON_ACTION_COUNT" -ne 1 ]] || [[ "$BITLESSON_ACTION" != "none" && "$BITLESSON_ACTION" != "add" && "$BITLESSON_ACTION" != "update" ]]; then
if [[ "$BITLESSON_ACTION_COUNT" -ne 1 ]] || [[ "$BITLESSON_ACTION" != "none" && "$BITLESSON_ACTION" != "add" && "$BITLESSON_ACTION" != "update" && "$BITLESSON_ACTION" != "deprecate" ]]; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require deprecate to tombstone the lesson

When a round reports Action: deprecate, this path now accepts the action but then only reuses the generic ID/Notes/existence checks; it never verifies that the referenced entry was actually marked with Status: deprecated. A summary can therefore pass while the lesson remains active and still eligible for bitlesson-select.sh, which defeats the new tombstone workflow in any round where the author forgets to edit the entry itself.

Useful? React with 👍 / 👎.

[[ "$b" == "1" ]] && DEPRECATED=$((DEPRECATED + 1))
else # CAND: a=type, b=key, c=token
if [[ "$a" == "S" ]]; then
[[ -e "$PROJECT_ROOT/$c" || -e "$c" ]] && continue
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve staleness paths only inside the project root

When this scanner is invoked from outside the project, the || -e "$c" fallback lets a slash-bearing reference pass merely because the same relative path exists in the caller's current directory, even though it is missing under --project-root. That makes --strict produce false negatives for stale lessons in common scripted/absolute-path invocations; the check should be rooted consistently at PROJECT_ROOT rather than also consulting the process cwd.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants