Skip to content

Entity-as-folder support in status scanner#118

Merged
clkao merged 2 commits into
spacedock-dev:mainfrom
ijac13:feat/entity-as-folder
Apr 21, 2026
Merged

Entity-as-folder support in status scanner#118
clkao merged 2 commits into
spacedock-dev:mainfrom
ijac13:feat/entity-as-folder

Conversation

@ijac13

@ijac13 ijac13 commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Closes #99.

Motivation

Hit this again on the release workflow — v1-43-0 is ready to archive but
status --set / --archive can't resolve v1-43-0/index.md. Every folder-based
workflow (blog-writing, release, future commissions) trips the same
non-recursive scan at the first archive boundary.

Change

  • Scanner descends into {slug}/index.md when the flat {slug}.md is absent
  • status --set resolves folder entities by the same rule
  • status --archive stamps archived: in the inner index and moves the whole folder to _archive/{slug}/
  • --archived, --boot, --next, --next-id, --where all inherit via shared discovery
  • Reserved subdirs (_archive, _mods) are excluded from entity detection
  • Conflict case (both flat and folder present) warns on stderr and prefers folder
  • Flat-file workflows unchanged; all existing tests pass

Test

  • New fixtures for folder entities, mixed workflows, and conflict case
  • Existing flat-file suite still green
  • Ran full pytest locally: 444 passed, 22 deselected (live-only markers), 10 subtests passed

🤖 Generated with Claude Code

@ijac13

ijac13 commented Apr 17, 2026

Copy link
Copy Markdown
Contributor Author

Dogfood on real workflows

Ran the updated status binary from this branch against all four of Karen's active workflows in _todo/.

Folder-based (the ones that were broken before)

Workflow Entities found on 0.9.6 Entities found with this PR NEXT_ID
release (2 entities as folders) 0 2 ✅ 003
blog-writing (3 entities as folders) 0 3 ✅ 004

Flat-file (backward-compat check)

Workflow 0.9.6 output This PR output
discussion-to-action 1 entity identical ✅
260413-spacedock-product-strategy 20 entities + 3 malformed flat rows identical ✅

The malformed flat rows in product-strategy (progress.md, snapshot-260413.md, etc. — files with frontmatter but no id:) are pre-existing on 0.9.6. Out of scope for #99; flagging separately.

Release workflow unblocked

v1-43-0 and v1-44-0 are now visible to --boot, --next, --set, and --archive — the original blocker that motivated the PR.

Static tests: 444 passed, 22 deselected (live-only), 0 failures.

clkao added a commit that referenced this pull request Apr 18, 2026
clkao added a commit that referenced this pull request Apr 18, 2026
clkao added a commit that referenced this pull request Apr 18, 2026
…end merge as-is

Pinned design decision: auto-detection (option a) as shipped, NOT explicit
workflow-level entity-style declaration (option b — rejected as scope
expansion). CI red is structural fork-PR secret gating (exit 1 in
Check-required-secret step), not a code regression — needs environment
approval pre-merge so claude-live actually runs. Six nice-to-have test
additions (worktree × folder, mod-block × folder, dotfile-subdir exclusion,
archive-conflict warning, flat-only regression pin) deferred to a follow-up
PR we author post-merge, keeping Karen's scope clean.
@clkao clkao force-pushed the feat/entity-as-folder branch 2 times, most recently from ccd6949 to b4457f4 Compare April 18, 2026 03:55
clkao added a commit that referenced this pull request Apr 18, 2026
…ied on flaky target)

Static: 437/437 (AC-1/2/3/5 all green). Live:
- opus-4-7 teams: PASSED 151.36s
- opus-4-6 teams: PASSED 187.34s, Path A fired, 8/8 internal checks,
  Tier-1 path=dispatch green — the exact flaky context from PR #118 CI
  run 24596336820 is now green via the rewritten two-path assertion.

No 429 quota hit. AC-4's fix-validation intent met; full 9-run matrix
deferred to post-merge CI observation.
clkao added a commit that referenced this pull request Apr 18, 2026
…ied on flaky target)

Static: 437/437 (AC-1/2/3/5 all green). Live:
- opus-4-7 teams: PASSED 151.36s
- opus-4-6 teams: PASSED 187.34s, Path A fired, 8/8 internal checks,
  Tier-1 path=dispatch green — the exact flaky context from PR #118 CI
  run 24596336820 is now green via the rewritten two-path assertion.

No 429 quota hit. AC-4's fix-validation intent met; full 9-run matrix
deferred to post-merge CI observation.
ijac13 and others added 2 commits April 19, 2026 23:48
An entity may now live as either a flat `{slug}.md` file or a folder
`{slug}/` containing `index.md`. The non-recursive scan in the status
binary made folder-per-entity workflows (blog-writing, release) invisible
to `--boot`, `--next`, `--set`, `--archive`, and `--next-id` at the
archive boundary.

Changes:
- discover_entity_files() resolves slugs from both forms, skipping
  reserved subdirs (`_archive`, `_mods`) and dotfiles.
- scan_entities / scan_entities_active delegate to the discovery
  function, so `--next`, `--next-id`, `--boot`, `--archived`, `--where`,
  and the default overview inherit folder support.
- resolve_entity_path() resolves `--set {slug}` to either form, preferring
  folder when both exist and warning on stderr about the conflict.
- resolve_active_entity_path / load_active_entity_fields preserve the
  entity's relative location inside the worktree so folder entities map
  to `{worktree}/{slug}/index.md` rather than `{worktree}/index.md`.
- run_archive() handles folder entities: stamps `archived:` into the
  inner `index.md`, then moves the whole folder into `_archive/{slug}/`.
  Flat-file archival is byte-for-byte unchanged.
- Header docstring documents the new discovery, conflict, and archive
  behavior.

Tests:
- New TestEntityAsFolder suite covers mixed / folder-only workflows,
  `--set` / `--archive` on folder entities, the conflict warning, and
  reserved-dir exclusions. Existing 138-case status-script suite keeps
  passing unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ity naming

Extend the File Naming section so workflows commissioned after this
change know both forms are first-class: flat `{slug}.md` (default) or
folder `{slug}/index.md` (when the entity produces per-stage artifacts
alongside the tracker).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@clkao clkao force-pushed the feat/entity-as-folder branch from b4457f4 to 784ccf6 Compare April 20, 2026 06:50
@clkao clkao merged commit 005aa1c into spacedock-dev:main Apr 21, 2026
2 of 5 checks passed
clkao added a commit that referenced this pull request Apr 21, 2026
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.

Feature: first-class entity-as-folder support (e.g., {slug}/index.md as entity file)

2 participants