diff --git a/docs/development/current/main/10-Now.md b/docs/development/current/main/10-Now.md index 75709578..1c8fd42b 100644 --- a/docs/development/current/main/10-Now.md +++ b/docs/development/current/main/10-Now.md @@ -3,7 +3,7 @@ ## Current Focus - Phase: `docs/development/current/main/phases/phase-29aq/README.md` -- Next: Phase 29aq P0 (inventory, docs-first) +- Next: Phase 29aq P1 (stdlib subset additions) ## Gate (SSOT) diff --git a/docs/development/current/main/30-Backlog.md b/docs/development/current/main/30-Backlog.md index 90d5045c..1a4cae7f 100644 --- a/docs/development/current/main/30-Backlog.md +++ b/docs/development/current/main/30-Backlog.md @@ -5,7 +5,7 @@ Scope: 「次にやる候補」を短く列挙するメモ。入口は `docs/dev ## Active -- Phase 29aq: `docs/development/current/main/phases/phase-29aq/README.md` (Next: P0 inventory) +- Phase 29aq: `docs/development/current/main/phases/phase-29aq/README.md` (Next: P1 subsets) - JoinIR regression gate SSOT: `docs/development/current/main/phases/phase-29ae/README.md` - CorePlan hardening (docs-first): `docs/development/current/main/phases/phase-29al/README.md` diff --git a/docs/development/current/main/design/coreplan-migration-roadmap-ssot.md b/docs/development/current/main/design/coreplan-migration-roadmap-ssot.md index 1fb301a5..1b27a8cf 100644 --- a/docs/development/current/main/design/coreplan-migration-roadmap-ssot.md +++ b/docs/development/current/main/design/coreplan-migration-roadmap-ssot.md @@ -34,7 +34,7 @@ Related: ## 1.1 Current (active) - Active phase: `docs/development/current/main/phases/phase-29aq/README.md` -- Next step: Phase 29aq P0 (stdlib loop inventory) +- Next step: Phase 29aq P1 (stdlib subset additions) ## 2. すでに固めた SSOT(再発防止の土台) diff --git a/docs/development/current/main/phases/phase-29aq/P1-INDEXOF-PARSEINT-SPLIT-SUBSET-INSTRUCTIONS.md b/docs/development/current/main/phases/phase-29aq/P1-INDEXOF-PARSEINT-SPLIT-SUBSET-INSTRUCTIONS.md new file mode 100644 index 00000000..b87f0d74 --- /dev/null +++ b/docs/development/current/main/phases/phase-29aq/P1-INDEXOF-PARSEINT-SPLIT-SUBSET-INSTRUCTIONS.md @@ -0,0 +1,91 @@ +--- +Status: Planned +Scope: stdlib subsets (index_of/last_index_of, parse_integer, split) +Related: +- docs/development/current/main/phases/phase-29aq/README.md +- docs/development/current/main/phases/phase-29ae/README.md +--- + +# Phase 29aq P1: stdlib subsets (index_of/last_index_of, parse_integer, split) + +Goal: add minimal subsets for three stdlib loops, with fixtures and gate smokes. +Order is fixed: index_of/last_index_of → parse_integer → split. + +## P1-1: index_of / last_index_of (ScanWithInit) + +Target: `apps/lib/json_native/utils/string.hako` + +- `index_of(s, ch)`: + - loop(i < s.length()) + - if s.substring(i, i + 1) == ch { return i } + - i = i + 1 + - return -1 +- `last_index_of(s, ch)`: + - loop(i >= 0) + - if s.substring(i, i + 1) == ch { return i } + - i = i - 1 + - return -1 + +Subset policy: + +- ScanWithInit facts only; no new CorePlan vocabulary. +- Return-in-loop is allowed only for immediate `return i` with literal fallback at end. +- Facts normalize `>= 0` reverse step to existing scan shape if possible; otherwise Ok(None). + +Fixtures/smokes: + +- `apps/tests/phase29aq_string_index_of_min.hako` +- `apps/tests/phase29aq_string_last_index_of_min.hako` +- `tools/smokes/v2/profiles/integration/joinir/phase29aq_string_index_of_min_vm.sh` +- `tools/smokes/v2/profiles/integration/joinir/phase29aq_string_last_index_of_min_vm.sh` +- Wire both into `tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh` + +## P1-2: parse_integer (Pattern2Break) + +Target: `apps/lib/json_native/utils/string.hako` + +- loop(i < s.length()) +- d = this.index_of(digits, ch) +- if d < 0 { break } +- acc = acc * 10 + d +- i = i + 1 +- return acc / neg handling at end + +Subset policy: + +- Pattern2Break facts only; keep break-only (no continue). +- Keep existing “not is_digit” normalization rules; no new UnaryOp. +- If neg handling is present, allow a final `return 0 - acc` literal expression only. + +Fixtures/smokes: + +- `apps/tests/phase29aq_string_parse_integer_min.hako` +- `tools/smokes/v2/profiles/integration/joinir/phase29aq_string_parse_integer_min_vm.sh` +- Wire into `phase29ae_regression_pack_vm.sh` + +## P1-3: split (SplitScan) + +Target: `apps/lib/json_native/utils/string.hako` + +- loop(i <= s.length() - separator.length()) +- if s.substring(i, i + separator.length()) == separator { push segment; i = start } +- else { i = i + 1 } +- final push after loop + +Subset policy: + +- SplitScan facts only; no value-join handling in this phase. +- Only allow `separator.length() > 0` path (empty separator returns early). +- If step join/value_join is required, return Ok(None) (do not Freeze). + +Fixtures/smokes: + +- `apps/tests/phase29aq_string_split_min.hako` +- `tools/smokes/v2/profiles/integration/joinir/phase29aq_string_split_min_vm.sh` +- Wire into `phase29ae_regression_pack_vm.sh` + +## Verification (required when code lands) + +- `cargo build --release` +- `./tools/smokes/v2/run.sh --profile quick` +- `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh` diff --git a/docs/development/current/main/phases/phase-29aq/README.md b/docs/development/current/main/phases/phase-29aq/README.md index 69525634..0b1ee35a 100644 --- a/docs/development/current/main/phases/phase-29aq/README.md +++ b/docs/development/current/main/phases/phase-29aq/README.md @@ -54,4 +54,4 @@ Plan/Composer subsets (or mark unsupported) before adding new subsets. ## Next (planned) -- P1: Pick top 3 subset candidates from the table and define fixtures/smokes. +- P1: Add stdlib subsets in priority order (index_of/last_index_of → parse_integer → split).