docs(phase29aq): add p1 subset instructions

This commit is contained in:
2025-12-31 10:46:25 +09:00
parent 0219384d7b
commit e360ea7de7
5 changed files with 95 additions and 4 deletions

View File

@ -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)

View File

@ -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`

View File

@ -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再発防止の土台

View File

@ -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`

View File

@ -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).